Use `make-screen-bitmap` to create the destination bitmap, and draw the
pict into that bitmap with `draw-pict`.

I think `pict->bitmap` should take an optional `#:make-bitmap`
argument, and then you could provide `make-screen-bitmap` for that
argument. I'll make that change.

Another possibility is to add a `#:backing-scale` argument to
`pict->bitmap`. I like adding `#:make-bitmap` better, because using
`make-screen-bitmap` makes drawing consistent with direct drawing to
the screen in more ways than setting the backing scale.

At Thu, 13 Jul 2017 17:34:26 -0500, Philip McGrath wrote:
> Bitmaps created using pict->bitmap look pixelated to me on screen (on Mac
> OS in "Retina" mode, which I suspect might be relevant). I initially
> discovered this when using picts as labels for message% instances like this:
> 
> #lang racket/gui
> 
> (require pict)
> 
> (define f
>   (new frame%
>        [label "Example"]))
> 
> (new message%
>      [parent f]
>      [label (pict->bitmap (disk 100))])
> 
> 
> (new canvas%
>      [parent f]
>      [style '(transparent)]
>      [min-width 100]
>      [min-height 100]
>      [paint-callback (λ (c dc)
>                        (draw-pict (colorize (disk 100) "green")
>                                   dc
>                                   0
>                                   0))])
> (send f show #t)
> 
> 
> The black disk in the above is pixelated for me, while the green one drawn
> on a canvas looks normal.
> 
> I also noticed as I was writing this that evaluating (pict->bitmap (disk
> 100)) in the DrRacket REPL produces a pixelated result compared to
> evaluating (disk 100).
> 
> Is there either a way to avoid this in general, or else a recommended way
> to do the equivalent of using picts for message% labels in particular? (I
> suppose I could subclass canvas% …)
> 
> Thanks,
> Philip

-- 
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.

Reply via email to