New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter plot-background-alpha
has no effect (since 8.1)
#96
Comments
Thanks for reporting this. This was likely introduced by the plot-metrics changes in #90. A call to The workaround for now is to create the bitmap separately and use #lang racket
(require plot/no-gui racket/draw)
(define out (open-output-file "img.png" #:exists 'replace))
(define bm (make-bitmap 800 300))
(define dc (send bm make-dc))
(parameterize ([plot-width 800] [plot-height 300]
[plot-background-alpha 0])
(define xs (build-list 20 (λ _ (random))))
(define ys (build-list 20 (λ _ (random))))
(define pts (points (map vector xs ys)
#:color "black"))
(plot/dc (list pts)
dc 0 0 800 300
#:x-min 0 #:x-max 1
#:y-min 0 #:y-max 1))
(send bm save-file out 'png) The fix is to specify that an alpha channel needs to be created in these places: plot/plot-lib/plot/private/no-gui/plot2d.rkt Line 107 in c412600
plot/plot-lib/plot/private/no-gui/plot3d.rkt Line 138 in c412600
|
Thanks @alex-hhh. I'll use the workaround until a fix gets merged. |
As part of racket#90, calls to `(make-bitmap ...)` were replaced with `(make-object bitmap% ...)` but the two calls have different defaults for whether to create an alpha channel for the bitmap or not. The `(make-object bitmap% ...)` variant defaults to not having an alpha channel, so it needs to be explicitly specified.
Racket snapshot builds now contain a fix for this issue and the fix will also be available in Racket 8.2 |
It seems that
plot-background-alpha
no longer works when generating png files withplot-file
. This bug was introduced after Racket 8.0. Here's a quick example:Please let me know if something has changed with this parameter.
The text was updated successfully, but these errors were encountered: