[comp.sys.mac.programmer] 32-Bit Color Tricks, Tips and Traps---- Help

andyi@mmm.UUCP (Andy Ihlenfeldt) (06/29/89)

Hello Netters, 

I have a few 32 Bit quickdraw questions and hope someone can give me some 
suggestions to follow. We are developing on a MacII with 2 displays 
(one 32 bit, one CLUT), using MPW 3.0 and SADE. 

1) How do you create and draw into a 32-bit color window on a direct device?

   We are using 2 devices, a CLUT and a direct device.  So far, we have been
   unable to create and draw into a window with the direct device 
   characteristics (32 bit pixel size).

2) How do you access the pixel map information associated with the window on 
   a direct device. In particular, when we try to access the memory 
   associated with the pixel map, we get an ## address out of range ## 
   error in the SADE debugger.

3) Finally, does anyone have any guidelines as to when it is necessary to use
   SetOrigin? (oops, nothing to do with color quickdraw here, folks)

Thanks, any replies would be appreciated.  What are you all doing with 32 BQD?

Reply via mail or news.

      Andy Ihlenfeldt                   andyi@mmm.UUCP
      3M, St. Paul, MN                  (612) 736-7143

oster@dewey.soe.berkeley.edu (David Phillip Oster) (06/30/89)

In article <1274@mmm.UUCP> andyi@mmm.UUCP (Andy Ihlenfeldt) writes:
>1) How do you create and draw into a 32-bit color window on a direct device?
Windows pick up their characteristics from the device they are on. If you
create a color window on teh 32-bit device, or drag it onto the 32-bit
device, it will be a 32-bit deep window.

>2) How do you access the pixel map information associated with the window on 
>   a direct device. In particular, when we try to access the memory 
>   associated with the pixel map, we get an ## address out of range ## 
>   error in the SADE debugger.
The simple answer here, as I said in my previous posting: you can't. To
access the memory of the 32-bit device, 32-bit Quickdraw must put the Mac
into 32-bit mode, do the access, and return it to 24-bit mode. Since SADE
works in 24-bit mode, of course you can't see the right memory. You can
always use GetCPixel(). Or, you can CopyBits to an off-screen pixmap that
you then access directly.

>3) Finally, does anyone have any guidelines as to when it is necessary to use
>   SetOrigin? (oops, nothing to do with color quickdraw here, folks)
SetOrigin is convenient when you are drawing algorithmic graphics, and you
scroll the window (say, in repsonse to the user interacting with the
scrollbar) with ScrollRect(), and then want your update procedure to drw
the remainder of the screen. SetOrigin will let the new patterns align
with the scrolled old ones. Remember to do a SetOrigin(0,0) after the
update event, since the control manager needs it to draw controls
correctly.  Remembering how to adjust the clipRgn is a little tricky. (do
you offset it not at all, the negative of the change to the origin, or
equal to the change to the origin. Since there are only 3 choices, try
them all. One will be correct.)

>What are you all doing with 32 BQD?
I wrote a color scanner for pre-production of color magazine photographs.
The resolution of the scanner is 1000 pixels per inch.