[fpc-pascal] Looking for a suitable graphics library/component
syraxes at googlemail.com
Tue Mar 22 18:57:53 CET 2011
On Tue, Mar 22, 2011 at 17:18, Anthony Walter <sysrpl at gmail.com> wrote:
> For drawing lines, shapes, fills, on Linux I'd recommend using cairo. On
> Windows I'd say you should use GDI or GDI+. You can find pascal files
> importing the functions for those libraries using google. Some of them may
> come with FPC.
> For widgets, if you are using Lazarus, it comes with a widget toolkit. Then
> there is also the free pascal gui tookit located here:
> Finally, for handling scrolling, what you need to do is determine the max
> bounds of your area, compare that to screen area and your drawing scale
> (your zoom factor). Use that to recalculate both the horizontal and
> vertical scroll bar information (page size, scroll size) when the draw area
> is resized and update the scroll bars accordingly.
> When you receive a scroll position change notification (the user drags the
> scroll bar) you call some api to scroll the drawing (such as
> ScrollWindowEx), which will invalidate a dirty rectangle in your window.
> When you receive a paint notification (either when the user scrolls or a
> window is dragged over your window), you should also retrieve the dirty
> rectangle. Then you need to find the rectangles of your drawn objects that
> intersect the dirty rectangle. Redraw objects that intersect the dirty
> If the user zooms in or out, invalidate the entire area.
> It's all pretty standard stuff ...
Thanks Anthony for your answers.
I will keep in mind these suggestions if I fail to find a higher-level
(for example, the TAChart is a "higher-level" component for drawing charts
that is much more convenient to use compared to drawing the chart from
Ideally, I am hoping that already exists some kind of "svg canvas" that can be
used in fpgui or Lazarus applications. For example: if I draw a
rectangle in the
canvas I want to be able to later :
- change color
- modify size/position
- associate it with a "mouse click" event
I didn't mention that I will need to handle in parallel multiple
- number of meters
- position withing each track segment (each segment has a starting km and an
ending km). And it's possible that a segment ends at km=35.4 and
the next one
begins at km=38.2 . It is even possible that the next segment has
- position relative to balises
So the problem itself is relatively mind-twisting .
It would be really nice to find a component that allows me to add and
the graphical objects in a "scalar-graphics" way , that takes care of drawing
on-screen without forcing me to go into the details .
More information about the fpc-pascal