How to Export a Card Image (Not a Screenshot!) |
|
Update 12/24/03 This Tip crashes on MC 2.5.1 under OS 10.2.8 and 10.3. This has not been comprehensively tested on all platforms under all versions of MC/Rev, so please test before using! |
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 set the alwaysBuffer of stack pStackPath to tOldBuffer do "export" && pImageType && "to file pExportPath" delete last image 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!)
Close this window | Print this window |