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

[no subject]

hi, i'm interested in drawing a bitmap that uses a mask which is created
from a bitmap of part of the image.  i've successfully used regions (using
circles, rectangles or lines) and the copybits function to mask images.
what i can't figure out is how to put a bitmap into a region (then use the
copybits function) or use the copymask function which seems to be the way
to go.

below is some code that doesn't work.  any pointers would be great!!!

;;; i have the image handles of both the source image and the mask image
;;;    created from reading a pict resource.  i create a pixmap of them and
then use
;;;    that in the copymask function.

(defmethod draw-masked-image ((layout-image layout-image))
  (with-slots (image-pixmap mask-pixmap mask-handle image-handle) layout-image
    (let ((wptr (slot-value layout-image 'wptr)))
      (validate-view layout-image)
      (setf image-pixmap (ccl::pixmap-from-pict image-handle 24))
      (setf mask-pixmap  (ccl::pixmap-from-pict mask-handle  24))
      (with-port wptr
        (ccl::with-pointers ((src image-pixmap)
                             (dst (rref wptr windowrecord.portbits)))
          (let ((src-rect (rref src pixmap.bounds :storage :pointer)))
            (rlet ((dst-rect :rect :topleft 0 :bottomright (view-size
              (#_copymask src mask-pixmap dst src-rect src-rect dst-rect))))))))