The scrmask subroutine specifies a two-dimensional rectangular clipping mask. The screenmask is specified in window coordinates. Every drawing primitive is clipped to this area: that is, no drawing primitive can draw outside the screenmask. The clipping performed by the screenmask is separate from and independent of the 3-D clipping performed by the system. The syntax is as follows:
void scrmask(Screencoord *left, Screencoord *right, Screencoord *bottom, Screencoord *top)
Normally, the screenmask is precisely the same size as the window. The screenmask cannot be made larger than the window. When the viewport subroutine is called, it resets the screenmask to be the same size as the viewport.
Although the scrmask subroutine clips all primitives, it is not useful except for performing character clipping. The 3-D clipping performed by the system is sufficient for all other clipping. However, in reference to character strings, the 3-D clipping mechanism only clips the origin of the character string. That is, if the origin of the character string is inside the viewport, the entire string would be drawn if the screenmask was not in effect. If the origin is outside the viewport, none of the character string would be drawn, even if, logically, some of the string ought to be visible.
This type of clipping is called gross clipping. The screenmask is provided for fine clipping, clipping down to a subcharacter level. To use it, set the screenmask to be smaller than the viewport. Strings that begin inside the viewport are drawn, but only starting at the character (or fraction of the character) that lies inside the screenmask. Please refer to "Creating Text Characters" for more information.