Re: [racket-users] Scribble, Picts, and Serialize/Deserialize Oddities

2016-10-06 Thread Vincent St-Amour
Wild guess: this may be a bug in record-dc%.

IIRC, DrRacket uses record-dc% when rendering picts, and it would make
sense that serialization would too. But drawing picts directly wouldn't.

The last time I saw that kind of bug (inconsistent pict rendering
between contexts), it turned out that record-dc% was not keeping track
of some properties of the drawing, and so rendering was off when the
recording was rendered.

As a first step, I'd recommend trying to render your pict using a
regular dc and a render-dc, to see if that's where the difference is
coming from. Then, if that's the case, you can see which dc commands
your example runs, and make sure that record-dc records everything about
them faithfully.

Vincent



On Thu, 06 Oct 2016 14:32:19 -0500,
Leif Andersen wrote:
> 
> I have been playing with scribble and serialize/deserialize a bit lately
> in a (somewhat successful) attempt to make my paper build in a
> reasonable amount of time.
> 
> Anyway, I noticed some interesting behavior when Scribble is combined
> with picts and serialize/deserialize. And I'm kind of stumped as to what
> could cause it.
> 
> Take the following file:
> 
> ```
> #lang scribble/manual
> 
> @(require pict
> racket/serialize)
> 
> @(define x
> (vc-append
> (filled-rectangle 30 10 #:color "yellow")
> (filled-rectangle 30 10 #:color "yellow")))
> 
> @x
> 
> @(deserialize (serialize x))
> ```
> 
> This code defines a pict made out of two yellow rectangles stacked on
> top of each other. It makes a document containing these two rectangles,
> followed by the two rectangles after they've been serialized and
> deserialized. Provided that `x` is serializable (which it supposedly
> is), I would imagine that the two pictures would look the same. Instead
> however, it ends up looking like this. (The PDF file is also attached).
> Inline image 1
> Note how after its been serialized and deserialized, the two rectangles,
> appear slightly further apart and have a doubly thick line.
> 
> For what its worth, if I have DrRacket draw the pict it always shows up
> like the bottom rectangle.
> 
> Both of these images make sense (depending on how we intemperate
> border), but I'm a bit confused why it would show up differently after
> being serialized and deserialized. Any ideas?
> 
> Thank you.
> 
> ~Leif Andersen 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Scribble, Picts, and Serialize/Deserialize Oddities

2016-10-06 Thread Leif Andersen
I have been playing with scribble and serialize/deserialize a bit lately in
a (somewhat successful) attempt to make my paper build in a reasonable
amount of time.

Anyway, I noticed some interesting behavior when Scribble is combined with
picts and serialize/deserialize. And I'm kind of stumped as to what could
cause it.

Take the following file:

```
#lang scribble/manual

@(require pict
  racket/serialize)

@(define x
   (vc-append
(filled-rectangle 30 10 #:color "yellow")
(filled-rectangle 30 10 #:color "yellow")))

@x

@(deserialize (serialize x))
```

This code defines a pict made out of two yellow rectangles stacked on top
of each other. It makes a document containing these two rectangles,
followed by the two rectangles after they've been serialized and
deserialized. Provided that `x` is serializable (which it supposedly is), I
would imagine that the two pictures would look the same. Instead however,
it ends up looking like this. (The PDF file is also attached).
[image: Inline image 1]
Note how after its been serialized and deserialized, the two rectangles,
appear slightly further apart and have a doubly thick line.

For what its worth, if I have DrRacket draw the pict it always shows up
like the bottom rectangle.

Both of these images make sense (depending on how we intemperate border),
but I'm a bit confused why it would show up differently after being
serialized and deserialized. Any ideas?

Thank you.

~Leif Andersen

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


sertest.pdf
Description: Adobe PDF document