I believe I have found a bug in the export snapshot command, and I need the requisite number of you to agree I should submit a bug report...
or one of you to show me my error.
I created a couple of images that demonstrate the issue, but I have not figured out how to imbed them in this post using html; so let me describe the issue.
Here is the handler in question:
Code: Select all
on createASnapshot theImageType -- 25 Sep 21:RCC
put the rectangle of image "New Image Frame" into snapshotRectangle
set the rectangle of templateImage to snapshotRectangle
set the showBorder of templateImage to false
set the threeD of templateImage to false
create image
put the id of image (the number of images) into imageIdNumber
switch theImageType
case "GIF"
export snapshot from rectangle snapshotRectangle of this card to image id imageIdNumber as GIF
break
case "PNG"
export snapshot from rectangle snapshotRectangle of this card to image id imageIdNumber as PNG
break
case "PMB"
export snapshot from rectangle snapshotRectangle of this card to image id imageIdNumber as paint
break
case "JPEG"
if maskImage then
answer warning "JPEG images do not support masking." with "Turn off masking" or "Cancel"
if it is "Cancel" then return it
put false into maskImage
end if
export snapshot from rectangle snapshotRectangle of this card to image id imageIdNumber as JPEG
break
end switch
return empty
end createASnapshot
Since the screen rectangle is the same for all four snapshots and the only essential difference in the command is "GIF", "PNG", "PMB", or "JPEG", I find it hard to imagine this is not a bug in the export snapshot command itself...
but i am ready to grovel in mortification if someone proves me wrong.
And, by the way, is there some intrinsic restriction in the compiler that makes it impossible to resolve the image type at runtime?
Code: Select all
put ["GIF"/"PNG"/"PMB"/"paint"] into imageType
export snapshot from rectangle snapshotRectangle of this card to image id imageIdNumber as imageType
Cheers!