Crossposting from another thread, this is a list of my ongoing goals:
Black and white compact macs targetting mostly 512x342 in 1-bit color depth field
BUT
-must not crash if a more recent machine is used
-System 7.5.5 is the most recent that I target
-When possible and not too feature rich, System 1.1 on a 400k MFS disk should run my stuff
-must gracefully center the image if a higher res is used
-must deal with color depth field if it's detected but still use 1-bit gfx data
-must deal with gracefully using graceful detection routines
-great if a Mac128 runs it, but not a big deal if not.
-great if a Mac512 runs it, it should in theory but I don't own one.
-Mac Plus is the natural main target that I can easily test out on real metal
Here's what my current checklist algorithm does. Suggestions and warnings about omissions are very welcome:
Step 1:
Declare a SysEnvRec (system environment record)
Fetch information using SysEnvirons( )
If the mac environment (machine and system/finder) is too old, it should return an error code but that's probably good, since you can expect 1-bit depth in this case. No need to deal with color depth modes!
If the mac environment is too new, then the record returned will be too big, and I still have to figure that out. Maybe a non-issue if I cap things to Sys 7.5.5.
If it's just right, then I can safely declare that if the record's systemVersion is less than 6.0.4 ( less than 0x0604) and/or the machineType record is less than 0, then 1-bit depth is guaranteed (right?)
Step 2:
If 6.0.4+ is here or if the machine isn't old, then the next step that should work is to use Gestalt( )
if an error is reported, then I think it's safe to assume that the program weaved between the cracks and is a 1-bit depth mac (right?)
if a report is obtained, then gestaltQuickdrawVersion is checked and if it is gestaltOriginalQD, then it's 1-bit
if it's not, then you have to deal with PixMap structures in GDHandle where you've fished out the pixelDepth Go to step 3b
Step 3a: if 1-bit
Use qd.thePort and plug your 1-bit depth gfx happily in the screen bitmap, offscreen bitmaps
Step 3b: if not 1-bit
Use GDHandle, assign it GetNextDevice (it gets more complicated if you want to plan for multiple screen, but eesh, no thanks)
get the pixel depth with:
PixMapHandle screenPMH;
short pixelDepth;
screenPMH = (**(theDevice)).gdPMap;
pixelDepth = ((**screenPMH)).pixelSize;
and make sure your 1-bit graphics gracefully insert themselves in the right spots of the higher structure color bitmaps...or ask the user to switch to monochrome mode.
Black and white compact macs targetting mostly 512x342 in 1-bit color depth field
BUT
-must not crash if a more recent machine is used
-System 7.5.5 is the most recent that I target
-When possible and not too feature rich, System 1.1 on a 400k MFS disk should run my stuff
-must gracefully center the image if a higher res is used
-must deal with color depth field if it's detected but still use 1-bit gfx data
-must deal with gracefully using graceful detection routines
-great if a Mac128 runs it, but not a big deal if not.
-great if a Mac512 runs it, it should in theory but I don't own one.
-Mac Plus is the natural main target that I can easily test out on real metal
Here's what my current checklist algorithm does. Suggestions and warnings about omissions are very welcome:
Step 1:
Declare a SysEnvRec (system environment record)
Fetch information using SysEnvirons( )
If the mac environment (machine and system/finder) is too old, it should return an error code but that's probably good, since you can expect 1-bit depth in this case. No need to deal with color depth modes!
If the mac environment is too new, then the record returned will be too big, and I still have to figure that out. Maybe a non-issue if I cap things to Sys 7.5.5.
If it's just right, then I can safely declare that if the record's systemVersion is less than 6.0.4 ( less than 0x0604) and/or the machineType record is less than 0, then 1-bit depth is guaranteed (right?)
Step 2:
If 6.0.4+ is here or if the machine isn't old, then the next step that should work is to use Gestalt( )
if an error is reported, then I think it's safe to assume that the program weaved between the cracks and is a 1-bit depth mac (right?)
if a report is obtained, then gestaltQuickdrawVersion is checked and if it is gestaltOriginalQD, then it's 1-bit
if it's not, then you have to deal with PixMap structures in GDHandle where you've fished out the pixelDepth Go to step 3b
Step 3a: if 1-bit
Use qd.thePort and plug your 1-bit depth gfx happily in the screen bitmap, offscreen bitmaps
Step 3b: if not 1-bit
Use GDHandle, assign it GetNextDevice (it gets more complicated if you want to plan for multiple screen, but eesh, no thanks)
get the pixel depth with:
PixMapHandle screenPMH;
short pixelDepth;
screenPMH = (**(theDevice)).gdPMap;
pixelDepth = ((**screenPMH)).pixelSize;
and make sure your 1-bit graphics gracefully insert themselves in the right spots of the higher structure color bitmaps...or ask the user to switch to monochrome mode.