Many thanks for the insights on image opacity.  Here's another image
problem I've encountered.  Using MC 2.5 on Mac OSX 10.4.

I want to be able to copy part or all of an image to the clipboard.
An image is visible in stack "LBROW".  A handler catches mouse action
on that image, and if the user drags out a rectangle a translucent
graphic "pickRect" is created to designate that sub-area of the image.
The script below is supposed to (1) load the entire image to the
clipboard if the user has not created a "pickRect" graphic; and (2)
load that sub-area of the image if the user has created a "pickRect"
graphic.  Case (1) works as expected.  Case (2) does not; some blank
image seems to be loaded to the clipboard instead.

But why?  When debugging this script, it is evident that the import
snapshot statement is indeed creating a new image of the correct
subarea.  Why doesn't "set the clipboardData["image"] work on it?
Another puzzle:  when debugging, MC 2.5 gives me an "execution error"
when it gets to the end of the handler.

on copyImage
 if there is not a graphic "pickRect" of stack "LBROW" then
   set the clipboardData["image"] to image 1 of group "pdfGroup" of
stack "LBROW"
 else
   set the defaultStack to "LBROW"
   put shiftedRect(the rect of graphic "pickRect",the topLeft of
stack "LBROW") into r
   delete graphic "pickRect"
   import snapshot from rect r
   set the clipboardData["image"] to last image
   delete last image
 end if
 choose browse tool
end copyImage

function shiftedRect r,s
 -- used to convert to screen coordinates the coordinates of rect r
in a stack whose topLeft is at s
 -- eg for use in import snapshot

 repeat with i = 1 to 4
   add item (1 + (i+1) mod 2) of s to item i of r
 end repeat
 return r
end shiftedRect

Any insights about this would be greatly appreciated.

David Epstein
_______________________________________________
metacard mailing list
metacard@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/metacard

Reply via email to