[fpc-pascal] Looking for a suitable graphics library/component

Anthony Walter sysrpl at gmail.com
Tue Mar 22 16:18:57 CET 2011

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 ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110322/7286eac2/attachment.html>

More information about the fpc-pascal mailing list