[racket] racket/gui: Problem displaying bitmap data
Dear list,
I am trying to display bitmap data that I have written into a SRFI-4 u8vector (that I believe maps to a Racket
bytevector). The bitmap data is in RGBA format. Now I am trying to display the bitmap data in a window.
Please see the relevant part of my program below:
(define (main)
(let* ((the-toplevel-frame (new frame% (label "Raycaster 3D!")))
(the-canvas (new canvas% (parent the-toplevel-frame)))
(the-canvas-bitmap (send the-canvas make-bitmap
(game-screen-width *the-screen*)
(game-screen-height *the-screen*)))
(the-canvas-bitmap-dc (new bitmap-dc% (bitmap the-canvas-bitmap))))
(for-each (lambda (e) (apply vline e)) (raycast-all *game-map*)) ;; Application logic :)
(send the-canvas-bitmap-dc set-argb-pixels 0 0
(game-screen-width *the-screen*)
(game-screen-height *the-screen*)
(game-screen-data *the-screen*)
#f #f)
(send the-toplevel-frame show #t)))
However this results in the error message:
$ racket -t game6.rkt
[Debug output of program snipped] ...
set-argb-pixels in bitmap%: not available in a canvas-compatible bitmap: (object:x11-bitmap% ...)
context...:
/usr/local/share/racket/pkgs/draw-lib/racket/draw/private/bitmap.rkt:776:4: core404
/home/alexshendi/sources/racket/game/game6.rkt:366:2: main
/home/alexshendi/sources/racket/game/game6.rkt: [running body]
Operating System: Linux x86_64 (Ubuntu 14.04)
Racket Version: 6.0.1 (Release)
Can anyone help me do it the correct way? Many thanks in advance.
Best Regards,
Alexander
~
~
~
~
~
~
~
~
~
~
~
~