I wish I would find an answer for this. I have searched and searched and couldn\'t the right answer. Here is my situation:
In a Mac OS Cocoa Application, I want to draw
Here's a quick way to draw pixels on OS X:
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
initWithFocusedViewRect:dirtyRect];
for (int x = 0; x < [rep pixelsWide]; x++) {
for (int y = 0; y < [rep pixelsHigh]; y++) {
NSUInteger pixel[4] = { 0, 255, 0, 255 };
[rep setPixel:pixel atX:x y:y];
}
}
[rep drawInRect:dirtyRect];
}