Recent

Author Topic: Graphic Library  (Read 94891 times)

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Graphic Library
« on: August 03, 2009, 04:40:54 am »
Some people like Computer Graphics and some people feel happy when they see a good software made in Object Pascal (OP).

Both of them could like to know I have possibly made the more poweful drawing library ever coded from scratch in Object Pascal. It's part of Picture to People project.

Several example images of the library in action can be found here:
http://www.picturetopeople.org/dev/maccala_features.html.

I have large experience with C, C++ and several other languages, but I'm very satisfied with OP. It let me work with pointers and other low level structures and it is strongly typed too. It's the perfect combination.

If you have suggestions for this project, I invite you to join the Picture to People discussion group. There is a link for it in the bottom part of the page accessed through the url above.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Graphic Library
« Reply #1 on: August 12, 2009, 01:56:59 pm »
Maybe it would be a good idea to add it to the Lazarus wiki, and make a wiki page for it with a short description, a short usage example, download like, license information, etc. You can add it to this page and there make a link to a more complete page if you want to write more about it:

http://wiki.lazarus.freepascal.org/Projects_using_Lazarus

This way it will be easier to find this project in the future, and also going into the website you linked I couldn't find information about license, how to use the library, etc. Maybe it's closed source?

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Graphic Library
« Reply #2 on: August 12, 2009, 02:59:25 pm »
Your website is not very good when it comes to details. No download link, no code examples, no mention if it is open source or commercial, no price - if it is commercial, no license information.

The library looks interesting, but without the details above how to I get it?
« Last Edit: August 13, 2009, 12:32:44 am by Graeme »
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

LinPix

  • New Member
  • *
  • Posts: 17
Re: Graphic Library
« Reply #3 on: August 12, 2009, 10:01:43 pm »
Hello,
It seems to be a really nice library :o ...   but I agree with Graeme and Sekel. There's no detail enough, no code exemples,... Is it going to be OpenSource ? (I hope so ;) ) When will you release it ?

Also I don't really understand the difference between Maccala and Pixsycho. Are they both written in FreePascal ? Why don't you join both to create a more complete library ?

Anyway congratulation for your library  :) .

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Graphic Library
« Reply #4 on: August 14, 2009, 03:56:23 pm »
Yes, both of my main libraries were coded in Free Pascal from scratch. About being just one library, you can almost consider like that because one could easily use them together (there just are more "uses" to make). In a software engineering sense, this encapsulation in two parts is very important for many reasons, but most of people consider this kind of discussion very bothering.

My excuses if some informations were unclear. I thought the absense of code examples and license informations should be enough to know I'm not releasing it to programmers nowadays. I didn't intend to create wrong expectations.

At least you can consider my post as a good example and a celebration to Object Pascal power, since my very long experience shows that 95% of serious professional Computer Graphics softwares are made in C or C++.

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Graphic Library
« Reply #5 on: August 19, 2009, 07:40:34 am »
Now the same page above has some more examples about the power my library already has.

I consider the last example particularly interesting. It shows text transformations very beyond you can usually find in a font engine. It's the main advantage when you make things from scratch: you can go where your imagination can take you.

LinPix

  • New Member
  • *
  • Posts: 17
Re: Graphic Library
« Reply #6 on: August 20, 2009, 01:53:39 pm »
Nice ones  ;) , keep working ! You're doing impressive staff  :) . I've a question ; Are the other effects and tool of Picture to People written in FreePascal ?
Bye .

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Graphic Library
« Reply #7 on: August 20, 2009, 03:56:12 pm »
Sure. Everything made from scratch in Object Pascal (Free Pascal).

I have extended the language utilities with a big amount of types.

Many of them are general use ones, like:
- complex numbers;
- several kinds os lists;
- several kinds of trees;
- multidimensional pyramids;
- quantizators;
- etc.

Other types usually are Computer Graphics strict:
- supersamplers;
- rasterizers;
- texturizers;
- color spaces;
- gradients;
- polylines;
- curves;
- shapes;
- paths;
- images;
- layers;
- a lot more ...

Having all of this in hand, my Object Pascal is like a "Computer Graphics aware" programming language, so I feel confortable to make CG libraries and applications using that.

Since Computer Graphics is a very huge area, there still are many many types and algorithms to create, but it's ok. I'm young yet. Next 3 or 4 years Picture to People possibly will achieve kind of 3 million lines of code made from scratch.

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Graphic Library
« Reply #8 on: September 13, 2009, 01:02:04 am »
Using Maccala and Pixsycho a have created a new feature for Picture to People project.

I have released a highly configurable tool to draw liquid text. The input font can be distorted in a vector based way to improve the realistic appearance of the liquid. This distortion can go from a rounding of sharp corners to a much more advanced "liquifying".

It's a very good example concerning what can be done when you have your own font engine and vector based library.

There are two examples in the main page (http://www.picturetopeople.org/) and several ones in the tool page (http://www.picturetopeople.org/liquid_text.html).

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Graphic Library
« Reply #9 on: September 13, 2009, 10:25:54 pm »
Hi,
I see you are familiar with computer graphics and I need a little help with drawing of anti-aliased curves on TCanvas. I just have procedure to draw anti-aliased straight lines (however it needs tweak, it 90% works). Now I need also curves, like sinus etc. My idea is to make procedure for anti-aliased pen and repeat it point-to-point until curve is not finished.
Definition of my pen is like this:
cAAPenW5 : array[-2..2,-2..2] of Single = ((0.14,0.77,0.97,0.77,0.14),(0.77,1,1,1,0.77),(0.97,1,1,1,0.97),(0.77,1,1,1,0.77),(0.14,0.77,0.97,0.77,0.14));
For example this array defines shape of pen, as you see it's circle shape with diameter 5, numbers mean intensity, 1=full replace background with my color, 0=full transparency.
My idea is: clear TCanvas, then draw x and y axes normally via Canvas.Line procedures, and finally draw curves point-ti-point.
I really need no code, I can write it myself :-), only help if I'm on the right way.
Thanks.
       
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Graphic Library
« Reply #10 on: September 14, 2009, 01:49:53 am »
Hi,
I see you are familiar with computer graphics and I need a little help with drawing of anti-aliased curves on TCanvas. I just have procedure to draw anti-aliased straight lines (however it needs tweak, it 90% works). Now I need also curves, like sinus etc. My idea is to make procedure for anti-aliased pen and repeat it point-to-point until curve is not finished.
Definition of my pen is like this:
cAAPenW5 : array[-2..2,-2..2] of Single = ((0.14,0.77,0.97,0.77,0.14),(0.77,1,1,1,0.77),(0.97,1,1,1,0.97),(0.77,1,1,1,0.77),(0.14,0.77,0.97,0.77,0.14));
For example this array defines shape of pen, as you see it's circle shape with diameter 5, numbers mean intensity, 1=full replace background with my color, 0=full transparency.
My idea is: clear TCanvas, then draw x and y axes normally via Canvas.Line procedures, and finally draw curves point-ti-point.
I really need no code, I can write it myself :-), only help if I'm on the right way.
Thanks.
       

I think I understood your idea: draw the circle at every point of your curve. Most beginners start making thick lines this way.

First of all, I never ever use Single type for anything. I use integer calculations always I can, but Computer Graphics can't exist without floating math. When I really need a floating point (FP) number, I always use Double. Surprisingly to beginners, Single type can NOT represent correctly a big amount of FP numbers, even with only 2 decimal positions. For your intention in particular, it's enough, but keep in mind: generally speaking, for algorithms with cascade calculations, using Single is a very good way to propagate "sub-decimal" rounding errors, sometimes generating VERY wrong results.

Second, you can get it done this way taking advantage of circle simetry and precalculated border antialiasing, but it's a poor solution because:
- you need to have a precaculated circle for each thickness you accept. In other words, this solution is not scalable;
- you can't represent correctly fractionary positions;
- the more thicker your curve, the more useless pixel reseting you get in circles overlap regions; if the thickness is big, the overhead will be too high;
- since you want antialiasing, it doesn't work that simple for curves with self-overlapping (can you see why?);
- making this way, it's impossible to draw with native transparency (can you see why?);

Nowadays, the canonical professional way to solve "thick curves drawing" problem is like that: a thick curve is a closed curve to be filled (in fact, sometimes it can be more than one curve if you don't need native alpha). Professional rasterizers tackle all these kind of problems like "filling tasks".

The closed curve is calculated using the normals of the original thin curve in strategic positions. You need to take care about inflection points to not lose the topological properties of the original curve. If you have strong Math knowledge, the hard part is to create a general, fast, robust, scalable, "antialiasing-aware" filling algorithm.
« Last Edit: September 15, 2009, 03:17:34 am by leocda »

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Graphic Library
« Reply #11 on: October 05, 2009, 03:19:21 pm »
I was tired of the same old carving effects based on some variation of directional Laplacian, so I created a much more complex and realistic one.

Some of its main features:
- suitable to photos;
- tries to be realistic without to be to much destructive concerning spacial information;
- tries to keep the original colors as much as possible.

This feature is mostly based on Pixsycho library (instead of Maccala).

It's here: http://www.picturetopeople.org/photo_stone.html

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Graphic Library
« Reply #12 on: October 19, 2009, 12:19:00 am »
Now Maccala offers generic, hierarchical transformations for paths, curves, shapes, etc. This feature is configurable and the tranformation can be arbitrary: it can be a function defined by the programmer in a higher level.

The last image from Maccala's page now is a simple example about what I'm talking about.

Despite this solves a hard problem once for all, now there are new possibilities. The programmer can easily define stack based, cumulative arbitrary transformations over vector based entities.

I think about developing an interpreted language to very high level Computer Graphics programming someday in future. It's the kind of feature can help to implement this language in a elegant way.

michaelp

  • Newbie
  • Posts: 5
Re: Graphic Library
« Reply #13 on: November 05, 2009, 04:08:20 am »
I joined here just because of this thread.

This graphic software is inspiring. You were able to develop from the most low level tasks to very high level results.

If just one guy was able to make this, the used tool must be easy and productive.

If all of it was made with just one tool, such tool must be powerful.

A such big, complex and eye catching software made me believe Lazarus deserves a try.

Congratulations to leocda and to Lazarus team.  8)

michaelp

  • Newbie
  • Posts: 5
Re: Graphic Library
« Reply #14 on: November 17, 2009, 02:39:22 am »
I was looking around ...

Do you use TLazIntfImage to draw?

 

TinyPortal © 2005-2018