UIImageBuffer

From iPhone Development Wiki
Revision as of 21:06, 1 November 2009 by KennyTM~ (talk | contribs) (Created page with '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 c…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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];
...