Page 1 of 1

Merging Anti-Grain Geometry separately as lib in PB

Posted: Sat Nov 04, 2006 1:30 pm
by Yogi Yang
pure basic is dynamic but it does not contain a good 2D graphic library which has got enought features to be usable easily.

I recently ran into an Open Source Library called Anti-Grain Geometry.

It is fantastic. It is robost (at least I feel so from various samples).

http://www.antigrain.com/
Brief Overview
Yet Another Invention of the Wheel

Anti-Grain Geometry (AGG) is a general purpose graphical toolkit written completely in standard and platform independent C++. It can be used in many areas of computer programming where high quality 2D graphics is an essential part of the project. For example, if you render 2D geographic maps AGG is a must. AGG uses only C++ and standard C runtime functions, such as memcpy, sin, cos, sqrt, etc. The basic algorithms don't even use C++ Standard Template Library. Thus, AGG can be used in a very large number of applications, including embedded systems.

On the other hand, AGG allows you to replace any part of the library, if, for example, it doesn't fit performance requirements. Or you can add another color space if needed. All of it is possible because of extensive using of C++ template mechanism.

Anti-Grain Geometry is not a solid graphic library and it's not very easy to use. I consider AGG as a “tool to create other tools”. It means that there's no “Graphics” object or something like that, instead, AGG consists of a number of loosely coupled algorithms that can be used together or separately. All of them have well defined interfaces and absolute minimum of implicit or explicit dependencies.
There is a Page Layout software created using Anti-Grain Geometry called Creative Docs.NET. The software is worth using by itself. I think this is enough proof to include a library of Anti-Grain Geometry in PB.

http://www.creativedocs.net.

Posted: Sat Nov 04, 2006 5:42 pm
by Chrono Syndrome
Hmmm... Interesting idea... It's will be useful, i think.

Posted: Sat Nov 04, 2006 6:20 pm
by Rescator
It's C++ not C so making it part of PureBasic would be a issue.
Second, it's GPL licensed, so it can not be used with PureBasic anyway.
(and unless you plan to give away the source code for your games or similar it's not much use for commercial software either)

Posted: Sat Nov 04, 2006 7:27 pm
by KarLKoX
There are no problem using C++ code with PB.
The real problem with this (excellent) lib is that it is not a true lib but a collection of code for a special task so making a usuable lib for PB will need a lot of work !
It is pity that the author didn't think making a global object wich inherit from the task needed by the coder.

Posted: Sun Nov 05, 2006 12:42 pm
by Chrono Syndrome
The real problem with this (excellent) lib is that it is not a true lib but a collection of code for a special task so making a usuable lib for PB will need a lot of work !
I think it's worth-while work !

Posted: Sun Nov 05, 2006 1:12 pm
by KarLKoX
Sure ! Is somebody voluntary? :lol:

Posted: Mon Nov 06, 2006 9:45 am
by Chrono Syndrome
KarLKoX wrote:Sure ! Is somebody voluntary? :lol:
I search 8) ...

Posted: Mon Nov 06, 2006 10:25 am
by Yogi Yang
KarLKoX wrote:There are no problem using C++ code with PB.
The real problem with this (excellent) lib is that it is not a true lib but a collection of code for a special task so making a usuable lib for PB will need a lot of work !
It is pity that the author didn't think making a global object wich inherit from the task needed by the coder.
You are right! The author did not see fit to make it into a global object but someone else did and has done so but :( in Delphi.

If this is converted sucessfully in a usable Lib there are many applications for such a thing like :D
- As reporting tool with Print Preview and such support
- Vector Drawing similar to what is available in software like CorelDRAW, Xara X, etc.
- Visio like Flow Chart creating software
- Equation Editor for creating true mathematically equations
- Desktop Publishing software
- Logo Creators
My worthy Ideas! wrote:The aproach to take here would be to create a wrapper around these algorithms or functions and then implement highlevel objects for a specific task (like those mentioned above)

Posted: Thu Jan 17, 2008 10:20 am
by mp303
this is very interesting!

here's a thought:

don't some C++ compilers use C as an intermediary language? That is, the C++ compiler generates C code, which is then compiled by a regular C compiler.

afaik, a lot of compilers work that way?

and if so, wouldn't it be possible to snag the intermediary C code and generate an interface for PureBasic from that?

Posted: Thu Jan 17, 2008 10:27 am
by mp303
googled for a bit - here's a C++ compiler that outputs standard C code:

http://www.comeaucomputing.com/

this would work - in theory. if you could get the antigrain source to build under this compiler -- I'm sure that would take some tweaking.

and I'm not sure what the output would look like - this C code would not be optimized for human-friendliness, so I don't know what a translated C++ API would like like in C, it might be completely illegible or clunky and impossible to program with...

my C++ skills are too limited to proceed with something like this, so the ball's in your court ;-)

Posted: Sat Jan 19, 2008 8:03 am
by Yogi Yang
mp303 wrote:googled for a bit - here's a C++ compiler that outputs standard C code:

http://www.comeaucomputing.com/

this would work - in theory. if you could get the antigrain source to build under this compiler -- I'm sure that would take some tweaking.

and I'm not sure what the output would look like - this C code would not be optimized for human-friendliness, so I don't know what a translated C++ API would like like in C, it might be completely illegible or clunky and impossible to program with...

my C++ skills are too limited to proceed with something like this, so the ball's in your court ;-)
Thank you for this info but unfortunately I don't know the C of C or C++ so I would not even dream of touching this. I am just suggesting so that someone who is well versed in C/C++ will come forward and convert it to PB.

I have tried the Delphi version & studied its Demos. It seems to require a lot of work to use but the end results are just unbelievably stunning.