[plt-scheme] drawing in MrEd's pasteboards

From: nik gaffney (nik at fo.am)
Date: Fri Sep 8 11:20:24 EDT 2006

>> from the description of a pasteboard% it looks like it should be possible
>> to do similar path based drawing in a within an editor-canvas% as in a 
>> canvas% draw context. however, i cant seem to find an obvious way to get
>> this working with out resorting to creating bitmaps, then using
>> image-clip%, is there a more straightforward method of drawing into a
>> pasteboard ?+
>
> You should be able to do the same things in a canvas% and in an
> editor-canvas% (the second has more going on, so you may need to be a
> little more careful about ordering of drawing, tho). In particular, they
> both draw into a canvas-dc, so you should be able to use all the same
> path stuff in both places.
> 
> What's going wrong?

to perhaps clarify, i would like to be able to draw a path based object into an
editor-canvas, and be able to move or resize it.

so, from what i understand of how the editor canvas works, id like to know an
idiomatic way to get a function such as the following to draw into an
image-snip%  ->

(a-drawing-function (send an-editor-canvas get-dc))

what im currently doing is something like ->

(define offscreen (make-object bitmap% 16 100 100))
(define bdc (make-object bitmap-dc% offscreen))

(a-drawing-function bdc)
(send bdc set-bitmap #f)

(define img (make-object image-snip% offscreen #f))
(send p insert img)

which looks rather awkward, especially for redrawing and scaling. so im just
wondering if im going about this in the wrong way?

thanks,
nik












Posted on the users mailing list.