Merging Anti-Grain Geometry separately as lib in PB

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Yogi Yang
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Dec 11, 2005 2:19 pm

Merging Anti-Grain Geometry separately as lib in PB

Post 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.
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

Hmmm... Interesting idea... It's will be useful, i think.
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post 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)
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post 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.
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post 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 !
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

Sure ! Is somebody voluntary? :lol:
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

KarLKoX wrote:Sure ! Is somebody voluntary? :lol:
I search 8) ...
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Yogi Yang
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Dec 11, 2005 2:19 pm

Post 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)
mp303

Post 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?
mp303

Post 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 ;-)
Yogi Yang
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Dec 11, 2005 2:19 pm

Post 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.
Post Reply