Re: Drawing a single pixel
Re: Drawing a single pixel
- Subject: Re: Drawing a single pixel
- From: Scott <email@hidden>
- Date: Mon, 28 May 2001 13:06:28 -0700
on Sat, 26 May 2001 21:05:23 -0700, Dennis C. De Mars at
email@hidden wrote:
> I could post the source code if anybody's interested as a simple
> example of how to generate an arbitrary bitmap image and display it
> using NSBitmapImageRep.
>
> - Dennis D.
Yes, please post the code! Seems like a lot of overhead just to draw a
pixel, though.
I have a neural network I'm working on and will need to plot error points as
a network learns. Obviously, I'll want any screen draws to be as quick as
possible, but I'd also like them real-time. IOW, I don't want to have to
wait until the whole map is drawn (off screen) to look at it.
Any more hints?
Rock on!
Scott
------
"...there's no such thing as a plain name..."
http://www.domainjane.com
------BEGIN ORIGINAL POST------
>
> On Saturday, May 26, 2001, at 08:06 PM, email@hidden wrote:
>
>
>
>> I wrote a mset fractal program a while back for Mac OS <9 in C. And I would
>
>> like to write one in cocoa. Well, I was just wondering how to draw a single
>
>> pixel. I guess I could use NSBezier and just make a rect that is 1 pixel
>
>> large but I was wondering if there was a way to just do a single pixel.
>
>>
>
>>
>
> You could create a NSImage with a NSBitmapImageRep (you can get at the bitmap
>
> data from BitmapImageRep) set the pixel you want then composite this back
>
> into
>
> your View when appropriate.
>
>
>
Yes, he needs to use NSBitmapImageRep. However, I believe the reason he
>
wants to be able to change a single pixel is because he wants to build a
>
fractal picture up pixel by pixel and then display it. In that case, he
>
should just set all of the pixels in NSBitmapImageRep's bitmap to the proper
>
values and then display that.
>
>
I actually have a toy Cocoa program that does exactly this (generate an
>
image of the Mandelbrot set and display it). I simply use NSImageView in a
>
window. I create an NSBitmapImageRep, set the NSImage's representation to
>
this, and write directly into the bitmap. It's very simple to do. I could
>
post the source code if anybody's interested as a simple example of how to
>
generate an arbitrary bitmap image and display it using NSBitmapImageRep.
>
>
- Dennis D.
------END ORIGINAL POST------