Newbie question: drawing individual pixels
Newbie question: drawing individual pixels
- Subject: Newbie question: drawing individual pixels
- From: Marshall Pierce <email@hidden>
- Date: Sun, 3 Nov 2002 20:44:48 -0800
Hello all,
I'm probably just doing something stupid, but I cannot get pixel
drawing to work.
I'm attempting to make a fractal drawing program, and I'm using three
classes:
FractalController, FractalDisplay (subclass of NSView) and
FractalPreview
(subclass of NSView).
on applicationDidFinishLaunching:(NSNotification *)notification
I call [fractalDrawer initWhiteRect] (fractalDrawer is the
outlet to FractalDisplay)
this is the code for initWhiteRect:
- (void)initWhiteRect
{
[[NSColor colorWithCalibratedRed:0 green:1 blue:1 alpha:1] set];
NSRectFill(NSMakeRect(168,16,501,501));
}
This just draws a white background in my main (non-preview) NSView.
That works fine, but when I then try to draw pixel-by-pixel (to draw
the actual fractal) using this code as part of a for loop
[[NSColor colorWithCalibratedRed:0 green:0 blue:0
alpha:1] set];
x = 168 + i;
y = 16 + j;
NSRectFill(NSMakeRect(x,y,1,1));
it doesn't work. It doesn't crash or give errors, it just doesn't draw.
Am I simply using the wrong approach? By the way, I would to be able to
save
the images as a file (so that I can make animations) so should I be
somehow
using NSImage instead?
Confusedly yours,
Marshall Pierce
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.