Agg-SharpAgg 的 .NET 移植
Agg-Sharp 是 Agg 的 .NET 移植。AGG 是一個開源的二維圖形引擎。它提供一套結(jié)合了亞像素(subpixel accuracy)技術(shù)與反走樣(anti-aliasing)技術(shù)的圖形算法,實現(xiàn)高效率、高質(zhì)量的二維圖形處理功能。AGG 的另一個特點在于它極大的靈活性。其作者將它描述為“創(chuàng)建其它工具的工具”。AGG 提供一系列松耦合的算法,而且其所有類均采用模板(template)進行描述,開發(fā)者可以自由地組合、改寫、替換其中部分或全部算法,以滿足其具體的圖形操作需求。
示例代碼:
using MatterHackers.Agg.UI;
using System;
namespace MatterHackers.Agg
{
public class HelloWorld : SystemWindow
{
public HelloWorld()
: base(640, 480)
{
// add the text widget to show our message
AddChild(new TextWidget("Hello World", 320, 240, justification: Font.Justification.Center));
ShowAsSystemWindow();
}
// and just for fun lets also draw a circle
public override void OnDraw(Graphics2D graphics2D)
{
graphics2D.Circle(320, 100, 50, RGBA_Bytes.Blue);
base.OnDraw(graphics2D);
}
[STAThread]
public static void Main(string[] args)
{
new HelloWorld();
}
}
}評論
圖片
表情
