Make a pixmap purgeable
GETPIXELSSTATE returns a long (32-bit) GWorldFlag value, in which the state (0 or 1) of various flag bits indicates the present settings. The bit that indicates purgeability of the pixels is bit 6=_pixelsPurgeableBit. If this bit is set, and ALL the other bits are zero, the value returned by GETPIXELSSTATE would be 64. In FB, that value 64 is expressable in a bewildering variety of ways:
1<<_PIXELSPURGEABLEBIT 2^6 _pixelsPurgeableBit% BIT (_pixelsPurgeableBit) _pixelsPurgeableBits other than #6 have different meanings and therefore are supplied with their own pair of constants. Here are two other flags:
_keepLocalBit=3 and _keepLocal=2^3=8 _pixelsLockedBit=7 and _pixelsLocked=2^7=128The reason for all this is to allow programmers to inspect and set or clear the individual bits using moderately comprehensible code. Once you have adjusted the flag bits of interest, you call SETPIXELSSTATE for the new condition. For example, to make purgable pixels, and remove any pre-existing keepLocal property:
pixMapHandle& = FN GETGWORLDPIXMAP(offPort&) myGWFlags& = FN GETPIXELSSTATE(pixMapHandle&) 'set bit 6 regardless of its previous state by ORing 64 into myGWFlags& myGWFlags& = myGWFlags& OR _pixelsPurgeable 'clear bit 3 regardless of its previous state by ANDing NOT 8 myGWFlags& = myGWFlags& AND NOT _keepLocal CALL SETPIXELSSTATE(pixMapHandle&, myGWFlags&)Rocognising the difficulty of this bit-twiddling approach, however, Apple provided special toolbox calls for common tasks, such as LOCKPIXELS and UNLOCKPIXELS. In your case the single line
CALL ALLOWPURGEPIXELS(FN GETGWORLDPIXMAP(offPort&))will do what you want without risk of confusion by, or mis-setting of, the other flag bits.