Recent

Author Topic: 2D Flowchart  (Read 19825 times)

janvb

  • Jr. Member
  • **
  • Posts: 76
2D Flowchart
« on: July 27, 2014, 02:45:29 pm »
hi,

I am new to Lazarus but have desided to give it a go on creating an advanced 2D flow-charting application. I have done similar in C++, but moved to C# because GUI work in C++ is a complicated story. C# works fine except for performance. I have done a few performance/flicker tests on TCanvas and like what I see.

What I am wondering is if anyone can point me to an existing library with source code that could be a good starting point?

What I will do in the first place is to create a generic diagram component specialized on drawing flowchart style diagrams with symbols, linked lines, scrolling, zooming etc.

What I notice from the graphics I have done is that I will need to add smoothing techniques and gradient colors.

One of my questions is if I would be better off using OpenGL as a 2D Canvas?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8108
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: 2D Flowchart
« Reply #1 on: July 27, 2014, 03:56:43 pm »
Quote
What I am wondering is if anyone can point me to an existing library with source code that could be a good starting point?
There used to be DrawObjectsExtended, but it seems to have gone. You might want to try porting components used by this software, though.
Quote
One of my questions is if I would be better off using OpenGL as a 2D Canvas?
Up to you, it could give hardware acceleration but I don't think that's important for a flowchart app.

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: 2D Flowchart
« Reply #2 on: July 27, 2014, 05:15:06 pm »
simplegraph can be extended to support any type of diagram. No much has been done on that objective though.
http://sourceforge.net/projects/evssimplegraph/
The main difference bwetween simplegraph and DrawObjects is that simplegraph has everything encapsulated in a single container control  instead of multiple controls that can be used inside any container (most probable candidate is the tscrollbox).
« Last Edit: July 27, 2014, 05:21:32 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

janvb

  • Jr. Member
  • **
  • Posts: 76
Re: 2D Flowchart
« Reply #3 on: July 27, 2014, 09:20:07 pm »
Thanks for the help folks.

This is kind of a strange experience after 3 years with C# - I accidentally wrote C#/VB syntax and it works.

(Sender as TControlBox).Canvas...








Leledumbo

  • Hero Member
  • *****
  • Posts: 8108
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: 2D Flowchart
« Reply #4 on: July 28, 2014, 03:43:55 am »
Thanks for the help folks.

This is kind of a strange experience after 3 years with C# - I accidentally wrote C#/VB syntax and it works.

(Sender as TControlBox).Canvas...
Object Pascal has it first, remember C#/.NET architect is a former Borland employee who's responsible for Delphi, and previously, Turbo Pascal? He took the concept when M$ bought him, applied M$ism and Cism to it, and tadaaa: C# and .NET framework were born.

janvb

  • Jr. Member
  • **
  • Posts: 76
Re: 2D Flowchart
« Reply #5 on: July 28, 2014, 05:03:17 pm »
Object Pascal has it first, remember C#/.NET architect is a former Borland employee who's responsible for Delphi, and previously, Turbo Pascal? He took the concept when M$ bought him, applied M$ism and Cism to it, and tadaaa: C# and .NET framework were born.

Yeah I notice that it is several things that are similar with C#. I am tempted by OpenGL, but will look into that later. I grabbed a TScrollBox and implemented a TFlowChart. A few rounds with crashing IDE before I got the hang of it. The graphics quality will matter because I also need to create instrumentation. I need to work on shape rounding etc - but one thing at a time, I am still crawling here.

janvb

  • Jr. Member
  • **
  • Posts: 76
Re: 2D Flowchart
« Reply #6 on: July 28, 2014, 06:01:07 pm »
Is anyone working on improvements to TCanvas to address graphics quality?

This is one thing that is good in C#, but the performance doing graphics on Forms are bad causing noise on the screen. The amount of extra coding I do to deal with secondary problems are not nice. Using WPF is possible, but as Microsoft don't provide a migration path and I need to rewrite stuff anyway - well that's why I am here because I like the idea of multi-platform GUI.

I realize that this is there I might be forced into OpenGL?

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: 2D Flowchart
« Reply #7 on: July 28, 2014, 06:05:52 pm »
Is anyone working on improvements to TCanvas to address graphics quality?


Well Graphics quality is a very broad term what are you after specifically an for which widget?
« Last Edit: July 28, 2014, 06:16:55 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

zamtmn

  • Sr. Member
  • ****
  • Posts: 365
Re: 2D Flowchart
« Reply #8 on: July 28, 2014, 08:30:05 pm »
>>One of my questions is if I would be better off using OpenGL as a 2D Canvas?

I do not think that you will find a suitable component, is likely to have to do everything yourself. Therefore, immediately do ability to paint on canvas and on OpenGL context))

janvb

  • Jr. Member
  • **
  • Posts: 76
Re: 2D Flowchart
« Reply #9 on: July 28, 2014, 09:09:00 pm »
Well Graphics quality is a very broad term what are you after specifically an for which widget?

Simple things actually - draw a circle on a TCanvas and I see that antialiasing is not implemented - The BGRA component smooth the curves correctly, but I have not looked into how they do it yet - also many of the components have the same issue so I assumed that is not in the default TCanvas ? I am asking so I don't start working on it if someone else is.

janvb

  • Jr. Member
  • **
  • Posts: 76
Re: 2D Flowchart
« Reply #10 on: July 28, 2014, 09:37:38 pm »
Looks like TBGRACanvas etc might contain what I was looking for  :) :-[

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: 2D Flowchart
« Reply #11 on: July 28, 2014, 09:58:33 pm »
Simple things actually - draw a circle on a TCanvas and I see that antialiasing is not implemented.

Depends on the widgetset on QT setting the antialised property of the canvas will give you that effect on windows tcanvas is using GDI which does not support antialising but you can create a GDI+ based canvas which supports it but that will be windows only.

Looks like TBGRACanvas etc might contain what I was looking for  :) :-[

Haven't used my self so I can't vouch for its functionality based on what I see on bgrabitmap it should be good enough.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

janvb

  • Jr. Member
  • **
  • Posts: 76
Re: 2D Flowchart
« Reply #12 on: July 29, 2014, 12:00:48 am »
Haven't used my self so I can't vouch for its functionality based on what I see on bgrabitmap it should be good enough.

We will have to code and try  :D

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: 2D Flowchart
« Reply #13 on: July 29, 2014, 07:46:22 am »
What I am wondering is if anyone can point me to an existing library with source code that could be a good starting point?
...snip....
What I will do in the first place is to create a generic diagram component specialized on drawing flowchart style diagrams with symbols, linked lines, scrolling, zooming etc.

What I notice from the graphics I have done is that I will need to add smoothing techniques and gradient colors.
Take a look at AggPas. It is included with Lazarus, but newer code (slightly more fixes) are included with the fpGUI Toolkit project. It is a Pascal port of the C++ AGG (Anti-Grain Geometry) framework. It does very high quality anti-aliasing, sub-pixel redering, alpha blending etc. It is 100% Object Pascal, so is very portable, and doesn't rely on any other frameworks like XLib, GDI etc.

I've attached a small screenshot sample of AggPas painting in a fpGUI demo. The AggPas directory contains 30+ demos that are very impressive. See the URL "Original AggPas demo page" for many more screenshots and demo binaries you can download.

AggPas in fpGUI: [https://github.com/graemeg/fpGUI/tree/master/src/corelib/render/software]
fpGUI Toolkit: [https://github.com/graemeg/fpGUI]
Original AggPas demo page: [http://www.crossgl.com/aggpas/aggpas-demo.htm]
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

janvb

  • Jr. Member
  • **
  • Posts: 76
Re: 2D Flowchart
« Reply #14 on: July 29, 2014, 09:12:15 am »
Take a look at AggPas....

Thanks, I will.