[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Image of a bitmap

I am trying to set individual bits to a bitmap using the way of 
%put-long as follows: 

(require :quickdraw)

(setq s-rect (make-record :rect :topleft #@(0 0) :bottomright #@(16
(setq d-rect (make-record :rect :topleft #@(10 10) :bottomright #@(26

(setq s-map (make-bitmap 0 0 16 4))
(setq my-addr (rref s-map :bitmap.baseaddr))
(%put-long my-addr #b11111111111111111111111111111111 0)
(%put-long my-addr #b11111111111111111111111111111111 4)

(defclass my-window (window)())

(defmethod view-draw-contents ((self my-window))
(with-macptrs ((view-bm (rref (wptr foo) :grafport.portbits)))
(copy-bits s-map view-bm s-rect d-rect)))

(setq foo (make-instance 'my-window))

After running the code several times, the images in the window foo seems 
to me there is something wrong.  Sometimes, there is some images, and
sometimes, these is nothing.  I changed the value of the %put-long, but
the images did not change.  I do not know if my code is wrong or other
reasons.   Can anyone point out my problems?  Thanks.

In addition, it would be a better way for an image to come from an icon
or cursor rather than from brute force.  Does MCL provide any way to set
individual bits in an icon and convert the icon to a bitmap?  Will the
icons.lisp in the MCL library be useful to the images of icons?  Thanks.