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

Re: Write PICT file



At  9:23 AM 11/17/93 -0500, JIQIAN PAN wrote:
>I want to write a picture from (get-picture)
>to a file which can be read by SuperPaint.
>Does anyone have such a function?  Thanks.

I don't know the creator for SuperPaint. If you don't specify the
creator to this function, it will create a file that SuperPaint can
read, but double clicking on the file will launch MacDraw Pro. Use
MAC-FILE-CREATOR to find the creator code for SuperPaint and pass
that as the creator code if you want the file to launch SuperPaint
when opened from the Finder.

(defun store-pict-to-file (pict pathname &key 
                                (if-exists :error)
                                (creator "dPro"))       ; MacDraw Pro
  (setq pict (require-type pict 'macptr))
  (create-file pathname
               :if-exists if-exists
               :mac-file-type "PICT"
               :mac-file-creator creator)
  (with-FSOpen-file (pb pathname t)
    (%stack-block ((header 512))
      (dotimes (i 512) (setf (%get-byte header i) 0))
      (FSWrite pb 512 header))
    (with-dereferenced-handles ((pict-pointer pict))
      (FSWrite pb (#_GetHandleSize pict) pict-pointer))))