Snapshot stack (was: Import from rect)

Wilhelm Sanke, FB01 sanke at hrz.uni-kassel.de
Sat Jan 24 18:16:56 EST 2009


For the few who might be interested in such things I have put together a stack
demonstrating various ways of producing and using snapshots, thereby following
the questions and findings in the recent thread "Import from rect" (especially
of Thomas McGrath, Ken Ray, and Scott Rossi):

<http://www.sanke.org/Software/SnapshotTestStack.zip>

The Rev docs about "snapshots" have become increasingly detailed over time, but
they do not - understandably - cover every aspect, and - they still contain an
old error, namely concerning the paintcompression format of imported snapshots.

The teststack allows to set the properties of the selection graphic - with the
help of which snapshots are taken from an underlying image - in "real time",
i.e. you can set blendlevel, fillcolor, and the ink directly and watch the
changes in the appearance of the area of the graphic and the image beneath it.

20 different ways related to snapshot taking are demonstrated (with almost no
commentaries), concerning "simple" snapshots, alphadata, maskdata, and
extracting blendlevel and inks.

Additional remarks to some of the aspects:

- I found it confusing at first when I encountered a syntax like "import/export
snapshot of rect(the rect of grc 1) of grc 1". Experimenting with this I
understood that this twofold reference is not just tautological, but determines
different components of the snapshot. The first term - in the brackets -
determines the *dimensions* of the rect, the second states - as it were - the
location of the snapshot.

- In all cases but one - what you see in the test stack is not  the "snapshot
taken", but the result of using the snapshot for masking the image underlying
the selection graphic.

- The exception to this is the "Darkshot" - listed by Ken Ray in his systematic
overview - where I additionally display the actual snapshot (in a diminished
size) to show that the color of the represented transparent areas is dependant
(but not identical with) on the ink and fillcolor of the selection graphic.

- Using *globalloc* to determine the rect and loc of the snapshot is about 5
times faster than using card, window, image etc. as the reference to the
location, as in "import snapshot from the rect(<any rect>) of this card"

- The syntax "import/export snapshot from rect(<any rect> of this stack" or "of
stack <stackname>" is not possible. You have to get the windowID of the stack
first and then write "snapshot from rect(trect) of window twindowID".
But it is possible to use "card x of stack <stackname>" and even - see the docs
- access hidden or closed stacks this way.

- Snapshots taken from the selection graphic contain both alphadata and
maskdata, that can be used to mask the underlying image.
Compared to alphadata using maskdata produces somewhat rough edges.

- Other than when applying alphadata to the image "to-be-masked", with maskdata
you need to crop the image "to-be-masked" to the rect of the *group* that
contains the selection graphic. The graphic and the group containing the graphic
have different dimensions. When you group a graphic, width and height of the
group are greater than those of the graphic.
"export snapshot from rect(the rect of grc 1) of group 1" combined with cropping
the "image-to be-masked" to the rect of the graphic results in a distorted
rectangle - instead of an oval. Cropping the "image-to be-masked" to the group
produces the correct result.

Regards,

-- 
Wilhelm Sanke
<www.sanke.org/MetaMedia>

--------------------------------------------------------
This mail sent through http://www.uni-kassel.de/www-mail




More information about the use-livecode mailing list