AGG是一个轻量、灵活、可靠的图形算法库,AGG各部分之间是松耦合的,也即是说各部分可以单独使用。

The primary goal of Anti-Grain Geometry is to break this ancient as mammoth's manure tradition and show you the beauty of stability, lightness, flexibility, and freedom. The basic concepts can seem not very conventional at the beginning, but they are very close to the ones used in STL. But there's a big difference too. STL is a general C++ tool while AGG is C++ graphics. You usually use STL in your applications directly as a convenient toolkit. I wouldn't say it's a good idea to use AGG in the very same way. A good idea is to create a lightweight, problem oriented wrapper over AGG to solve your particular tasks. How can that be different from that very GDI+ then? The first thing is that you have total control upon that wrapper. Anti-Grain Geometry just provides you a set of basic algorithms and flexible design with the minimum of implicit or explitit dependencies. You and only you define the interface, conversion pipelines, and the form of output. You can even simulate a part of any existing graphical interface. For example, you can use AGG rasterizer to display graphics on the screen and direct Windows GDI calls for printing, incorporating it into a single API. Not convincing? Look at the quality of rendering in GDI+ and AGG

AGG是跨平台的

But most of all, your applications become absolutely portable, if your design is smart enough. AGG can be also a tool to combine different outputs in a uniform API. Particularly, you can use AGG to generate raster images on the server side in your Web-Based applications. And it all can be cross-platform!

AGG算法采用反走样算法和亚像素精度必须联合使用,中图为只采用了反锯齿的效果,右图为两者结合的效果。不仅提高了线条的光滑度,而且对于一些下小对象细节的表现有较大的优势。

Anti-Aliasing is a very well known technique used to improve the visual quality of images when displaying them on low resolution devices,But the point is not only in Anti-Aliasing itself. The point is we can draw primitives with Subpixel Accuracy. It's especially important for the visual thickness of the lines. First, let us see that even with simple Bresenham line interpolator we can achieve a better result if we use Subpixel Accuracy. The following picture shows enlarged results of the simple Bresenham interpolator.

AGG的操作均是基于输出设备的屏幕坐标,AGG 由于支持亚像素精度,AGG的坐标使用double表示。AGG不嵌入设备坐标到世界坐标的转换。AGG提供Transformer(用户定义),用于用户视图到设备视图的转换。

Basically, AGG operates with coordinates of the output device. On your screen there are pixels. But unlike many other libraries and APIs AGG initially supports Subpixel Accuracy. It means that the coordinates are represented as doubles, where fractional values actually take effect. AGG doesn't have an embedded conversion mechanism from world to screen coordinates in order not to restrict your freedom. It's very important where and when you do that conversion, so, different applications can require different approaches. AGG just provides you a transformer of that kind, namely, that can convert your own view port to the device one. And it's your responsibility to include it into the proper place of the pipeline. You can also write your own very simple class that will allow you to operate with millimeters, inches, or any other physical units.

AGG 设计为一组松散组织的算法模版,组件方便组合。甚至AGG可以只完成某一部分的工作,其他工作交由其他显示库实现。

Anti-Grain Geometry is designed as a set of loosely coupled algorithms and class templates united with a common idea, so that all the components can be easily combined. Also, the template based design allows you to replace any part of the library without the necessity to modify a single byte in the existing code.

AGG does not dictate you any style of its use, you are free to use any part of it. However, AGG is often associated with a tool for rendering images in memory. That is not quite true, but it can be a good starting point in studying. The tutorials describe the use of AGG starting from the low level functionality that deals with frame buffers and pixels. Then you will gradually understand how to abstract different parts of the library and how to use them separately. Remember, the raster picture is often not the only thing you want to obtain, you will probably want to print your graphics with highest possible quality and in this case you can easily combine the “vectorial” part of the library with some API like Windows GDI, having a common external interface. If that API can render multi-polygons with non-zero and even-odd filling rules it's all you need to incorporate AGG into your application. For example, Windows API PolyPolygon perfectly fits these needs, except certain advanced things like gradient filling, Gouraud shading, image transformations, and so on. Or, as an alternative, you can use all AGG algorithms producing high resolution pixel images and then to send the result to the printer as a pixel map

AGG渲染过程。AGG可以将渲染步骤中的单步抽出来和其他引擎混用,例如使用AGG光栅化,再由其他引擎进行渲染。

  • 坐标源Vertex Source is some object that produces polygons or polylines as a set of consecutive 2D vertices with commands like “MoveTo”, “LineTo”. It can be a container or some other object that generates vertices on demand.
  • 坐标变换Coordinate conversion pipeline consists of a number of coordinate converters. It always works with vectorial data (X,Y) represented as floating point numbers (double). For example, it can contain an affine transformer, outline (stroke) generator, some marker generator (like arrowheads/arrowtails), dashed lines generator, and so on. The pipeline can have branches and you also can have any number of different pipelines. You also can write your own converter and include it into the pipeline.
  • 栅格化Scanline Rasterizer converts vectorial data into a number of horizontal scanlines. The scanlines usually (but not obligatory) carry information about Anti-Aliasing as “coverage” values.
  • 渲染Renderers render scanlines, sorry for the tautology. The simplest example is solid filling. The renderer just adds a color to the scanline and writes the result into the rendering buffer. More complex renderers can produce multi-color result, like gradients, Gouraud shading, image transformations, patterns, and so on.
  • 缓存Rendering Buffer is a buffer in memory that will be displayed afterwards. Usually but not obligatory it contains pixels in format that fits your video system. For example, 24 bits B-G-R, 32 bits B-G-R-A, or 15 bits R-G-B-555 for Windows. But in general, there're no restrictions on pixel formats or color space if you write your own low level class that supports that format.

Anti-Grain Geometry 概述的更多相关文章

  1. WPF 中的形状和基本绘图概述

    本主题概述如何使用 Shape 对象绘图. Shape 是一种允许您在屏幕中绘制形状的 UIElement 类型. 由于它们是 UI 元素,因此 Shape 对象可以在 Panel 元素和大多数控件中 ...

  2. WPF学习之路初识

    WPF学习之路初识   WPF 介绍 .NET Framework 4 .NET Framework 3.5 .NET Framework 3.0 Windows Presentation Found ...

  3. [WPF] 如何实现文字描边

    1. 前言 WPF 的 TextBlock 提供了大部分常用的文字修饰方法,在日常使用中基本够用.如果需要更丰富的表现方式,WPF 也提供了其它用起来复杂一些的工具去实现这些需求.例如这篇文章介绍的文 ...

  4. OpenGL官方教程——着色器语言概述

    OpenGL官方教程——着色器语言概述 OpenGL官方教程——着色器语言概述 可编程图形硬件管线(流水线) 可编程顶点处理器 可编程几何处理器 可编程片元处理器 语言 可编程图形硬件管线(流水线) ...

  5. UnrealEngine4 PBR Shading Model 概述

      虽然是概述,但内容并还是有些多,写上一篇PBR概念概述后,也在考虑怎么继续下去,最后还是觉得先多写一些东西再慢慢总结,所以还是尽量把这些年PBR相关的Paper精粹沉淀下来吧.     因为UE4 ...

  6. ArcGIS API for Silverlight 编辑Geometry

    概述 ArcMap的编辑功能是非常强大的,ArcEngine编写的CS程序也可以用到ArcMap中提供的编辑功能,那么ArcGIS API forSilverlight针对Geometry的编辑提供了 ...

  7. 开源虚拟化KVM(一)搭建部署与概述

    一,KVM概述 1.1 虚拟化概述 在计算机技术中,虚拟化意味着创建设备或资源的虚拟版本,如服务器,存储设备,网络或者操作系统等等 [x] 虚拟化技术分类: 系统虚拟化(我们主要讨论的反向) 存储虚拟 ...

  8. 转:ArcGIS API For JavaScript官方文档(二十)之图形和要素图层——①Graphics概述

    原文地址:ArcGIS API For JavaScript官方文档(二十)之图形和要素图层——①Graphics概述 ArcGIS JavaScript API允许在地图上绘制graphic(图形) ...

  9. You can Solve a Geometry Problem too (hdu1086)几何,判断两线段相交

    You can Solve a Geometry Problem too Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3276 ...

随机推荐

  1. Xcode 向6.0以后版本添加iOS开发空白模板

    打开finder,找到应用程序,找到xcode 右键显示包内容.按照如下目录进行查找:Contents ▸ Developer ▸ Platforms ▸ iPhoneOS.platform ▸ De ...

  2. idea14使用maven创建web工程

    参考博客:http://geeksun.iteye.com/blog/2179658 http://www.bubuko.com/infodetail-387387.html ------------ ...

  3. PAT-乙级-1042. 字符统计(20)

    1042. 字符统计(20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 请编写程序,找出一段给定文字中出现最 ...

  4. Cloud Insight 和 BearyChat 第一次合体,好紧张!

    说到 ChatOps 我们可能立刻想到是 Slack(啥?没听过?哦!),但是由于国内网络和语言的问题你可能无法拥有很好的体验了.那就把目光转回国内吧,国内的话就不得不提到 BearyChat 等 C ...

  5. Codeforces Round #242 (Div. 2) A~C

    题目链接 A. Squats time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputou ...

  6. POJ 2318 TOYS && POJ 2398 Toy Storage(几何)

    2318 TOYS 2398 Toy Storage 题意 : 给你n块板的坐标,m个玩具的具体坐标,2318中板是有序的,而2398无序需要自己排序,2318要求输出的是每个区间内的玩具数,而231 ...

  7. ASP.NET 访问 MySql

    1. 首先需要安装mysql, 脚本之家下载地址: http://www.jb51.net/softs/2193.html 或者去mysql.com官网都可以,一路next,安装好后,有个简单配置,提 ...

  8. 多线程 (五)NSOperation

    NSOperation是对GCD的分装,OC语言,更简单方便 NSOperation和NSOperationQueue一起使用也能实现多线程编程 基本步骤: 将操作封装到一个NSOperation对象 ...

  9. MyBatis的动态SQL操作--删除

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUYAAAC/CAIAAAANX+LCAAAYvElEQVR4nO2dWWycV9nHDyC6UEGBGy

  10. 分布式搜索Elasticsearch——QueryBuilders.matchPhrasePrefixQuery

    注:该文项目基础为分布式搜索Elasticsearch——项目过程(一)和分布式搜索Elasticsearch——项目过程(二),项目骨架可至这里下载. ES源代码中对matchPhrasePrefi ...