At Sun, 21 Nov 2010 10:55:22 +0900, 김태윤 wrote: > it's about 10 hours since I stuck at overlaying several images > (make only selected color to transparent) > could somebody give me an little advice? > just little hint about big picture would be very helpful for me. > please~~! > > #lang racket/gui > (define base-dc (make-object bitmap-dc% (make-object bitmap% 320 320 #f) )) > (define m-canvas% > (class canvas% > (override on-paint) > (define on-paint (λ () (send (send this get-dc) draw-bitmap (send > base-dc get-bitmap) 0 0))) > (super-new))) > (define color (make-object color% "red")) > (define f (new frame% (label "a"))) > (define c (new m-canvas% (parent f)(min-width 320) (min-height 320))) > (send base-dc draw-bitmap (make-object bitmap% "./src/arena.png") 0 0 ) > (send base-dc set-argb-pixels 0 0 288 256 (make-bytes (* 4 288 256))) > (send base-dc draw-bitmap (make-object bitmap% "./src/char4.png") 0 0 ) > (send f show #t)
Is the problem that "arena.png" and "char4.png" are images with transparency, but `draw-bitmap' draws them solid? If so, you need to supply 'png/mask as the after the pathname when loading the bitmap (define bm1 (make-object bitmap% "./src/arena.png" 'png/mask)) and then use the bitmap mask when drawing: (send base-dc draw-bitmap bm1 0 0 solid (send the-color-database find-color "black") (send bm1 get-loaded-mask)) It's much simpler in the current development version of Racket, where transparency is more directly supported on bitmaps. In version 5.0.99.2, (send base-dc draw-bitmap (read-bitmap "./src/arena.png") 0 0) automatically loads and uses transparency information. _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users