Manipulating and writing images
Hello Given the lack of responses to my original question I thought I'd make it easier to help :D Below is a quick demo that will demonstrate my problem. It displays a jpeg in an output-pane and then copies this image to another output-pane using make-image-from-pane and externalize-image. The image in the second output-pane displays exactly the same corruption i see when I write an image to disk. Just change *jpeg-image-path* to an appropriate jpeg and run. Note that the problem appears to occur in the externalize-image function. thanks to anyone who has a clue!! Andrew (defclass my-output-pane (capi:output-pane) ((the-image :accessor the-image :initform nil))) (defparameter *jpeg-image-path* #P"Escritorio/test.jpg") (capi:define-interface photo-test () () (:panes (tp-first capi:title-pane :text "First") (op-first my-output-pane :accessor op-first :display-callback #'on-draw) (tp-second capi:title-pane :text "Second") (op-second my-output-pane :accessor op-second :display-callback #'on-draw) (pb-copy capi:push-button :callback #'on-copy :text "Copy")) (:layouts (cl-main capi:column-layout '(gl-main pb-copy) :x-adjust :right) (gl-main capi:grid-layout '(tp-first op-first tp-second op-second) :columns 2)) (:default-initargs :layout 'cl-main :visible-min-width 400 :visible-min-height 400 :create-callback #'on-create)) ;(capi:display (make-instance 'photo-test)) (defun on-create (ifc) (let ((ext-image (gp:read-external-image *jpeg-image-path*))) (let ((image-1 (gp:convert-external-image (op-first ifc) ext-image))) (setf (the-image (op-first ifc)) image-1)))) (defun on-draw (op x y to-x to-y) (declare (ignore x y to-x to-y)) (when (the-image op) (gp:draw-image op (the-image op) 0 0))) (defun on-copy (data ifc) (declare (ignore data)) (setf (the-image (op-second ifc)) (gp:convert-external-image (op-second ifc) (gp:externalize-image (op-first ifc) (gp:make-image-from-port (op-first ifc))))) (gp:invalidate-rectangle (op-second ifc)))