How can I turn a pict into a byte string of the pixels in it?
(I mean, a byte string of the pixels that would be in the bitmap you'd get from rendering the pict)
This function works:
#lang racket/base
(require pict racket/class)
(define (pict->pixels p)
(define b (pict->bitmap p))
(define w (send b get-width))
(define h (send b get-height))
(define pixbuf (make-bytes (* 4 (inexact->exact (ceiling (* w h))))))
(send b get-argb-pixels 0 0 w h pixbuf)
pixbuf)
But is there a simpler way?