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

Set bits in 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 16))
(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, the images in the window foo seems to me there
is something wrong.  Can anyone fix 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.