Colorizing Grey PNG-Alpha

Discussion in 'iOS Programming' started by Chris74, Aug 19, 2008.

  1. Chris74 macrumors newbie

    Aug 19, 2008
    I need to colorize the image data of a grey PNG-Alpha without losing its transparency. How can I do this?

    I believe I tried everything mentioned in the "Quartz 2D Programming Guide" and QuickDrawToQuartz2D and so much more. Without success.

    The mentioned approach to colorize an image:

    CGContextDrawImage(context, myRect1, image);
    CGContextSetBlendMode(context, kCGBlendModeColor);
    CGContextSetRGBFillColor (context, 0.8, 0.0, 0.0, 1.0);
    CGContextFillRect (context, myRect2);

    Colorizes the whole rectangle (my image but also its transparent background).

    I'm new to Cocoa, IPhone and co. and I'd be so happy if anyone of can help or has some good pointers. I searched on the internet half of the day today to get this done.

    - Chris
  2. Jordan Wan macrumors newbie

    Nov 6, 2008
    CGContextSetBlendMode with alpha transparency

    Hi Chris,

    I'm stuck with the very same problem. Have you found a solution to this or another way to colorize a PNG (with relative color to each grey value).

    Please let me know how things worked out. I'd love to know how you solved this issue.




Share This Page