UIImageBuffer

From iPhone Development Wiki
Jump to: navigation, search

UIImageBuffer is a class that holds an array of RGBA color components for creating a CGImage. You should directly operate on a CGBitmapContext instead of using this class.

Example code:

UIImageBuffer* buf = [[UIImageBuffer alloc] initWithWidth:100 height:50];
UIColorComponents white = {1, 1, 1, 1};
[buf fillWithPixel:&white];
UIColorComponents red = {1, 0, 0, 1};
for (int i = 0; i < 50; ++ i)
  [buf setPixel:&red atPoint:CGPointMake(i, i)];
CGImageRef img = [buf createImage];
[buf release];
...