[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RGB arrays
- To: G03092@N1.USNA.NAVY.MIL
- Subject: Re: RGB arrays
- From: STEVE.M@AppleLink.Apple.COM (Carbon-based, S Mitchell,APD)
- Date: 28 Apr 92 06:56 GMT
- Cc: INFO-MCL@CAMBRIDGE.APPLE.COM
To: Raymond Lee firstname.lastname@example.org
From: Steve Mitchell
Sub: RGB arrays
> I do colorimetric analysis using 24-bit color, and I'm trying
> to build RGB integer arrays from PICTs that are displayed in
> MCL2.0b color windows. At the moment, I'm using _GetCPixel and
> scanning windows pixel-by-pixel, but this is hardly satisfactory
> (or elegant) because I often have to scale PICTs that are larger
> than my monitor's pixel dimensions.
> How could I build, say, a 400-by-300-by-3 integer array of RGB
> values (0 - 255) from a 400-by-300 pixel PICT? I assume that if I
> use something like a :pixmap, then the PICT doesn't need to be
> displayed in the top-level window (or even be completely on-screen)
> in order for me to access all pixel RGB values.
The short answer is I hope somebody sends you source code (you
didn't say what version of MCL you are running.) It would also
help if you said what you want to do with the array of RGB
values, in case you're asking the wrong question.
The long answer starts by saying that you are on the right track
(since you are talking about PixMaps) but it requires code that
knows a good deal about how the Mac handles 24-bit color (and
probably your video card too!) An RGB Offscreen Pixmap will
contain exactly what you want; once you have its base address and
its dimensions and rank ordering you can index into it at the byte
level. You are correct that this is totally independent of anything
you see or don't see on your screen(s).
Don't bother trying to decode the bytes of your PICTs; even
if they were captured in raster format, they are compressed now -
you can't turn this off. On the other hand, saving your pictures
in PhotoShop file format will write your array to disk for you!
Then you COULD create a Lisp array and read the bytes right into
it. The more you look at this, the more shortcuts there are, and
the more tarpits.
If you don't get satisfactory responses from others, I'll try
to dig up some source.