[cl-pdf-devel] PNG images support code
Marc Battyani
marc.battyani at fractalconcept.com
Tue Dec 28 18:38:35 UTC 2004
"Dmitri Ivanov" <divanov at aha.ru> wrote:
> Hello Marc,
>
> The PNG support shoud be accompanied by changes like the following in
typeset:
>
> (defclass image-box (soft-box)
> ((file :accessor file :initform nil :initarg :file)
> (pdf-image :accessor pdf-image :initform nil :initarg :pdf-image)))
>
> (defmethod stroke ((box image-box) x y)
> (let ((pdf-image (or (pdf-image box)
> (setf (pdf-image box) (pdf:make-image (file
box))))))
> (pdf:add-images-to-page pdf-image)
> (pdf:draw-image pdf-image x (+ (- y (dy box))(offset box))
> (dx box)(dy box) 0 t)))
>
> (defun image (&rest args &key inline &allow-other-keys)
> (if inline
> (add-box (apply 'make-instance 'image-box
> :allow-other-keys t args))
> (let ((hbox (make-instance 'hbox
> :boxes (list (make-hfill-glue)
> (apply 'make-instance 'image-box
> :allow-other-keys t args)
> (make-hfill-glue))
> :adjustable-p t)))
> (compute-natural-box-size hbox)
> (add-box hbox))))
Hi Dmitri,
OK I will add this to cl-typesetting.
Cheers,
Marc
More information about the cl-pdf-devel
mailing list