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

Re: using MCL to modify a PICT

us278832@mmm.mmm.com (Martin A. Kenner) writes:
   I have a PICT which I want to modify by adding a text string.
He then adds that in C he uses gworlds to create the picture using
the tool box calls DrawPicture, TextBox and ClosePicture.

You can use the same approach in MCL2.0, with the help of the
gworld utilities in oodles-of-utils in GWorld-u.lisp.

Alternatively, you can create a new-picture by using a variant of
the following  MCL2.0f3 code which draws a frame around a picture,
with the frame specified by the topLeft and bottomRight corners


(defun frame-picture (picture &key topLeft bottomRight)
  (ccl::with-rectangle-arg (new-frame topLeft bottomRight)
      (old-frame (rref picture :picture.picframe.topLeft)
                 (rref picture :picture.picframe.bottomRight))
      (let ((new-picture (#_openPicture :ptr new-frame)))
              (#_drawPicture :ptr picture :ptr old-frame)
              (#_frameRect :ptr new-frame))

(let (old-pict new-pict win)
  (setq win (make-instance 'window :view-size #@(200 200)))
  (set-view-size win #@(200 200))
  (start-picture win #@(0 0) #@(101 101))
  (frame-rect win 0 0 100 100)
  (setq old-pict (get-picture win))
  (setq new-pict (frame-picture old-pict :topLeft #@(0 0)
                                :bottomRight #@(120 120)))
  (draw-picture win new-pict)
  (print 'old-picture)
  (print-record old-pict :picture)
  (print 'new-picture)
  (print-record new-pict :picture)
  (sleep 1)
  (window-close win)
  (kill-picture new-pict)
  (kill-picture old-pict))

  :PICFRAME #<Record :RECT :TOP 0 :LEFT 0 :BOTTOM 101 :RIGHT 101>>

  :PICFRAME #<Record :RECT :TOP 0 :LEFT 0 :BOTTOM 120 :RIGHT 120>>