Agg-SharpAgg 的 .NET 移植

联合创作 · 2023-09-29 16:32

Agg-Sharp 是 Agg 的 .NET 移植。AGG 是一个开源的二维图形引擎。它提供一套结合了亚像素(subpixel accuracy)技术与反走样(anti-aliasing)技术的图形算法,实现高效率、高质量的二维图形处理功能。AGG 的另一个特点在于它极大的灵活性。其作者将它描述为“创建其它工具的工具”。AGG 提供一系列松耦合的算法,而且其所有类均采用模板(template)进行描述,开发者可以自由地组合、改写、替换其中部分或全部算法,以满足其具体的图形操作需求。

示例代码:

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();
		}
	}
}
浏览 6
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报