leafac
2017-11-8 11:59:24

Thank you very much :slightly_smiling_face: But, hey, that’s a lot of hoops we have to jump through for such a simple task. Would there be interest for ‘save-image’ and ‘save-svg-image’ functions for pict, à la 2htdp/image?


samth
2017-11-8 13:32:03

@leafac yeah that would be great


leafac
2017-11-8 13:39:10

:+1: I opened this issue, then: https://github.com/racket/pict/issues/35


blerner
2017-11-8 13:55:25

It looks like picts are convertible, and that the convertible protocol implementation for picts accepts ’svg-bytes as a target format. Would that suffice here?


leafac
2017-11-8 13:59:11

Unfortunately, I can’t tell, because I don’t know what “convertibles” are. But even if they suffice, I think there’s still room for some helper functions, or, at the very least, for some improvements to the documentation.


blerner
2017-11-8 14:02:14

see http://docs.racket-lang.org/file/convertible.html?q=file%2Fconvertible — essentially, (convert your-pict 'svg-bytes) should give you a bytestring containing a valid svg


blerner
2017-11-8 14:02:32

(not all the conversion targets are supported by all convertible things, annoyingly, but it looks like picts do support svg-bytes)


blerner
2017-11-8 14:03:14

(someone else more knowledgeable about this should chime in here; I know just enough about convert to know that it exists, but I haven’t played around with picts very much)


leafac
2017-11-8 14:06:32

Yes, this seems to be in the direction I’m thinking about…


stamourv
2017-11-8 17:21:16

@mflatt: Quick distro-build question: is make site guaranteed to exit with a non–0 return code if any of the build clients failed?


mflatt
2017-11-8 17:38:28

@stamourv It looks like the non–0 status may only happen with completely sequential builds. That could be fixed for builds that include parallel parts.


stamourv
2017-11-8 18:05:01

Ok, thanks for confirming! I’ll try implementing the change.


stamourv
2017-11-8 18:13:40

That turned out to be pretty easy, actually. I’ll push the change.


mflatt
2017-11-8 18:16:22

Great - thanks


notjack
2017-11-8 21:01:08

@mflatt how nondeterministic is the distro-build process?


mflatt
2017-11-8 21:03:46

There’s non-determinism in bytecode compilation (reduced over time, but not eliminated outside the main “collects”) and in C compilation (because C compilers tend to have some non-determinism, too, if you’re not at Google)


zenspider
2017-11-8 21:54:57

@blerner does that mean I can remove metapict from the equation and just do all this directly?


blerner
2017-11-8 21:57:24

I don’t think metapict was part of the issue. It’s just a library you used to create the pict, no? So for example, #lang racket (require pict file/convertible) (define p (filled-rectangle 40 40)) (convert p 'svg-bytes)


blerner
2017-11-8 21:58:40

if you want to make a metapict-based pict, that’s your prerogative, but it doesn’t seem to have to do anything with how to convert the underlying pict to a svg, unless I misunderstand your problem scenario


zenspider
2017-11-8 22:05:42

I’m just trying to peel back the onion and see how much code this really takes. metapict is providing a lot of drawing… I wasn’t sure what type of thing I was getting back therefore didn’t know whether I could do the convertable (I can—so much cleaner than that bottom blob I had!)… now I’m trying to peel back the drawing code from metapict


zenspider
2017-11-8 22:07:00

I guess I should also poke at 2htdp/image


blerner
2017-11-8 22:07:34

I suspect (but am not an expert here) that metapict is a convenience library over the underlying pict datatype. It makes it easier to construct sophisticated picts, but that’s orthogonal to how to save them. Likewise, 2htdp/images are convertible, which is ultimately how I save them, by converting them to png-bytes :slightly_smiling_face:


zenspider
2017-11-8 22:11:28

thanks!


blerner
2017-11-8 22:13:26

http://soegaard.github.io/docs/metapict/metapict.html#%28part._reference-pict%29 documentation: “All images in MetaPict are represented as picts. A pict is a structure that holds information on how to draw a picture. A pict can be rendered to produce an image in various formats such as png, pdf, and, svg.”