Lisp HUG Maillist Archive

LWL image scaling

Under LWL, if I apply a non-unity scale transform to a capi:output-pane that 
contains an image (.bmp file), it appears that the display-callback is called 
continuously.

This appears not to happen under  LWW.

Am I doing something wrong?  The docs indicate that image scaling is system 
dependent.  I thought that this means that the image would not change in 
size, yet still survive the scaling operation (i.e. noop).

I've included a test program that appears to show this problem under LWL and 
not LWW (check the pathname for the .bmp file in the 
gp:register-image-translation).  

"(run)" should run the program and print two lines of output.  Under LWL, it 
prints output until you close the test pane.

[The output indicates that LWL is calling display-callback once with the full 
width and height of the pane, then continuously with the width and height of 
the image/icon].

Thanks.
Paul Tarvydas



(in-package "COMMON-LISP-USER")

(defvar *out*)

(gp:register-image-translation
 'img-code
 #.(gp:read-external-image (current-pathname 
"/usr/lib/LispWorks/lib/4-2-0-0/examples/capi/elements/images/toolbar-radio-images.bmp")
                           :transparent-color-index 7))

(capi:define-interface junk2 ()
  ()
  (:panes
   (output-pane-1
    capi:output-pane
    :accessor canvas
    :display-callback 'pane-display-callback))
  (:layouts
   (simple-layout-1
    capi:simple-layout
    '(output-pane-1)))
  (:default-initargs
   :best-height 300
   :best-width 308
   :layout 'simple-layout-1
   :title "Junk2"))

(defun pane-display-callback (pane x y w h)
  (let ((img (gp:load-image pane 'img-code)))
    (format *out* "~S ~S ~S ~S~%" x y w h)
    (gp:draw-image pane img x y)))

(defun run ()
  (let ((win (make-instance 'junk2))
        (tfm (gp:copy-transform gp::*unit-transform*)))
    (setf *out* *standard-output*)
    (capi:display win)
    (gp:apply-scale tfm 2 2)
    (gp:set-graphics-state (canvas win) :transform tfm)
    (gp:invalidate-rectangle (canvas win))))


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

Re: LWL image scaling

Unable to parse email body. Email id is 1223

Updated at: 2020-12-10 08:59 UTC