Hi guys,
I would like to 'clip' an image imported from the library.
So I'm playing with the alphaData and maskData instructions...
I have tried something simple by copying the alpha channel from an image to the binary data:
put the alphaData of image "mask" into myMask
set the alphaData of image "masked" to myMask
but nothing happen to the image.
Am I missing something?
Thanks.
Mask & Alpha
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Mask & Alpha
Hi Jean,
for something to happen the image has to have alpha information. Otherwise the alphadata is set to transparent. PNG images can have, but must not have alphadata.
Jpeg does not have alphadata.
Very important if you work in imagedata, alphadata or maskdata. Both images have to have the exact same width and height.
I append a stack with an image (an imported png with alphadata) and a image object that I just filled with the bucket tool red.
You can set the alphadata or the maskdata of the red image, you also can remove the alphaData or maskData from the red image via buttons.
Note that the maskdata makes the oval jagged, since the maskdata is only on or off. The alphadata makes a smooth oval, since alphadata is antialiased.
Kind regards
Bernd
for something to happen the image has to have alpha information. Otherwise the alphadata is set to transparent. PNG images can have, but must not have alphadata.
Jpeg does not have alphadata.
Very important if you work in imagedata, alphadata or maskdata. Both images have to have the exact same width and height.
I append a stack with an image (an imported png with alphadata) and a image object that I just filled with the bucket tool red.
You can set the alphadata or the maskdata of the red image, you also can remove the alphaData or maskData from the red image via buttons.
Note that the maskdata makes the oval jagged, since the maskdata is only on or off. The alphadata makes a smooth oval, since alphadata is antialiased.
Kind regards
Bernd
- Attachments
-
- alphaData.livecode.zip
- (41.92 KiB) Downloaded 457 times
-
- Posts: 21
- Joined: Sat Jan 15, 2011 6:40 pm
Re: Mask & Alpha
Hi Bernd,
Thanks for your (ultra fast!) response and your stack.
So, there is no others ways to clip an image?
Thanks again,
Thanks for your (ultra fast!) response and your stack.
So, there is no others ways to clip an image?
Thanks again,
Re: Mask & Alpha
Hi Jean,
look at the crop command in the dictionary.
Kind regards
Bernd
look at the crop command in the dictionary.
Kind regards
Bernd