1

Is there any way to set any color of UIImage (or it CALayer content) as transparent color?

I cannot use single image resource(PNG file) with built-in transparency.

I need to hide some area from first Layer by overlaying second Layer with specific color at that place. So I need to set this specific color as "transparent color" before assembled image drawing.

Image area I need to hide is like background - i.e. specific color will be started from image borders through whole perimeter.

Matt
  • 74,352
  • 26
  • 153
  • 180
MikZ
  • 364
  • 2
  • 13

1 Answers1

2

Sounds like you need to use CGImageCreateWithMaskingColors. I recommend reading the "Bitmap Images and Image Masks" part of the Quartz Programming Guide, and check some example code. It's slightly more low-level than your average Cocoa code, but not very hard to accomplish.

Felixyz
  • 19,053
  • 14
  • 65
  • 60
  • Thank you for your answer! I've tried it before for other purpose... Looks like it's only way to meet my current needed. – MikZ Jun 12 '09 at 09:20