[futurebasic] Re: color depth

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 1998 : Group Archive : Group : All Groups

From: Osamu Shigematsu <shige@...>
Date: Wed, 1 Apr 98 02:07:08 -0000
Hi. I will send you my code.
It work for only main monitor.
Good luck.

>I'm looking for a way to change color depth from within my application, but
>find little on the subject in the manuals.  Some help, please?

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


************************************************************
* Osamu Shigematsu                                         *             
* mail: shige@... / a1297991@...        *
* homepage : http://www.ravi.ne.jp/FBII/                   *
************************************************************