# The ScreenType interface

A `ScreenType.T` represents a class of screens that have a common pixel depth, a common set of operations on the pixels, and common repositories for cursors, pixmaps, and fonts.

When the screentype of a `VBT` changes, any screen-dependent resources for the old screentype become useless. The application must use the new screentype's oracles to look up resources that are valid for the new screentype. This is all handled automatically if you use screen-independent resources that are predefined or defined by somebody else. But you will need to use this interface if you are implementing your own screen-independent resources.

    INTERFACE ScreenType;

    IMPORT ScrnCursor, VBT, ScrnColorMap, ScrnFont,
      ScrnPaintOp, ScrnPixmap;

    TYPE T = VBT.ScreenType;

    REVEAL VBT.ScreenType <: Public;

    TYPE
      Public = VBT.ScreenTypePublic OBJECT (*CONST*)
        bg, fg: ScrnPaintOp.Pixel;
        bits: T;
        op: ScrnPaintOp.Oracle;
        cursor: ScrnCursor.Oracle;
        pixmap: ScrnPixmap.Oracle;
        font: ScrnFont.Oracle;
        cmap: ScrnColorMap.Oracle;
      END;

For a screentype `st`, the values `st.bg` and `st.fg` are the pixel values that represent the user's default background and foreground colors on `st`. If the screen is color-mapped, these are appropriate for the default colormap. For applications doing simple painting, `bg` is logical white and `fg` is logical black. Depending on the screen and user preferences, the actual colors that the user sees might be different.

The screentype `st.bits` is the screentype for 1-bit deep pixmap sources for painting on screens of type `st`. It is guaranteed that `st.bits.bits=st.bits`, `st.bits.fg=1`, and `st.bits.bg=0`.

The oracles `st.op`, `st.font`, `st.cursor`, and `st.pixmap` contains methods that provide screen-dependent resources appropriate for `st`---for example, `st.font` has a method that will look up fonts by name.

If `st.cmap # NIL`, `st` is a color-mapped screen, which means that the color of a pixel is determined by looking up its value in a table. The color map can be either readonly or writable.

    END ScreenType.