Silverlight 引路蜂二维图形库示例:颜色

引路蜂二维图形库中的颜色值是个32位整数,采用0xAARRGGBB格式。Alpha通道指定了颜色的透明度,0×00表示全透明,0xFF表示完全不透明。

下面的代码显示了如何创建不透明和半透明的颜色。

private void Colors()
{
 /**
   * The solid (full opaque) red color in the ARGB space
   */
 Color redColor = new Color(0xffff0000, false);
 
 /**
  * The semi-opaque green color in the ARGB space (alpha is 0x78)
  */
 Color greenColor = new Color(0x7800ff00, true);
 
 /**
  * The semi-opaque blue color in the ARGB space (alpha is 0x78)
  */
 Color blueColor = new Color(0x780000ff, true);
 /**
  * The semi-opaque yellow color in the ARGB space ( alpha is 0x78)
  */
 Color yellowColor = new Color(0x78ffff00, true);
 
 /**
  * The dash array
  */
 int[] dashArray = { 20, 8 };
 graphics2D.Reset();
 graphics2D.Clear(Color.Black);
 SolidBrush brush = new SolidBrush(redColor);
 graphics2D.FillOval(brush, 30, 60, 80, 80);
 brush = new SolidBrush(greenColor);
 graphics2D.FillOval(brush, 60, 30, 80, 80);
 Pen pen = new Pen(yellowColor, 10, Pen.CapButt, Pen.JoinMiter, dashArray, 0);
 brush = new SolidBrush(blueColor);
 graphics2D.SetPenAndBrush(pen, brush);
 graphics2D.FillOval(null, 90, 60, 80, 80);
 graphics2D.DrawOval(null, 90, 60, 80, 80);
}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值