gsave()
と grestore()
gsave()
と grestore()
が用意されています。演算子 gsave
は図形の情報(大きさ、色、透明度)をスタックに保存します。演算子 grestore
はスタックからこれらの情報を読み出します。表現のデータに加え、局所的な座標系に関する情報も同様に保存します。pointsize()
, linesize()
, textsize()
の3つの演算子で設定できます。大きさは、実数で指定します。点と線の大きさは1から20までの整数で、ピクセルのサイズです。次のコードと実行結果はその例です。sizes=1..15; forall(sizes, pointsize(#); textsize(#+4); draw((#,0)); drawtext((#,1),#); )
color: | vector: |
black | (0,0,0) |
red | (1,0,0) |
green | (0,1,0) |
blue | (0,0,1) |
cyan | (0,1,1) |
magenta | (1,0,1) |
yellow | (1,1,0) |
white | (1,1,1) |
pointcolor()
, linecolor()
, textcolor()
の3つの演算子で設定できます。さらに、 color()
演算子はすべてのオブジェクトの色を同時に設定します。n=13; ind=1..n; pointsize(9); forall(ind,i, forall(ind,j, pointcolor((i/n,j/n,0)); draw((i,j),noborder->true); pointcolor((0,i/n,j/n)); draw((i+15,j),noborder->true); pointcolor((j/n,0,i/n)); draw((i+30,j),noborder->true); ) )
alpha()
によりすべての要素に設定されます。red()
:
で設定されます。green()
:
で設定されます。blue()
:
で設定されます。gray()
:
に設定した色ベクトルを作ります。hue()
:
は0から1までの数です。この値の範囲は色相環の範囲を表します。1より大きな値の場合には、色相環を何周かして色を決めます。n=360; ind=(1..n)/n; linesize(2); forall(ind, color(hue(#)); draw((0,0),(sin(#*2*pi),cos(#*2*pi))) )
Page last modified on Tuesday 06 of March, 2012 [10:51:36 UTC].
The original document is available at
http://doc.cinderella.de/tiki-index.php?page=Appearance%20of%20ObjectsJ