Lisp HUG Maillist Archive

extending pinboard-object and redraw problems

Hello,

I am looking for Information regarding the creation of new
pinboard-objects.  Specifically, I am trying to implement a tiled
image object (one that draws only parts of the image). However,
after creating a new class with pinboard-object as superclass and
overriding the draw-pinboard-object method, I have noticed
some things are missing.  For example when repositioning an object
of the buildin image-pinboard-object class it'll clear the old
region and redraw itself at the new position. While my derived
class is visible on both positions, until the whole pinboard gets
redrawn (e.g. by moving the native window around). The same goes for
object deletions.

I am now thinking of overriding the (setf pinboard-pane-position)
function, but am wondering if thats the best way to go.

Here is the relevant code:

(defclass piece2D (pinboard-object)
   ((image
     :accessor piece2D-image
     :initarg :image)))

(defun draw-tiled-image (port image x y &key (tile-x 1) (tile-y 1) (draw 0))
   (gp:draw-image port image x y
		 :from-x (*  (/ (image-width image) tile-x)
			    (mod draw tile-x))
		 :from-y (*  (/ (image-height image) tile-y)
			     (floor (/ draw tile-x)))
		 :from-width  (/ (image-width image) tile-x)
		 :from-height (/ (image-height image) tile-y)))

(defmethod draw-pinboard-object ((pin pinboard-layout) (self piece2D)
				 &key x y width height &allow-other-keys)
    (with-slots (image) self
       (when (stringp image)
	(setf image (load-image (pinboard-object-pinboard self) image)))
       (draw-tiled-image pin image x y :tile-x 4 :draw 0)))


-ap


Re: extending pinboard-object and redraw problems

On Sunday 30 November 2008 12:56:45 pm Andreas Politz wrote:

Maybe you are confusing CAPI's hint tables?  

Mitch Berkson sent me a useful example that had to do with rotating (and 
transforming) pinboard objects and keeping the hint table synchronized.  I 
will dig it up and forward a copy to you.

pt


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