2

For example, I have a CGImageRef and I want to shift all pixels which are red to orange. Or to put it in other words: I want to apply a value function on every pixel in an image, which modifies the pixel based on the RGBA values it has. So the value function would calculate the new component values for that pixel based on the current component values and some algorithm applied to it.

I know how I could code that by hand with about 100 lines of code, but I wonder if there is a easier and maybe even faster way?

I believe Brad Larson has mentioned somewhere that things like this can be done on the GPU easily and fast. However, I must support iOS 3.2 so it should not get too fancy.

Would be happy about any ideas. Thanks!

Proud Member
  • 40,078
  • 47
  • 146
  • 231

1 Answers1

1

As far as I know there are no built in functions to achieve what you want.

The easiest way to get GPU acceleration when doing custom image manipulations on the pixel level is using the Accelerate.framework. Accelerate will use the 'best execution path' based on available hardware.

However... the port to iOS was only done for iOS4

(disclaimer: I have little to no experience nor knowledge of everything that's possible in OpenGL, so take my answer as limited within the Core Graphics realms of iOS)

Community
  • 1
  • 1
Pieter
  • 17,435
  • 8
  • 50
  • 89