
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
|
DRAWING
Change the bitdepth
LOCAL FN setDepth(gDevice&, depth%)
` clr.w -(sp)
` move.l ^gDevice&,-(sp)
` move.w ^depth%,-(sp)
` clr.l -(sp)
` dc.w $203C,$000A,$0013,$AAA2
` move.w (sp)+,d0
` ext.l d0
END FN
LONG IF SYSTEM(_aplFlag) 'this won't work interactively
LONG IF SYSTEM(_macPlus) = _false 'plus has no gDevices
gDevice& = FN GETMAINDEVICE
LONG IF gDevice&
OSErr = FN setDepth(gDevice&,8)
END IF
END IF
END IF
-----
If you need an easy solution, or don't get any other replys, download my AppleScript Commands DCOD. Then all you have to do is call:
osErr% = FN AppleScriptCommand("Finder","get monitor depth",@myResult$)
and
osErr% = FN AppleScriptCommand("Finder","set monitor depth to 8",@myResult$)
All this and more from:
http://www.ozemail.com.au/~benjamen/
I will send you my code. It works for only main monitor.
CLEAR LOCAL
LOCAL FN FatalError(errCode%)
DIM t$,errStr$,id%
LONG IF errCode%
IF errCode%>=_swUnknownError THEN errCode% = _swUnknownError
errStr$ = STR#(_swErrStrResID,errCode%)
t$ = "Error Code:"+STR$(errCode%)
CALL PARAMTEXT(errStr$,t$,"","")
id% = FN STOPALERT(1,0)
GOTO "STOP"
END IF
END FN
LOCAL MODE
LOCAL FN SetDepth(depth%)
DIM osErr%,device&
osErr% = _noErr
LONG IF SYSTEM(_aplFlag)
LONG IF SYSTEM(_macPlus)=_false
device& = FN GETMAINDEVICE
LONG IF device&
` CLR.W -(SP)
` MOVE.L ^device&,-(SP)
` MOVE.W ^depth%,-(SP)
` CLR.L -(SP)
` DC.W $203C,$000A,$0013,$AAA2
` MOVE.W (SP)+,D0
` EXT.L D0
osErr% = REGISTER(D0)
END IF
END IF
END IF
END FN = osErr%
LOCAL FN Set256
DIM osErr%,device&,id%
LONG IF SYSTEM(_maxColors)<8
FN FatalError(_swUnknownError)
XELSE
LONG IF SYSTEM(_crntDepth)<>8
CALL PARAMTEXT("Chage monitor depth to 8 bit.","","","")
id% = FN CAUTIONALERT(1,0)
osErr% = FN SetDepth(8)
LONG IF osErr%<>_noErr
FN FatalError(_swUnknownError)
END IF
END IF
END IF
END FN
"MAIN"
gProgramEnds% = _false
gDepth% = SYSTEM(_crntDepth)
FN Set256
DO
HANDLEEVENTS
UNTIL gProgramEnds%
"STOP"
LONG IF gDepth%<>SYSTEM(_crntDepth)
FN SetDepth(gDepth%) ' restore the monitor depth
END IF
END
LOCAL FN setDepth(gDevice&, depth%)
` clr.w -(sp)
` move.l ^gDevice&,-(sp)
` move.w ^depth%,-(sp)
` clr.l -(sp)
` dc.w $203C,$000A,$0013,$AAA2
` move.w (sp)+,d0
` ext.l d0
END FN
LONG IF SYSTEM(_aplFlag) 'this won't work interactively
LONG IF SYSTEM(_macPlus) = _false 'plus has no gDevices
gDevice& = FN GETMAINDEVICE
LONG IF gDevice&
OSErr = FN setDepth(gDevice&,8)
END IF
END IF
END IF
Note
There's code directly from the Staz called "SetDepth.bas"
FutureBASIC II:(FB) Examples:Handbook:Color:SetDepth.bas
So you probably had it all along and never knew it
Remember, you can't(and shouldn't) change the color depth in the FB environment. You can change it at runtime.
|