Pasting part of an image to a specific loc by scripting?
Wilhelm Sanke
sanke at hrz.uni-kassel.de
Fri Mar 24 11:54:33 EST 2006
Hi all,
Is it possible to paste a copied portion of an image to another place in
that same image by scripting, e.g. the topleft quarter to the topright
quarter?
The paste command always places the copied part of an image at the
center of the image as in the following script, so what kind of
parameters should be added?:
"on mouseUp
choose select tool
put the topleft of img 2 into tpos
put tpos into tpos2
add 200 to item 1 of tpos2
add 200 to item 2 of tpos2
drag from tpos to tpos2
copy
click at tpos # without this click a *black* rectangle is pasted
paste
choose browse tool
end mouseUp"
Another script just moves the selected part of the image to the right,
leaving the previous selected area as blank:
"on mouseUp
choose select tool
put the topleft of img 2 into tpos
put tpos into tpos2
add 200 to item 1 of tpos2
add 200 to item 2 of tpos2
drag from tpos to tpos2
subtract 200 from item 2 of tpos2
drag from tpos to tpos2
choose browse tool
end mouseUp"
As usual, the solution is probably quite simple, but I cannot find any
relevant information how to to this in the docs.
As a workaround, one could use a succession of snapshots and the
deleting of the interim images, but I think there must be an easier way
using paste, drag, move etc.
Any suggestions are welcome!
Regards,
Wilhelm Sanke
<http://www.sanke.org/MetaMedia>
More information about the use-livecode
mailing list