Import from rect

Wilhelm Sanke, FB01 sanke at
Sun Jan 18 14:50:31 EST 2009

On Fri, 16 Jan 2009, Scott Rossi <scott at> wrote:

> Recently, Thomas McGrath III wrote:
> >> Actually a snapshot of an object does not take an exact snapshot
> >> following the attributes of the object (transparency, etc.) but a
> >> snapshot of the rect of the object will follow the attributes
> >> (transparency, etc.)
> This is an excellent and useful observation -- I always thought that one had
> to group objects to get their alpha included in a screenshot, but using the
> object's rect as you say produces the same result.  Nice find.
> Regards,
> Scott Rossi

One of the steps of development in science as in programming is that we start on
a preliminary level with assumptions or hypotheses which may be then falsified -
or sometimes verified - when we reach the next intermediate level of our theory.
The principle of "falsification" is the core element of Sir Karl Popper's theory
of science.
This usually happens to all of us from time to time, although the programming
language we use is called "Revolution".

In my long post of Nov 29, 2008 ("More about Masks (+ sample stack)")
introducing stack "More about Masks" one paragraph reads:

"Scott's assumptions - expressed in the comments of his script - that the image
"to-be-masked" must be in PNG-format and the selection graphic (from which the
snapshot for the mask is being taken) must be grouped, could not be verified

The stack compares and discusses in detail the attempts of Jim Hurley, Bernd
Niggemann, and of myself to create masked images mainly with the use of
snapshots - and included one script originally written by Scott to which the
paragraph refers. -

and  Thomas McGrath III <mcgrath3 at> wrote on Sat, 17 Jan 2009:

> Scott,
> Actually at first I thought this was a bug, but it makes a bit of  
> sense. The rect and I guess grouping the objects will force a visible  
> or visual snapshot of where the object physically resides including  
> objects beneath that show through the alpha mask but using the actual  
> object must allow the engine to reference the object itself  
> programatically so it is not 'seeing' the alpha or better yet it is  
> not seeing through the alpha to the objects underneath.
> As Richard said " "export snapshot" which allows you to specify the  
> object rather than merely its rect:" "This will cause the object  
> specified to be rendered into an offscreen buffer directly, then that  
> buffer is compressed into the specified format for writing to disk."
> It must be the ability to render offscreen in the buffer that is the  
> difference here. This must be the case with the import snapshot as well.
> Tom

I think Tom's interpretation of what is going on is an excellent analysis.
Getting the alphadata is indeed possible both with "import" and "export
snapshot" and besides the alphadata you also retrieve the maskdata as we have
discussed and shown in detail in our above-mentioned stack of Nov 2008


along with the possible dependency on the paintcompression format, which however
effects only maskdata.

A new version of the stack - released a few days ago on Jan 7 -


additionally demonstrates two attempts to integrate the new "gradient tools" of
Rev (therefore this stack needs at least engine version 3) as a component for
creating masked images - based on a proposal from Bernd Niggemann..
I mention this stack here, too, because I see from the text of Tom's posts in
this thread that he is apparently experimenting with using snapshots together
with gradient tools. It could be interesting to have a look at these approaches,
although they may be of a somewhat "ideosyncratic" nature.


Wilhelm Sanke

This mail sent through

More information about the Use-livecode mailing list