[REBOL] Re: Zoom and Pan
From: brett:codeconscious at: 21-Mar-2002 20:26
Hi Ashley,
> How can the zoom style call to "refresh-zoom-window" be localised to
> something like obj/refresh-zoom-window (ie. how can we tell a style to
> use a function in the parent's scope).
The word WITH in stylize/layout works like MAKE object!. It allows you
to add extra fields to your face objects. So in your WITH block for your
style you could put a line like:
zoom-img: none
This will create a new field in your ZOOM style with that name, which will
enable you to have nice reference to the dependent magnified face. Or
perhaps to the window - the principle is the same.
In the same way you could add your refresh-zoom-window function (after
modification for references) to the style itself. Also, instead of passing
offset
and size, pass a reference to the main (image) face.
This sort of thing should enable refresh-zoom-window to be localised as
you wanted.
Now how you set up the link... Various means I guess.
You could pass it as a specific keyword that your style defines.
For an example have a look at "Custom Style Example" in
http://www.codeconscious.com/rebsite/vid-notes.r In this
example I've defined a word "bars" specific to that style.
Another way (and this is speculation because I
have not tried it) could be that your style automatically
creates and destroys the magnification window.
Perhaps you could do this in the redraw function
of the feel. Make a redraw function
that creates the window if it is not already created on an
action of 'show and destroys the window on an action
of 'hide. Then your link is automatic :^).
> Given that the style can have a crop effect (see commented line below)
> that produces the desired effect, how can we pass the rendered image
> that results from this effect to another face (ie. can we replace the
> call to "refresh-zoom-window" with "zoom-img: face/image" . . . where
> does the face hold its image).
Perhaps TO-IMAGE face will do the trick.
> The question that arises from 1 & 2 above is how can we direct the
style
> to effect a dynamically determined face other than its own or its
parent
> (eg. instead of "face/parent-face/size: 0x0" we may want
> "obj/zoom-box/size: 0x0").
>
> I suppose what I am after is the ability to do:
>
> stylize/master [
> zoom: func[obj other-face] box with [ . . .
> ]
I'm not entirely sure want you after here.
Regards,
Brett.