Export Snapshot - documentation issues

David Bovill david at openpartnership.net
Fri Aug 31 17:21:37 EDT 2007


On 31/08/2007, Scott Rossi <scott at tactilemedia.com> wrote:

> If I understand what you're saying, one syntax form for an object is:
>
>   import snapshot from rect (rect of <obj>) of <obj>
>
> This imports a snapshot of the object to the card using the object as the
> source.  The reason for doing this is it grabs the alpha data of the object
> as well, keeping any transparency intact.

OK

>
> The export syntax is:
>
>   export snapshot from rect (rect of btn 1) of btn 1 to file fPath as PNG
>

I tried this and it does not work as expected - you need to use the
global coordinates not the local ones. Also testing this - it is
important that there is no window overlap with this syntax - while it
is not imortant with the "window windowID" syntax - so the latest
version of the handler is:

getprop object_SnapShot [imageType]
    put the long id of the target into targetObject
    put the stack_Object of targetObject into stackObject

    put the windowid of stackObject into wID
    put the rect of targetObject into localRect

    switch imageType
        case "Transparent"
            toplevel stackObject
            put the global_Rect of targetObject into globalRect
            export snapshot from rect globalRect of targetObject to
someImage as PNG
            break
        case "GIF"
            export snapshot from rect localRect of window wID to
someImage as GIF
            break
        case "JPG"
            export snapshot from rect localRect of window wID to
someImage as JPEG
            break
        case "JPEG"
            export snapshot from rect localRect of window wID to
someImage as JPEG
            break
        default
            export snapshot from rect localRect of window wID to
someImage as PNG
    end switch
    return someImage
end object_SnapShot



More information about the use-livecode mailing list