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,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,80);
 graphics2D.Drawoval(null,80);
}

相关文章

如何在Silverlight4(XAML)中绑定IsEnabled属性?我试过简单的...
我正在编写我的第一个vb.net应用程序(但我也会在这里标记c#,...
ProcessFile()是在UIThread上运行还是在单独的线程上运行.如...
我从同行那里听说,对sharepoint的了解对职业生涯有益.我们不...
我正在尝试保存一个类我的类对象的集合.我收到一个错误说明:...
我需要根据Silverlight中的某些配置值设置给定控件的Style.我...