グラフィックコンテキスト(GC)は、ほとんどのウィンドウシステムで、 描画の時にどの属性を使うかという情報を保持するために使われている。 画面に線を引きたいとしよう。 線のスタイルや、ダッシュパターンや、太さや、色や、描画の演算を指定しなければ ならないことや、それを画面に線を引きたいときに毎回するというのは、 面倒であろう。解決策は、この情報を保持する記録用構造体を持ち、 グラフィックスプリミティブを描画する関数にその構造体を渡すというものだ。 プリミティブの集団を同じ属性(色、線のスタイル、フォントなど)で描くことは しばしば望まれることなので、GC はこれらの値を指定する簡単で便利な方法である。
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.