Michael von Aichberger <[EMAIL PROTECTED]> wrote:
> Hello list!
>
> I am trying to copy a quadrangular but NOT rectangular area of one image to
> THE SAME quadrangular area of another image of the same size.
...
> pointsL = [point(453,161), point(476,165), point(469,204),point(446,200)]
...
> Now it seems to me that Director doesn't accept quads in the source image.
>
> Can you confirm that and if so is there a workaround as fast as
> "copypixels"?
Hi Michael,
Try this:
on copyQuad(aPasteImage, aCopyImage, aQuad) --------------------------
-- INPUT: <aPasteImage> and <aCopyImage> are image objects which
-- are assumed to be the same size
-- <aQuad> is a list of four points
-- ACTION: copies the area defined by <aQuad> from <aCopyImage> to
-- <aPasteImage>
-- EXAMPLE:
-- tQuad = [point(3, 3), point(27, 1), point(24, 17), point(1,19)]
-- copyQuad(member("Target").image, member("Source).image, tQuad)
--------------------------------------------------------------------
-- Create a quad mask
tRect = aPasteImage.rect
tMask = image(tRect.width, tRect.height, 1)
tBlack = image(1, 1, 1)
tBlack.setPixel(0, 0, rgb(0, 0, 0))
tMask.copyPixels(tBlack, aQuad, rect(0, 0, 1, 1))
-- Use the mask to copy only the relevant pixels
tOptions = [#maskImage: tMask]
return aPasteImage.copyPixels(aCopyImage, tRect, tRect, tOptions)
end copyQuad
Cheers,
James
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]