Offscreen Screencapture? <-- issues that affect image rendering
Richard Gaskin
ambassador at fourthworld.com
Fri Feb 3 18:07:35 EST 2006
Scott Rossi wrote:
>>>> Not only does it work on XP but on OSX 3.9 as well (tested on 2 machines).
>>>> I know earlier versions of OSX/Rev were said to cause problems, but it seems
>>>> to work as expected here on both platforms, thus this tip really *is*
>>>> godlike.
>>> Crashes here with a kernel protection fault:
>>>
>>> OS X 10.4.4
>>> PowerBook G4 1Ghz
>> Bummer. Works here, in Rev and MC, OX 10.3.9, Rev 2.6.6, buildNumber 152 (not
>> sure what the latest version is).
>
> I just tested here with OSX 10.4.4 under MC and the export worked fine. How
> about I send you my test stack and see if you get a different result.
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
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list