[mcclim-devel] drawing a transformed-design using draw-rectangle* says not yet implemented

Jeremy Rayman jeremy.rayman at gmail.com
Tue Jul 26 05:31:41 UTC 2005


Hi there.

I'm trying to resize an image and show it to the screen. The image
loads OK, and before the image is transformed I can use
(draw-rectangle* pane 0 0 50 50 :ink image) to show it fine (just
clips off the rest). After scaling it, when I try to change the :ink
to the new transformed-design, it gives an error "Sorry, not yet
implemented".

Here's what I'm doing: 

;; xpm.lisp is loaded by clim-listener.asd
(let* ((image (clim-internals::xpm-parse-file #p"image.xpm"))  
      (transformed-bg (transform-region (make-scaling-transformation 5
5) image)))
  (draw-rectangle* pane 0 0 50 50 :ink transformed-bg)) 
;; if it's :ink image, it shows, just not scaled
 
Sorry, not yet implemented.
   [Condition of type SIMPLE-ERROR]


That error is coming from clim-clx::medium-gcontext (backtrace below). 

>From mcclim/Backends/CLX/medium.lisp, that func is set up for
translation-transformations, but not scaling-transformations. If it's
anything but a translation-transformation, it gives an error saying
not yet implemented.


Here's that function, only the first 5 lines matter:
 
(defmethod medium-gcontext ((medium clx-medium) (ink climi::transformed-design))
  (let ((transformation (climi::transformed-design-transformation ink))
        (design (climi::transformed-design-design ink)))
    (unless (translation-transformation-p transformation)
      (error "Sorry, not yet implemented."))
    ;; Bah!
    (typecase design
      ((or climi::indexed-pattern climi::rectangular-tile)
       (multiple-value-bind (tx ty)
	   (transform-position transformation 0 0)
	 (let ((gc-x (round-coordinate tx))
	       (gc-y (round-coordinate ty))
	       (gc (design-gcontext medium design)))
	   (setf (xlib:gcontext-ts-x gc) gc-x
               (xlib:gcontext-ts-y gc) gc-y
               (xlib:gcontext-clip-x gc) gc-x
               (xlib:gcontext-clip-y gc) gc-y)
	   gc)))
      (t
       (error "You lost, we not yet implemented transforming an ~S."
              (type-of ink))))))


Since I don't know how to make it handle scaling-transformations, I
guess this ends up being a feature request. I asked on irc about it
and was told to mail here. If there's a better way to draw my scaled
image, I'd love to know.

Thanks guys!

- Jeremy Rayman
jeremy.rayman at gmail.com 


-----------
if anyone needs it:
Backtrace:
  0: ((SB-PCL::FAST-METHOD CLIM-CLX::MEDIUM-GCONTEXT
(CLIM-CLX::CLX-MEDIUM CLIM-INTERNALS::TRANSFORMED-DESIGN))
#<unavailable argument> #<unavailable argument> #<CLIM-CLX::CLX-MEDIUM
{4AB116E9}> #<CLIM-INTERNALS::TRANSFORMED-DESIGN {485EC701}>)
  1: ((LAMBDA (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL.
SB-PCL::.ARG0. SB-PCL::.ARG1.)) #<unavailable argument> #<unavailable
argument> #<CLIM-CLX::CLX-MEDIUM {4AB116E9}>
#<CLIM-INTERNALS::TRANSFORMED-DESIGN {485EC701}>)
  2: ((SB-PCL::FAST-METHOD CLIM-CLX::MEDIUM-DRAW-RECTANGLE-USING-INK*
(CLIM-CLX::CLX-MEDIUM T T T T T T)) #<unavailable argument>
#<unavailable argument> #<CLIM-CLX::CLX-MEDIUM {4AB116E9}>
#<unavailable argument> 0 0 40 40 T)
  3: ((SB-PCL::FAST-METHOD
CLIM-INTERNALS::DO-GRAPHICS-WITH-OPTIONS-INTERNAL (MEDIUM T T))
#<unavailable argument> #<unavailable argument> #<CLIM-CLX::CLX-MEDIUM
{4AB116E9}> #<CLIM-INTERNALS::SPRITE-PUSH-BUTTON-PANE CLIM-DEMO::CE
{4AB008A1}> #<CLOSURE (FLET CLIM-INTERNALS::GRAPHICS-OP) {485EC785}>
(:INK #<CLIM-INTERNALS::TRANSFORMED-DESIGN {485EC701}>))
  4: ((FLET #:FN21) #<CLIM-INTERNALS::SPRITE-PUSH-BUTTON-PANE
CLIM-DEMO::CE {4AB008A1}>)
  5: ((LAMBDA (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL.
SB-PCL::.ARG0. SB-PCL::.ARG1. SB-PCL::.ARG2.)) #<unavailable argument>
#<unavailable argument> #<CLIM-INTERNALS::SPRITE-PUSH-BUTTON-PANE
CLIM-DEMO::CE {4AB008A1}> #<CLIM-DEMO::CALCULATOR {4AA7CD19}>
#:GADGET10920)
  6: ((LAMBDA (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL.
SB-PCL::.ARG0. SB-PCL::.ARG1.)) #<unavailable argument> #<unavailable
argument> #<CLIM-INTERNALS::SPRITE-PUSH-BUTTON-PANE CLIM-DEMO::CE
{4AB008A1}> #<POINTER-ENTER-EVENT {485EC211}>)
  ...



More information about the mcclim-devel mailing list