Graphics contexts

Graphics contexts (GCs) are used in most window systems to hold the information about what attributes to use when drawing stuff. Let us say that we want to draw a line to the screen. It would be cumbersome to have to specify line style, dash pattern, thickness, drawing color, graphics operation, and such every time we wanted to draw a line to the screen. The solution is to have a record structure which holds this information, and to pass that structure to the functions that draw graphics primitives. Since you often want to paint groups of primitives with the same attributes (color, line style, font, etc.), GCs are an easy and convenient way to specify these values.