XRectangle(3) 長方形の描画と、長方形を表す構造体

Other Alias

XDrawRectangle, XDrawRectangles

書式

XDrawRectangle(display, d, gc, x, y, width, height)

      Display *display;

      Drawable d;

      GC gc;

      int xy;

      unsigned int widthheight;

XDrawRectangles(display, d, gc, rectangles, nrectangles)

      Display *display;

      Drawable d;

      GC gc;

      XRectangle rectangles[];

      int nrectangles;

引き数

d
ドロウアブル(drawable)を指定。
display
X サーバへの接続を指定。
gc
GC を指定。
nrectangles
配列内の長方形の数を指定。
rectangles
長方形の配列を指定。
width

height
長方形のディメンジョンを決める幅と高さを指定。
x

y
長方形の左上隅の位置を決める座標を指定。

説明

関数 XDrawRectangleXDrawRectangles は、各長方形に対し、次に示す5点を使った PolyLine プロトコルが指定されたかのように、長方形の輪郭(1つあるいは複数)を描画 する。
[x,y] [x+width,y] [x+width,y+height] [x,y+height] [x,y]

これらの関数は、指定した1つあるいは複数の長方形に対して、1つのピクセル を1度しか描画しない。 XDrawRectangles は、配列中の順序通りに長方形を描画する。 長方形が交わっている場合、重なっている部分のピクセルは複数回描画される。

いずれの関数も以下の GC コンポーネントを使用する。 function, plane-mask, line-width, line-style, cap-style, join-style, fill-style, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. They also use these GC mode-dependent components: foreground, background, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dash-list.

XDrawRectangleXDrawRectangles はエラー BadDrawable, BadGC, BadMatch を起こすことがある。

構造体

XRectangle 構造体の内容を示す。

typedef struct {
     short x, y;
     unsigned short width, height;
} XRectangle;

全ての x, y メンバは符号付き整数である。 width, height メンバは16ビットの符号無し整数である。 プロトコルではこれらの値は16ビットのフィールドしか持たないので、16ビッ トの範囲を越える座標やサイズを生成しないよう注意しなければならない。

返り値

BadDrawable
引き数 Drawable の値が、定義されている Window や Pixmap を指していない。
BadGC
引き数 GContext の値が、定義されている GContext を指していない。
BadMatch
InputOnly のウィンドウがドロウアブルとして指定された。
BadMatch
引き数や引き数の組は正しい型・範囲を持っているが、そのリクエストが要求する 他の条件に適合できなかった。