[racket] Using *.ico files
At Mon, 10 Sep 2012 13:00:55 -0700, Danny Yoo wrote:
> Hmm. Something VERY strange is happening with the alphas being
> produced by ico->argb vs the alphas expected by the bitmap functions.
> They seem... flipped!
The problem seems to be in `argb->bitmap' from
`mrlib/cache-image-snip'. That function creates and old style
bitmap+mask combination (insteda of a bitmap with an alpha channel),
and it uses "alpha" values as mask values (instead of inverting an
alpha value to arrive at a mask).
Here's a version of `ico->bitmap' that uses `racket/draw' directly and
creates a bitmap with an alpha channel:
(define (ico->bitmap ico)
(define w (ico-width ico))
(define h (ico-height ico))
(define bm (make-bitmap w h))
(send bm set-argb-pixels 0 0 w h (ico->argb ico))
bm)