mysterious set the clipboardData

Sarah Reichelt sarah.reichelt at gmail.com
Fri Apr 20 17:44:21 EDT 2007


> thought, it would be very simple, now I get a mysterious result. I have an
> image with an assigned filename (png file).
>
> If I use: set the clipboardData["image"] to image "b1"
>
> and paste it into any graphic program, it gives me a totally black image of
> small size (128x32px) and not the copied image. At least there is any kind
> of "communication", because the pasted image has the same dpi, as the source
> image

There is some problem with copying an image if it is a referenced
image and/or it it is displayed at a different size to it's actual
pixels. Here is a routine I use, which requires a hidden image object
called "Clip"

            lock screen
            put the rect of img "MyImage" into tRect
            set the width of img "MyImage" to the formattedwidth of
img "MyImage"
            set the height of img "MyImage" to the formattedheight of
img "MyImage"
            set the width of img "Clip" to the width of img "MyImage"
            set the height of img "Clip" to the height of img "MyImage"
            set the imagedata of img "Clip" to the imagedata of img "MyImage"
            set the clipboardData["image"] to img "Clip"
            set the filename of img "Clip" to empty
            set the rect of img tImageName to tRect

"MyImage" is an image object showing a specific image file at a
reduced size, so I expand it to full size, copy the imageData to the
"Clip" object, then set the clipboardData before restoring the
original size of the "MyImage" object.

HTH,
Sarah



More information about the use-livecode mailing list