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

Custom patterns

I am a new user of MCL, and I'm converting graphics software that was
originally written for X windows (using the CLX lisp functions) to run
on the Mac.

I have just figured out a way to implement cusomized patterns in MCL, but
I am not confident that I am doing things the "right" way.  The example below
shows how I was able to draw a circle with the striped pattern given
in the QuickDraw appendix of the MCL 2.0 manual.

(defun mac-draw-arc (&rest args)

  (setf *my-pattern* (ccl:make-record (:pattern :storage :pointer)))

  (ccl:%put-byte *my-pattern* 238 0)
  (ccl:%put-byte *my-pattern* 221 1)
  (ccl:%put-byte *my-pattern* 187 2)
  (ccl:%put-byte *my-pattern* 119 3)
  (ccl:%put-byte *my-pattern* 238 4)
  (ccl:%put-byte *my-pattern* 221 5)
  (ccl:%put-byte *my-pattern* 187 6)
  (ccl:%put-byte *my-pattern* 119 7)

  (ccl:fill-arc *my-window* *my-pattern* 0 PI 10 10 80 80)

I am surprised that I am required to explicitly modify memory addresses just
to make my own pattern.  I would expect to do something at a higher level,
like create an array and supply that as an argument in my ccl:make-record
call.  What would this implementation look like, if possible?

Thanks for any advice (generic new-user advice appreciated, also),

--Andrew Mickish