FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DRAWING

Check if a world is a BWorld or a GWorld


A GWorld pointer is a valid grafport pointer. Look into the pointer as though it were a grafport. Get the rowbytes field. If rowbytes% AND &C000 is anything other than zero, you have a more-than-one-bit-deep grafport.

Since your application always creates a GWorld for >1 bit uses, you know that any colour grafport is also a GWorld.

Mars


This should do the trick:-

WINDOW 1
qdVers = FN GESTALT(_Gestaltquickdrawversion)
haveQD32Flag = (qdVers>=_Gestalt32bitqd)
PRINT"haveQD32Flag = " haveQD32Flag

qdFeatures = FN GESTALT(_Gestaltquickdrawfeatures)
haveDeepGWorldsFlag = (FN BITTST(qdFeatures, 15-_Gestalthasdeepgworlds)<>0)
PRINT"haveDeepGWorldsFlag=" haveDeepGWorldsFlag

LONG IF haveDeepGWorldsFlag
  PRINT "OK to use GWorld"
XELSE
  PRINT "Must use 1-bit BWorld"
END IF

DO
UNTIL FN BUTTON

Robert Purves