Hi All,
I need help to draw a "sprite" (small bitmap) on top of a bitmap.
The sprite in question is consists of a transparent background and has a solid yellow circle in the center.
My test program looks like this (scroll to see the end of the program):
#lang racket
(require racket/gui)
(define w 200)
(define h 200)
(define bm (make-object bitmap% w h))
(define dc (new bitmap-dc% [bitmap bm]))
(define black (send the-color-database find-color "black"))
(define sprite (make-object bitmap% "sprites.png"))
(send dc set-background black)
(send dc clear)
bm
sprite
(send dc set-smoothing 'unsmoothed)
(send dc draw-bitmap-section
sprite ; source
0 0 ; dest
0 0 16 16 ; source
'solid ; ignored for color bitmaps
black ; ignored for color bitmaps
sprite ; use the α channel as mask
)
bm
The output is shown below. It shows that the sprite is drawn on top of the black background.
I was expecting a "solid" yellow, but the black background is seen below the sprite.
Why?
The image "sprites.png" is here: