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

55 篇文章 0 订阅
41 篇文章 0 订阅

引路蜂二维图形库也提供了对一般路径的支持,可以同过线段,二次曲线,三次曲线组成路径,也可以根据SVG指令来定义路径。

private void Paths() 
{ 
 AffineTransform mat1; 
  
 /* The path.  */
 Path path; 
  
 /** Colors */
 Color redColor = new Color(0x96ff0000, true); 
 Color greenColor = new Color(0xff00ff00, false); 
 Color blueColor = new Color(0x750000ff, true); 
  
 string pathdata = 
    "M 60 20 Q -40 70 60 120 Q 160 70 60 20 z"; 
 mat1 = new AffineTransform(); 
 mat1.Translate(30, 40); 
 mat1.Rotate(-30 * Math.PI / 180.0); 
 path = Path.FromString(pathdata); 
 //Clear the canvas with white color. 
 graphics2D.Reset(); 
 graphics2D.Clear(Color.White); 
  
 graphics2D.AffineTransform = new AffineTransform(); 
 SolidBrush brush = new SolidBrush(greenColor); 
 graphics2D.Fill(brush, path); 
 graphics2D.AffineTransform = mat1; 
  
 brush = new SolidBrush(blueColor); 
 Pen pen = new Pen(redColor, 5); 
 graphics2D.SetPenAndBrush(pen, brush); 
 graphics2D.Draw(null, path); 
 graphics2D.Fill(null, path); 
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值