| GrayOn | Function (tigcc.a)

gray.h

short GrayOn (void);

Activates grayscale mode with four shades of gray.

GrayOn activates grayscale mode. This works on both hardware version 1 and 2 calculators because the calculator type is detected automatically. See GrayAdjust for information on how to reduce flickering on HW2 calculators as much as possible.
The GrayMode function as well as the constants defined in the enum GrayModes still exist to maintain compatibility with programs written before TIGCC v0.91. In fact, GrayMode is now defined as a macro which optimizes into a call to GrayOn or GrayOff if you call it with a constant value.
GrayOn returns FALSE if there was an error in switching to grayscale mode, otherwise it returns TRUE. Don't forget to switch off grayscale mode before your program terminates, or your TI will crash very soon!
Here is an example of a program for testing grayscale mode (called "Gray Test Project"), which displays 3 squares on the screen, each with a different level of gray (see other functions from this header file and from the graph.h header file for an explanation about how it works):

    // Grayscale test program for TIGCC

    #define USE_TI89
    #define USE_TI92PLUS
    #define USE_V200

    #define MIN_AMS 100
    #define SAVE_SCREEN

    #include <tigcclib.h>

    void _main(void)
    {
      if (!GrayOn ())
        return;
      GraySetAMSPlane (LIGHT_PLANE);
      ClrScr ();
      ScrRectFill (&(SCR_RECT){{20,20,40,40}}, ScrRect, A_NORMAL);
      ScrRectFill (&(SCR_RECT){{80,20,100,40}}, ScrRect, A_NORMAL);
      GraySetAMSPlane (DARK_PLANE);
      ClrScr ();
      ScrRectFill (&(SCR_RECT){{50,20,70,40}}, ScrRect, A_NORMAL);
      ScrRectFill (&(SCR_RECT){{80,20,100,40}}, ScrRect, A_NORMAL);
      ngetchx ();
      GrayOff ();
    }

Starting from release 2.2 of the library, it is safe to call GrayOn even if grayscale mode is already on, and to call GrayOff even if grayscale mode is already off.

Uses: HeapAllocHigh, HeapDeref, PortSet
Used by: GrayMode, GrayOnThrow

See also: GrayOff, GrayOnThrow