Offscreen Screencapture? <-- issues that affect image rendering

Wouter wouter.abraham at scarlet.be
Fri Feb 3 19:42:02 EST 2006


This will still crash in certain cases.
Because  a stack with its cantmodify set to true and which buffered  
state is not true, cannot be forced to update its screenbuffer.
The effectiveness of a screen buffer update can be seen in the  
difference between the pixmapID of a stack  and the windowID of a  
stack. If those numbers are the same the stack is NOT buffered and  
the handler will crash gloriously.

Greetings,
Wouter


On 04 Feb 2006, at 00:07, Richard Gaskin wrote:

>
> Works great in your version.
>
> I double-checked the differences between your code and the code on  
> Ken's site, and I found that if I just move the line that restores  
> the alwaysBuffer of the stack to after the export, it works:
>
>
> on mouseUp
>   put "/Applications/MetaCard/_testers/export wd buffer.rev" into  
> tStack
>   put "/Users/richardgaskin/Desktop/stackimage.png" into tPath
>   put "PNG" into tType
>   ExportCard tStack, tPath, tType
> end mouseUp
>
> on ExportCard pStackPath,pExportPath,pImageType
>   -- pStackPath is the path to the stack whose card you want to export
>   -- pExportPath is where you want the image to go
>   -- pImageType is one of the three formats supported by the export
>   --   command: paint, png or jpeg
>   put the alwaysBuffer of stack pStackPath into tOldBuffer
>   -- The next two lines force the current card image
>   -- into the offscreen buffer
>   set the alwaysBuffer of stack pStackPath to false
>   set the alwaysBuffer of stack pStackPath to true
>   create invisible image
>   -- Here's the 'meat' of the handler:
>   set the imagePixMapID of last image to \
>      (the pixMapID of stack pStackPath)
>   select last image
>   --!NOT HERE  set the alwaysBuffer of stack pStackPath to tOldBuffer
>
>   do "export" && pImageType && "to file pExportPath"
>   delete last image
>
>   -- HERE INSTEAD:
>   set the alwaysBuffer of stack pStackPath to tOldBuffer
>
>   choose browse tool
> end ExportCard
>
>
>
> -- 
>  Richard Gaskin
>  Fourth World Media Corporation




More information about the use-livecode mailing list