[Prev][Next][Index][Thread]
Problem with draw-image and HD 1.2
-
To: info-dylan@ai.mit.edu
-
Subject: Problem with draw-image and HD 1.2
-
From: Chris Double <chris@double.co.nz>
-
Date: Fri, 14 Jan 2000 08:00:01 -0500 (EST)
-
Organization: None.
-
Sender: Chris.Double@DOUBLEC
-
User-Agent: Gnus/5.070097 (Pterodactyl Gnus v0.97) Emacs/20.4
-
Xref: traf.lcs.mit.edu comp.lang.dylan:11460
I created a subclass of <image> (called <windows-bitmap>) and added
methods to image-width, image-height, etc for the image protocols so
it would work with the various DUIM routines. When it came to doing
draw-image I tried specialising the first parameter on <medium>:
define method draw-image( m :: <medium>,
image :: <windows-bitmap>, x, y) => (record) /* etc */ end;
This compiled, but when run I got an error saying that the above
method "cannot be added to the generic function draw-image because it
is blocked by the sealed domain over <win32-medium>, <image>,
<object>, <object> in <library>. Oops!"
In the end I had to make it specialised over <drawing-pane> to work:
define method draw-image( pane :: <drawing-pane>,
image :: <windows-bitmap>, x, y) => (record) /* etc */ end;
And make sure I called draw-image with a <drawing-pane> instead of a
<medium>. Is there another workaround for this? What sealing
declaration is likely to be causing the problem? I don't know much
about the intricacies of sealing unfortunately. I have no sealing
declarations in my own code apart from what occurs by default (not
declaring classes open, etc).
The working version of the project (bitmap-example) is available at
http://www.double.co.nz/dylan, where is it specialised over
<drawing-pane>. Changing this to <medium> will demonstrate the
problem.
As an aside, the project mentioned above shows loading bitmaps from
files using the Windows API and displaying it in a drawing-pane. I
tried using <win32-bitmap> instead of creating my own <windows-bitmap>
class but <win32-bitmap>'s sometimes did not display correctly when
using draw-image in HD1.2.
Chris.
--
http://www.double.co.nz/dylan
Follow-Ups: