Surface上にいくつかの単純な図形を描写します。これらの命令は、Surfaceの形式を問わずに描写処理を実行することができます。ハードウェア側のSurfaceへ描写を行うと、通常のソフトウェア側のSurfaceへ描写を行う場合よりも処理が遅くなってしまいます。
これらの命令の殆どは、描写する図形の両端までの幅を表わすwidth引数を設定します。width引数に0が設定された場合でも、これらの命令は両端の幅が0としての図形全体を描写します。
全てのdraw命令は描写可能領域の影響を受けるので、図形を描写されるのは描写可能領域内に制限されます。この処理を実行すると、それによって図形が描写された範囲がRect型の戻り値として返されます。
殆どの命令で(赤,緑,青)形式の三要素の色情報をcolor引数として設定できます。それらの命令では、(赤,緑,青,透明度)形式の四要素の色情報もcolor引数として設定できます。Surfaceがピクセル単位の透過に対応していればここで設定した透明度の情報はSurfaceに渡されますが、これは形式上渡されるだけで実際のdraw命令の描写処理において透明度は適用されません。このcolor引数は、色情報に紐づけされている整数型のカラー定数でも設定することもできます 。
これらの命令を実行する場合は、描写先のSurfaceを一時的にロックしなければなりません。多くの図形描写処理を連続して使用する場合は、開始行でSurfaceのロック処理を行い、終了行でSurfaceのロック解除処理を行うことで処理を高速化することができます。
Draw several simple shapes to a Surface. These functions will work for rendering to any format of Surface. Rendering to hardware Surfaces will be slower than regular software Surfaces.
Most of the functions take a width argument to represent the size of stroke around the edge of the shape. If a width of 0 is passed the function will actually solid fill the entire shape.
All the drawing functions respect the clip area for the Surface, and will be constrained to that area. The functions return a rectangle representing the bounding area of changed pixels.
Most of the arguments accept a color argument that is an RGB triplet. These can also accept an RGBA quadruplet. The alpha value will be written directly into the Surface if it contains pixel alphas, but the draw function will not draw transparently. The color argument can also be an integer pixel value that is already mapped to the Surface's pixel format.
These functions must temporarily lock the Surface they are operating on. Many sequential drawing calls can be sped up by locking and unlocking the Surface object around the draw calls.
Surface上に四角形を描写します。引数として設定するRect値は描写される四角形の範囲となります。width引数は外枠の線の太さを表します。width引数に0を設定した場合、描写される四角形の内部が全て塗りつぶされます。
覚えていて欲しいのですが、Surface.fill命令を使用するとdraw.rect命令で内部を塗りつぶした時と同様の処理が行えます。実際は、Surface.fill命令では、ソフトウェア描写とハードウェア描写どちらのディスプレイモードにおいてもハードウェア側での高速描写処理を使用することができます。
Draws a rectangular shape on the Surface. The given Rect is the area of the rectangle. The width argument is the thickness to draw the outer edge. If width is zero then the rectangle will be filled.
Keep in mind the Surface.fill - fill Surface with a solid color method works just as well for drawing filled rectangles. In fact the Surface.fill - fill Surface with a solid color can be hardware accelerated on some platforms with both software and hardware display modes.
Surface上に多角形を描写します。pointlist引数は多角形の頂点の数です。 width引数は外枠の線の太さを表します。width引数に0を設定した場合、描写される多角形の内部が全て塗りつぶされます。
polygon命令内部では、 ''closed''引数を持つ aalines 命令が使用されます。
※原文ではaapolygonと記載されていますが、誤記の可能性があるためpolygonと読み替えて訳しています。
Draws a polygonal shape on the Surface. The pointlist argument is the vertices of the polygon. The width argument is the thickness to draw the outer edge. If width is zero then the polygon will be filled.
For aapolygon, use aalines with the 'closed' parameter.
Surface上に円形を描写します。 pos引数は円の中心点となり、radius引数は円の半径となります。 width引数は外枠の線の太さを表します。width引数に0を設定した場合、描写される円形の内部が全て塗りつぶされます。
Draws a circular shape on the Surface. The pos argument is the center of the circle, and radius is the size. The width argument is the thickness to draw the outer edge. If width is zero then the circle will be filled.
Surface上に楕円形を描写します。引数として設定するRect値は、楕円が内接する範囲となります。width引数は外枠の線の太さを表します。width引数に0を設定した場合、描写される楕円形の内部が全て塗りつぶされます。
Draws an elliptical shape on the Surface. The given rectangle is the area that the circle will fill. The width argument is the thickness to draw the outer edge. If width is zero then the ellipse will be filled.
Surface上に楕円の孤となる曲線を描写します。 引数として設定するRect値は、楕円が内接する四角形の範囲となります。二つのangle引数は、円弧の開始点となる角度と終始点となる角度をラジアン値で表わしたものです。ここで使われる角度は、楕円の右端が0度、上端が90度、左端が180度、下端が270度となります。width引数は外枠の線の太さを表します。
Draws an elliptical arc on the Surface. The rect argument is the area that the ellipse will fill. The two angle arguments are the initial and final angle in radians, with the zero on the right. The width argument is the thickness to draw the outer edge.
Surface上に直線の線分を描写します。線の両端に特別な装飾はなく、線の太さに合わせた四角い形となります。
Draw a straight line segment on a Surface. There are no endcaps, the ends are squared off for thick lines.
Surface上に連結された複数の線分を描写します。pointlist 引数に設定するのは、線分の連結点となる座標のリストです。closed 引数にTrueを設定した場合、開始点と終点の間にも線分が引かれて内部が閉じられた状態になります。
Draw a sequence of lines on a Surface. The pointlist argument is a series of points that are connected by a line. If the closed argument is true an additional line segment is drawn between the first and last points.
Surface上にアンチエイリス処理のされた線分を描写します。この命令は描写可能領域の影響を受けます。この命令で描写処理のなされた範囲がRect型の戻り値として返されます。blend引数にTrueを設定した場合、描写位置にあるピクセルへの上書きはされず、半透明の状態で描写されます。この命令では、startpos引数とendpos引数には浮動小数点を設定することができます。
※A bounding box of the affected area is returned returned as a rectangleをA bounding box of the affected area is returned as a rectangleと読み替えて訳しています。
※the shades will be be blended with existing pixel shades instead of overwriting themをthe shades will be blended with existing pixel shades instead of overwriting themと読み替えて訳しています。
Draws an anti-aliased line on a surface. This will respect the clipping rectangle. A bounding box of the affected area is returned returned as a rectangle. If blend is true, the shades will be be blended with existing pixel shades instead of overwriting them. This function accepts floating point values for the end points.
Surface上に連結された複数の線分を描写します。pointlist引数には、少なくとも二個の座標を設定する必要があります。 closed 引数にはboolean型の値が設定でき、もしTrueを設定した場合は開始点と終点の間にも線分が引かれて内部が閉じられた状態になります。boolean型の blend引数にTrueを設定すると、 描写位置にある図形への上書きはされず、半透明の状態で描写されます。この命令ではpointlist引数には浮動小数点を設定することができます。
※原文には簡易説明文がありませんが、独自に付け加えて訳しています。
Draws a sequence on a surface. You must pass at least two points in the sequence of points. The closed argument is a simple boolean and if true, a line will be draw between the first and last points. The boolean blend argument set to true will blend the shades with existing shades instead of overwriting them. This function accepts floating point values for the end points.