Re: Drawing Pixels with NSBezierPath
Re: Drawing Pixels with NSBezierPath
- Subject: Re: Drawing Pixels with NSBezierPath
- From: John Randolph <email@hidden>
- Date: Sun, 4 Jul 2004 01:12:10 -0700
On Jul 3, 2004, at 11:34 AM, Christopher O'Neill wrote:
Hi all. The program I am writing requires a view to be drawn with
every pixel being a different color. The only way I can see to do it
is to create a new 1x1 NSRect and draw them to their correct
locations. However, this takes a long time to draw. It constantly
has to be redrawn as one pixel changes color with every click of the
mouse. I have increased speed dramatically by splitting it up into
smaller subviews and only updating the ones that need updating, but
sometimes every pixel needs to be changed, so it will again take a
long time to update. Is there a faster way to do it that I have not
seen, possibly by drawing an array of colors at one pixel each? Any
help is appreciated.
There's an example of directly setting the colors of the pixels in an
NSBitmapImageRep in the "Transformed Image" sample, at
http://developer.apple.com/samplecode/Transformed_Image/
Transformed_Image.html
Have a look at the file called "NSImageGradients.m".
The next time I needed to manipulate pixel data, I did it in a rather
cleaner way, in the Image Difference sample. See the files
"Negative.m", and "PixelTypes.h"
-jcr
_______________________________________________
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.