CGImage masking via CGCreateImageWithMask getting odd results
CGImage masking via CGCreateImageWithMask getting odd results
- Subject: CGImage masking via CGCreateImageWithMask getting odd results
- From: "Nick Veys" <email@hidden>
- Date: Sat, 9 Aug 2008 23:08:00 -0500
I'm getting some interesting results with an image mask I'm trying to
apply. I'm trying to vignette away the edges of some small images and
instead of getting transparency behind them, I'm getting the black
(presumably from the mask).
I'm simply calling CGImageCreateWithMask(image, mask) with two
CGImageRefs, image is 'image.png', attached. mask is 'mask.png',
attached. The result I'm seeing is 'result.png', also attached.
Instead of seeing through, I see black (the background is white...)!
Argh. I've played with the views behind it and set their colors to
all kinds of fun things and I never see that color, just the black
from the mask. Am I completely misinterpreting what the mask is?
>From the docs it says if the mask is an image, which it is via
verification with CGImageIsMask(), it uses the grayscale as an alpha
value, so it would effectively fade the corners of my images into the
layer behind it.
Even stranger, if I go and put a few lines across the image, say a
solid black line, a 50% gray line, and a 25% gray line, I see on the
final composited image a solid black line, a 50% transparent line and
a 25% transparent line ('lines.png', attached). So there seems to be
some logic behind the operation that's occurring, it's just definitely
not what I'm looking for.
Any info is appreciated!
Attachment:
image.png
Description: PNG image
Attachment:
mask.png
Description: PNG image
Attachment:
result.png
Description: PNG image
Attachment:
lines.png
Description: PNG image
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden