2007年6月13日星期三

Asymptote学习系列(9)

数据类型(续):
 
pen
pen是个作图环境,它包括颜色、线型、粗细等,还有line join, fill rule, text alignment, font, font size,pattern, overwrite mode, 及 calligraphic transforms on the pen nib。pen之间可以用"+"号来融合,这会混合两种pen的颜色,对于其它的特性,则会用后面的替代前面的。如一支黄色的画点线的pen,可以用下面的任何一种方法得到:
dotted+red+green
red+green+dotted
red+dotted+green
符号"*"作用到pen上表示对pen的颜色*相应的数,如:
red*0.5
 
颜色
定义pen的颜色的函数包括:
pen gray(real g);
      灰度笔,其中 g 在 [0,1] 上,0.0 表示黑色,1.0 表示白色。
pen rgb(real r, real g, real b);
      用 RGB 颜色构造 pen ,每个变量都在 [0,1] 间。
pen cmyk(real c, real m, real y, real k);
      由 CMYK(cyan, magenta, yellow, black) 构造 pen ,同样每个变量在 [0,1] 间。
pen colorless(pen);
      得到一个没有颜色的pen(可以用来避免颜色混合)。
real[] colors(pen)
      得到pen的颜色的各个分量
 
一些常量:
pen invisible;
      不可见的pen,它会调节整个的边界。
还有如下预定义好的颜色可以用:
palered,lightred,mediumred,red,heavyred,brown,darkbrown,
palegreen,lightgreen,mediumgreen,green,heavygreen,deepgreen,darkgreen
paleblue,lightblue,mediumblue,blue,heavyblue,deepblue,darkblue
palecyan,lightcyan,mediumcyan,cyan,heavycyan,deepcyan,darkcyan
pink,lightmagenta,mediummagenta,magenta,heavymagenta,deepmagenta,darkmagenta
paleyellow,lightyellow,mediumyellow,yellow,lightolive,olive,darkolive
palegray,lightgray,mediumgray,gray,heavygray,deepgray,darkgray
black
white
orange
fuchsia
chartreuse
springgreen
purple
royalblue
Cyan
Magenta
Yellow
Black
cmyk+red
cmyk+blue
cmyk+green
 
线型
线型由函数定义:
pen linetype(string s, real offset=0,bool scale=true, bool adjust=true)
其中 s 是由空格分开的整数或实数,如下是些预定义的量:
pen solid=linetype("");
pen dotted=linetype("0 4");
pen dashed=linetype("8 8");
pen longdashed=linetype("24 8");
pen dashdotted=linetype("8 8 0 8");
pen longdashdotted=linetype("24 8 0 8");
pen Dotted=dotted+1.0;
pen Dotted(pen p=currentpen) {return dotted+2*linewidth(p);}
s 中的数中,第1个表示用pen画多长,第2个表示不用这个pen画多长,依次下去。
 
粗细 
精细由函数定义:
pen linewidth(real).
一支pen与实数的加法"+"定义为:
static pen operator +(pen p, real w) {return p+linewidth(w);}
static pen operator +(real w, pen p) {return linewidth(w)+p;}
如:
pen p=red+1.0;
 
还有一些其它的特性,请参考帮助文件。
 
--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

1 条评论:

匿名 说...

Thanks for mаking me to aсquіre neω thoughts about pc's. I also possess the belief that certain of the best ways to help keep your mobile computer in excellent condition has been a hard plastic-type material case, as well as shell, that suits over the top of your computer. A majority of these protective gear are generally model specific since they are manufactured to fit perfectly in the natural outer shell. You can buy them directly from the seller, or from third party sources if they are intended for your mobile computer, however its not all laptop will have a spend on the market. Once again, thanks for your points.

Stop by my web site quibids scam