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

Painting regions then saving them

In part of the application I am working on, I need to allow the user to
paint arbitrary regions on the screen with a choice of 2 patterns (i.e.
similar to MacPaint-style operations).  I've got a rudimentary version of
this working (code is at end of message).

The part that I can't figure out is how to store what the user has drawn so
that (a) I can save it between sessions, and (b) I can figure out what
parts of the screen are painted with which pattern.

I've tried using _OpenPicture, _OpenRgn & friends and have been able to get
pict-handles and regions that capture what the user has drawn - but when I
do that, the drawing doesn't appear on the screen. 

Thus, a better description of my problem is how does one display quickdraw
commands *simultaneously* to both the screen and to a picture? 

Or is there a better way to do this than with _OpenPicture?  Are regions
the answer?

Thanks for any pointers,


(defmethod view-click-event-handler ((win paint-window) where)
  (if (eq (find-view-containing-point win where) win)
  (with-focused-view win
    (let ((penloc where)
          (oldpenloc 0)) 
           (unless (mouse-down-p) (return))
           (unless (= penloc oldpenloc)
             (with-pen-state (:pnpixpat *current-pattern*
                                        :pnsize #@(15 15)
                                        :pnloc penloc)
               (#_Lineto (point-h penloc) (point-v penloc))))
           (setq oldpenloc penloc)
           (setq penloc (view-mouse-position win))))))