Add example to dictionary (was Re: Help on export snapshot)
ambassador at fourthworld.com
Fri Jun 12 10:52:36 CDT 2009
Mark Schonewille wrote:
> on mouseUp
> put "~/desktop/test.png" into myFile
> if there is a file myFile then delete file myFile
> set the filetype to "????PNGf"
> export snapshot from rect (the rect of this stack) to file myFile
> as PNG
> end mouseUp
The "from rect" option will grab a portion of the rendered image from
the display device buffer, which will include portions of any other
window which may overlap.
For a true WYSIWYG grab that may be exactly what's needed, but if you
want to grab only a specific window, or even an object within that
window, without anything else in the image, you can use the "export from
<object>" form introduced in v2.7.
Oddly enough, stacks cannot be used as the referenced object, so this
export snapshot from this stack to file myFile
But cards can, so this will work:
export snapshot from this cd of this stack to file myFile
With v2.7 Mark Waddingham did a massive overhaul to the way objects are
rendered in order to better accommodate modern OS buffering schemes
along with antialiasing and more, and thankfully implemented it in a way
that exposes those buffers to us with this new option for "export snapshot".
The engine still supports the grab from the general display buffer by
specifying a rect, which will then grab it from the OSes master display
which includes all windows.
But if you need to render just a specific object, you can trigger Rev's
internal buffering routines to create a buffer into which it will render
that for you and hand you the resulting image data, using the "...from
Which is better will of course depend on what you want to do. But it
can be handy for Paul to know both forms to pick the one that works best
for what's needed. His original attempt at using "this window" was very
close; just changing that to "this cd of this stack" should do what he
was looking for.
Revolution training and consulting: http://www.fourthworld.com
Webzine for Rev developers: http://www.revjournal.com
More information about the use-livecode