0

In Java I can make a background rect colored blue. I can then draw a load of sprites also with blue as the background color. I can then make it so that particular blue does not show up when drawing to the canvas or view as it is here, how do I do this in Quartz in Objective C?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jobalisk
  • 728
  • 1
  • 6
  • 17
  • Why do you need to use Quartz? I suggest you run a search for such a basic question. – El Tomato Dec 10 '16 at 02:24
  • Why do you need to use blue as the background color? Why not just leave the background transparent? – rob mayoff Dec 10 '16 at 03:29
  • A: I need to use quartz because this is a Power PC based app. B: I wouldn't be asking here if I hadn't already searched. C: I could go transparent and I will if I cant find another solution, but thats a huge amount of images I would need to alter – Jobalisk Dec 10 '16 at 04:45

1 Answers1

1

You can use CGImageCreateWithMaskingColors to create a copy of an image with the blue pixels changed to transparent. This function was (according to the documentation) added in macOS 10.4 (Tiger). It is discussed in“Masking an Image with Color” in the Quartz 2D Programming Guide.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848