How to Export a Card Image (Not a Screenshot!) |
|
Update 2/3/06 This Tip may crash on earlier versions of the MC engine and has not been comprehensively tested on all platforms under all versions of MC/Rev, so please test before using!
Additionally, stacks whose |
export snapshot
command takes a literal
screenshot, so things like palettes and toolbars can get in the way of getting a clean image
of the card. Additionally, you might have a stack window which is larger than the current monitor,
and need to export the card image; export snapshot
just won’t cut it in these
cases.
The following script allows you to export a card image to disk:
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 do "export" && pImageType && "to file pExportPath" delete last image set the alwaysBuffer of stack pStackPath to tOldBuffer choose browse tool end ExportCard
Note that this will only export what is visible in the stack window; that is, if you have
a scrolling group on the card, you won't get everything inside the group - you would need to
resize the stack to accomodate everything before you did an ExportCard
.
Posted 3/31/03 by Ken Ray, based on original code by Brian Yennie (thanks, Brian!)