C ++ vector graphics library series (rpm)

Transfer: http://blog.sina.com.cn/s/blog_4265e1760100lg03.html 



     The main content of this chapter is to explain the series of vector graphics library compiler, development and use. Not for what they do around too much description, such as performance and contrast. All my blog articles are all individual originality, and all rights are reserved. I am not the original content will be marked "reprint" word. So if you need to reprint, please indicate the source, thank you.

Vector graphics, this is a very familiar, but it makes one feel strange things. Familiar because heard so much, Flash applications on a range of vector graphics technology, to allow for a full-frame animated picture file size compared to streaming media format is much smaller, and lossless image quality, which is at an early stage the rapid spread of the Internet open to allow the user to accept the basis of (the file size is not too large, otherwise no one would have thought a little bit of waiting to download ......). Strange it is because a lot of people engage in a number of years Win32 software development, over and over again is that MFC / GDI / Socket ......, and when they did not seem to matter vector graphics technology.

    But have to admit, Win32 GDI is both in speed and in function, they are already out of the era, so GDI full of confidence out. Some people may not really know the relationship between GDI and GDI, I often heard some say with the GDI program to replace GDI. In fact the situation is: GDI is a set of C libraries, however, the underlying point is still so inextricably linked with the GDI. If the GDI driver can be obtained based on the acceleration on different display devices, then, GDI can only be based on different computing speed of CPU platforms to obtain accelerated - because he is a hardware-independent C graphics library, a large number of graphics algorithms is its core content.

     Although GDI has been out for some years, but it seems not many users (at least I did not see my friends what's used). I worked this issue did some research, it was said that he used the GDI, but it feels like a very slow speed, might as well write their own code. It was also reported feeling no access, do not drawing software every day. Others say the habit of using GDI, GDI with the awkward did not find what advantages ............ Indeed, these feelings I have ever existed, so I am not too fond of using GDI, speed is indeed not too fast - at least I do their own GDI drawing board, in my computer 1920 * 1080 resolution full-screen graphics double buffer is filled continuously when the performance really is not high (already optimized as much as possible). If ColorMatrix then on, then, my poor have been with a quad-core machine at the same, it is difficult to run.

     So, I need to introduce you to some new Daniel, in fact, is not anything new, and some are N-old brand, steady work for many years, for many of the projects. These large cattle with the GDI functions are very similar to (or will generally be more of something), GDI function similar meaning there, they can be achieved, some of them, GDI also can do it. But in terms of performance or image quality but each has a different performance. Such as the famous Cairo, AGG, and Google put out Skia (three from the basic terms of visibility can be regarded as the three pillars, huh, huh), and there are some lesser-known (unknown does not mean he is not strong), such as commercial library DISLIN, as well as PHP with GD, and even some contact does not close CImg (the exact terms should belong graphics library, rather than vector graphics library, but many sites are listed like to put them together strictly speaking, it is not well understood).

However, the main purpose of this chapter in the series, is that the amount of graphics library, so the excess is not to say that we from Cairo to begin with.

     Famous Cairo, the official website: http://www.cairographics.org, one of the open source community project quality has basically become a standard graphics under Linux. Firefox is a drawing of the bottom of Cairo. Cairo about something more, Google it, will say more detail than I, huh, huh.

     AGG, the official website: http://www.antigrain.com/, is relatively well-known vector graphics library, and just see download on the official station of the Demo, will be a little cool feeling :). AGG use class is not like a bunch of close ties with Cairo biggest difference, it is weakly coupled state, and a lot of use of the C template technology, from the user's point of view, the difficulty is not a small AGG, because he just gives you a series of function blocks, how in combination, also all in the user's own, and Cairo provides a relatively simple C function interface. So also it appeared AggPlus project, his goal is to AGG package once, and is similar to that used fake GDI interface. If you are using AggPlus then there GDI relevant experience it is easy to use, but it looks like performance will have no small decline.

     About AGG Cairo and performance comparison, Google is able to find details about the content, but simply say, drawing on the speed aspect of view, my experience is faster than the speed of Cairo AGG, especially in Cairo has been out of 1.9 version, a larger speed. AGG is completely dependent on C, without hardware acceleration. He is a more intelligent place in the grating when using integer arithmetic instead of floating-point operations. AGG official website claims that it generates high-quality images than GDI, from my actual experience is indeed the case. Google can also find examples of this, the department say no more.

Finally Skia. In fact Skia is meant to be a commercial project, so that after the Google acquisition of open source to the official website: http://code.google.com/p/skia/, is authorized to form the Apache 2.0, this authorization form relatively cool, huh, huh. Skia speed and not under AGG Cairo, and interface complexity in the form of relatively little higher Cairo, easier than AGG. Function is basically not much difference. But if the definition of code words to say, these three projects also Skia best, I will soon be familiar with the code and its Skia I need to make changes. So now I personally prefer the Skia. From Cairo to AGG then go Skia, now have been using the Skia.

     In these vector graphics library, there is something we generally support but GDI does not have, such as PostScript or support for SVG, such as we can not cross-platform but GDI and so on. In addition, Cairo there is an obvious advantage of some other libraries do not have, is the large amount of support for Cairo's Backends, in fact, BackBuffer or something called DrawTarget of Cairo can be drawn directly to the content of the painting to the Win32 GDI Bitmap / on numerous Target DC, PDF, SVG, PostScript, OpenGL, Printer, etc., which is a major feature of Cairo, reportedly also an important reason to choose Firefox in Cairo. If your application is the need to draw graphical content to a variety of different Target when selecting Cairo can indeed save a lot of things.

     Well, call it a Luantan. Benpian is opening, the next, we will work together to try to use VC to compile Cairo (1.8.x version), which is used by all major premise Well, after all, with VC do software development on Win32 or majority. But the compiler Cairo let a lot of people ran into problems. So let's solve the compilation of issues, including the then next I plan to explain Skia compiled on the VC. Compile a Lib / DLL, use C ++ thing to be free vector graphics library series (1) - vector graphics library Luantan

Guess you like

Origin www.cnblogs.com/gispathfinder/p/11056671.html