I am looking for a C++ 2d(lines, circles, font, anti aliasing) rendering engine to implement into my project. I am looking for something just like GDI+, but not GDI+. GDI+ seems way too low for what I need. It would be nice if it is free, and implementation into my current Win32 C++ project is easy. I would like to thank you very much in advance.
Sincerely,
Tiberiu Brasov
Marc G
December 29th, 2005, 03:49 AM
[ moved thread ]
Marc G
December 29th, 2005, 03:51 AM
Check out AntiGrain Geometry Library (http://www.antigrain.com/).
Anti-Grain Geometry (AGG) is an Open Source, free of charge graphic library, written in industrially standard C++. AGG doesn't depend on any graphic API or technology. Basically, you can think of AGG as of a rendering engine that produces pixel images in memory from some vectorial data. But of course, AGG can do much more than that. The ideas and the philosophy of AGG are:
Anti-Aliasing.
Subpixel Accuracy.
The highest possible quality.
High performance.
Platform independence and compatibility.
Flexibility and extensibility.
Lightweight design.
Reliability and stability (including numerical stability).
migol
December 29th, 2005, 08:37 AM
hmmm... check out Allegro (http://alleg.sourceforge.net i think).
tiberiu11
December 29th, 2005, 10:12 AM
Hello guys,
thank you very much for your help. Anti Grain looks very good! I am really interested in implementing this into my Win32 API app. The only problem is that I tried, and I get linking errors, specifically a Win32 error. Do you guys know if there is a tutorial to implement Anti Grain in my current Win32 project? pretty much to draw on the HDC.
Thank you very much in advance.
Sincerely,
Tiberiu
Marc G
December 30th, 2005, 03:07 AM
Can you post some code?
The AntiGrain library works on the principle of simply including the correct headers and source files into your own project and that's it.
So you probably forget to include the correct .cpp files into your project for a feature you are using.
tiberiu11
December 30th, 2005, 03:36 PM
Marc,
I am looking at creating the simplest Win32 APP that draws a simple 2d shape(line). I have tried making my own, but I have no clue as to setting up the headers/cpp files and what functions to call in order to draw on the HDC.
Tiberiu
Marc G
December 31st, 2005, 03:44 AM
The AntiGrain library is very powerful, but unfortunately the documentation is rather small. I use AGG myself but by far don't know everything of it.
I would start by reading and playing with the example code.
Basically, you should create your pixel buffer, attach it to an AGG rendering buffer, draw on it with AGG and at the end blit the pixels to the HDC. Something like:
int iWidth = 640;
int iHeight = 480;
// Attach it to an agg rendering buffer
agg::rendering_buffer aggbuf((unsigned char*)pBmpBits, iWidth, iHeight, iWidth * 4);
// Start drawing on the aggbuf, see other agg examples
...
// Blit the hBmp to your target HDC
...
// Cleanup the bitmap
DeleteObject(hBmp);
cindyonlyone
January 2nd, 2006, 08:28 PM
For high quality 2d drawing engine,I think you should try XD++,it draws the GDI+ with GDI method,and works very fast,can be found with:
http://www.********.net/index.htm
Hope it is useful to you.
Cindy
tiberiu11
January 8th, 2006, 12:49 PM
Hello,
Thanks fot your help. I have been looking around the code, but I can't find an example of using primitive shapes like lines, rectangles, ellipses, arcs, etc. I found the regular ones, but I want to anti alias them. I think that Anti Grain calls it differently, but I want to use Anti-Aliasing on the shapes.
Also, how would I rotate them? In GDI+ there is RotateTransform. Is there such a thing here?
Thanks,
Tiberiu
Marc G
January 9th, 2006, 08:31 AM
There are quite some example at http://www.antigrain.com/demo/index.html
Also, if you want to get more information or have question about AntiGrain, I think you should subscribe to their mailinglist.
Rocky651
January 11th, 2006, 12:16 PM
I have looked carefully at Anti-Grain Geometry. It looks very interesting, but I regret I couldn't find a VERY simple example that would just draw a line...
Did some of you have the opportunity to test the AGG performance? Is it faster or slower than GDI+?
In addition, I couldn't find any clipping function, do you know if they exist?
Thanks for any help !!
Rocky
tiberiu11
January 11th, 2006, 02:58 PM
There are quite some example at http://www.antigrain.com/demo/index.html
Also, if you want to get more information or have question about AntiGrain, I think you should subscribe to their mailinglist.
Marc,
I looked at the examples. What I am trying to achieve ins't there. I got as far as drawling a line and an ellipse, but I have no clue as to choosing between a filled ellipse and just its outline. This is what I have so far:
How would I draw an anti aliased the rectangle the same way?
Tiberiu
Marc G
January 11th, 2006, 03:37 PM
The learning curve for AGG is indeed pretty steep :(
The following piece of code will draw a blue line and an ellipse with solid blue color and 5 pixel width yellow outline.
// Set color
ren.color(rgba8(255, 0, 0));
// Add line
rasterizer.add_path(stroke);
// Add solid ellipse
rasterizer.add_path(transs);
render_scanlines(rasterizer, sl, ren);
rasterizer.reset();
// Set color
ren.color(rgba8(0, 255, 255));
// ellipse outline -> stroke the ellipse with a outline of 5 pixels
strokes.width(5);
rasterizer.add_path(strokes);
render_scanlines(rasterizer, sl, ren);
Rocky651
January 11th, 2006, 05:34 PM
tiberiu11, may I ask you what you are trying to do with AGG?
I mean, what use you plan to make?
The last post you wrote makes me believe we're trying to do something similar ;-)
Rocky
tiberiu11
January 11th, 2006, 05:40 PM
tiberiu11, may I ask you what you are trying to do with AGG?
I mean, what use you plan to make?
The last post you wrote makes me believe we're trying to do something similar ;-)
Rocky
Rocky,
I am trying to use AGG to replace GDI+. AGG. is a lot faster than GDI+. In some tests it took 20ms to render some rectangles with AGG and 400ms with GDI+. I have a project that uses primitives and transformers(rotation),a nd I am trying to make it faster.
Yes, AGG is not that easy to learn,a nd the documentation is not as good as the GDI+ one. I had to ask on the forum before finding a simple example. The demos are not that good.
I will really need to find a clipping function. I think that there is one, though.
Tiberiu
tiberiu11
January 29th, 2006, 06:02 PM
The learning curve for AGG is indeed pretty steep :(
The following piece of code will draw a blue line and an ellipse with solid blue color and 5 pixel width yellow outline.
// Set color
ren.color(rgba8(255, 0, 0));
// Add line
rasterizer.add_path(stroke);
// Add solid ellipse
rasterizer.add_path(transs);
render_scanlines(rasterizer, sl, ren);
rasterizer.reset();
// Set color
ren.color(rgba8(0, 255, 255));
// ellipse outline -> stroke the ellipse with a outline of 5 pixels
strokes.width(5);
rasterizer.add_path(strokes);
render_scanlines(rasterizer, sl, ren);
Marc G,
I was wondering if you could help me out a bit. I need to clip everything to an ellipse. I have tried numerous examples, even looking at the example alpha_mask_2, but I can't figure out how to do it. Could you help me out?
I have this code here:
ellipse e(200, 200, 100, 100);
g_rasterizer.add_path(e);
ren.color(rgba8(167,116,15));
render_scanlines(g_rasterizer, g_scanline, ren);
g_rasterizer.reset();
and before that I call the function generate_alpha_mask(width, height); from example alpha_mask_2. Nothing is clipped. I think that everything stands in the varaible"ren". I do not know what to use to make it work.
Thanks,
Tiberiu
Marc G
January 30th, 2006, 02:56 AM
The Alpha_mask2 example is exactly what you need.
Can you post your entire project?
tiberiu11
January 30th, 2006, 07:10 AM
Marc,
I have discovered that I need it. I just copied the function generate_alpha_mask to my project, along with all its declarations. Unfortunately there is no clipping when I call this function. I noticed that when I render my shapes, that the third parameter of render_scanlines(rasterizer, sl, ren); is ren, while in the other examples, they have something different, based on the alpha mask. I have tried changing it, but I get only errors. So the problem currently stands at selecting the most appropriate parameter. I have tried this without any luck:
Am I going in the right direction? How could I post the entire project here? Just zip it up and attach it as an attachment?
Thanks,
Tiberiu
Marc G
January 30th, 2006, 10:09 AM
How could I post the entire project here? Just zip it up and attach it as an attachment?
Yes, just put it in a zip file, but remove temporary files like .pdb files, .ncb, ... and attach it to your reply.
Chenchu
July 3rd, 2006, 06:06 PM
Can u please tell me how to draw a polyline in microsoft windows using these libs?
Thanks,
Chenchu
Marc G
July 17th, 2006, 03:29 PM
You can use the Primitives Renderer (http://www.antigrain.com/doc/basic_renderers/basic_renderers.agdoc.html#toc0014). You can also use a path_storage and use move_to and line_to.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.