Hi all,

I'm having trouble loading a 16x16 monochrome image such that it can be
used as a cursor%.

The documentation states that using load-file with a kind of 'bmp always
loads as colour, but it would be nice to have a new kind (perhaps
'monochrome-bmp) that loads monochrome images to monochrome bitmaps.

The documentation also states that a monochrome png will load as a
monochrome bitmap%, but it seems to always load as colour (changing the bit
depth from 1 to 32 during the load-file, regardless of the value specified
for kind). Perhaps there's something wrong with my image file (attached)
but gimp and Windows both show a 1-bit colour depth.

I have a work-around, in that converting the image to xbm seems to work.
But I'm still interested to know what I was doing wrong, anyone have any
ideas?

Cheers,

Kieron.

****

#lang racket

(require racket/gui)

(define bm (make-object bitmap% 16 16 #t #f))
(printf "  ~a ~a ~a ~a~n" (send bm get-width) (send bm get-height) (send bm
get-depth) (send bm is-color?))

(send bm load-file "test-icon.png" 'png #f #t)
;(send bm load-file "test-icon.xbm" 'xbm #f #t)
(printf "  ~a ~a ~a ~a~n" (send bm get-width) (send bm get-height) (send bm
get-depth) (send bm is-color?))

(define cursor (make-object cursor% bm bm 0 0))

<<attachment: test-icon.png>>

<<attachment: test-icon.xbm>>

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to