Path: utzoo!attcan!uunet!lll-winken!sol.ctr.columbia.edu!samsung!sdd.hp.com!decwrl!shelby!portia.stanford.edu!rick@jessica.Stanford.EDU From: rick@jessica.Stanford.EDU (Rick Wong) Newsgroups: comp.sys.mac.programmer Subject: New SetDepth call Keywords: System 6.0.5, Graphics Devices Manager Message-ID: <1990Jul26.183633.10926@portia.Stanford.EDU> Date: 26 Jul 90 18:36:33 GMT Sender: news@portia.Stanford.EDU (USENET News System) Reply-To: rick@jessica.Stanford.EDU (Rick Wong) Organization: Stanford University Lines: 67 Tech Note 276 details a new call available in System 6.0.5 to set the bit-depth of a device, called SetDepth. The TN gives the following example: someResult := SetDepth(myGDevice, {newDepth:} 8, {whichFlags:} 1, {newFlags:} 0); In this call, newDepth = 8 sets an eight-bit depth, whichFlags = 1 indicates that only bit one of newFlags is important, and newFlags = 0 clears the gdDevType flag in the device record (0 = monochrome, 1 = color). SetDepth returns zero if successful or a non-zero value if it cannot impose the desired depth on the requested device. Armed with this information, I tried to write an FKEY to toggle the depth of my main screen between one-bit and eight-bit. Can anyone explain why the following does not work? My system has all the necessary hardware, etc. #include #include #include pascal short SetDepth(GDHandle gd, short newDepth, short whichFlags, short newFlags) = {0x203C, 0x000A, 0x0013, 0xAB1D}; pascal short HasDepth(GDHandle gd, short newDepth, short whichFlags, short newFlags) = {0x203C, 0x000A, 0x0014, 0xAB1D}; #define kSysEnvVersion 1 #define kSystem6_0_5 0x0605 int main() { SysEnvRec gWorld; GDHandle mainDev; int oldDepth; Boolean successful; successful = false; (void) SysEnvirons(kSysEnvVersion, &gWorld); if (gWorld.systemVersion >= kSystem6_0_5 && gWorld.hasColorQD) { mainDev = GetMainDevice(); oldDepth = (**(**mainDev).gdPMap).pixelSize; if (oldDepth == 1) { successful = (SetDepth(mainDev, 8, 0, 0) == noErr); } else { successful = (SetDepth(mainDev, 1, 0, 0) == noErr); } } if (!successful) { SysBeep(1); } return 0; } When I try to set the depth to one-bit, the result code returned is 257; eight-bit, 264. Thanks, Rick Wong rick@jessica.stanford.edu