[comp.sys.mac.programmer] Another question about color on the mac...

jhsu@Neon.Stanford.EDU (Jeffrey H. Hsu) (07/24/90)

Hello to all MacHackers,

I would really appreciate some help. I have a file that contains a list of 
pixels and the  RGB values for each pixel.

What I want to know is...is there a simple way to draw the picture represented
by the file on a color Mac?

I don't know anything about the color manager, but I really hope there is 
a function that looks something like:

DrawPixel(xCoordinate, yCoordinate: longint; Red, Green, Blue: int);

Am I hoping for too much?
Thanks for any responses,

Jeff

russotto@eng.umd.edu (Matthew T. Russotto) (07/24/90)

In article <1990Jul24.065948.24098@Neon.Stanford.EDU> jhsu@Neon.Stanford.EDU (Jeffrey H. Hsu) writes:

>I would really appreciate some help. I have a file that contains a list of 
>pixels and the  RGB values for each pixel.
>
>What I want to know is...is there a simple way to draw the picture represented
>by the file on a color Mac?

Well, there is, but it take about forever and a day.

RGBColor color;
int i;

for (i=0;i<numcoord;i++) {
	color.red = Red[i];
	color.green = Green[i];
	color.blue = Blue[i];
	SetCPixel(XCoord[i],YCoord[i],&color);
)

A better way to do it might be to set up a direct RGB GWorld offscreen and
CopyBits it to the screen.  It will probably be faster and certainly will
produce a better rendering due to 32-bit quickdraw's dithering.
(unless you are using a full-color screen)
--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?
		Hey!  Bush has NO LIPS!