Recent

Author Topic: Cairo examples  (Read 4384 times)

Roland57

  • Sr. Member
  • ****
  • Posts: 423
    • msegui.net
Cairo examples
« on: December 26, 2021, 11:48:40 pm »
Hello! Some years ago I wrote a collection of examples using Cairo, for a chapter of a book that has never been published. Maybe it could interest someone.

The first examples are simple Pascal programs. The other are Lazarus projects. The drawing is done in a TPaintBox. The Lazarus projects are only for Windows. I don't know how to do the same under Linux. If someone knows...

cairo-pascal-tutorial-source.zip

Regards.

Roland
« Last Edit: March 25, 2024, 03:34:42 pm by Roland57 »
My projects are on Gitlab and on Codeberg.

Roland57

  • Sr. Member
  • ****
  • Posts: 423
    • msegui.net
Re: Cairo examples
« Reply #1 on: December 27, 2021, 12:01:36 am »
Here is another example which is not in the package. Maybe I already posted it in the forum, I don't remember.  :)
« Last Edit: December 27, 2021, 12:18:43 am by Roland57 »
My projects are on Gitlab and on Codeberg.

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Cairo examples
« Reply #2 on: December 27, 2021, 12:04:47 am »
Hello Roland!

OK, you convert me.

But the first thing needed is a dynamic-loading-of-libcairo version of cairo.pp.

OK, I will begin with this out-of-the-box important needed thing.

Write you later.

Fre;D
« Last Edit: December 27, 2021, 04:24:21 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3168
    • StrumPract is the musicians best friend
Re: Cairo examples
« Reply #3 on: December 27, 2021, 04:23:57 am »
Hello.

Included dynamic loading version of cairo.pp

You may use ca_load(path_of_libcairo) at init of the program.
A empty filename will load libcairo from system (if installed).

There is also Roland-roulette demo using cairo_dyn.pas.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Roland57

  • Sr. Member
  • ****
  • Posts: 423
    • msegui.net
Re: Cairo examples
« Reply #4 on: December 27, 2021, 06:33:37 am »
Interesting. Thank you Fred.
My projects are on Gitlab and on Codeberg.

Roland57

  • Sr. Member
  • ****
  • Posts: 423
    • msegui.net
Cardioid animation (TPaintBox)
« Reply #5 on: February 14, 2023, 05:30:02 pm »
The Lazarus projects are only for Windows. I don't know how to do the same under Linux. If someone knows...

Finally I found (or rather someone showed me) a solution for drawing with Cairo in a TBitmap without using OS specific code. Thanks to Mathias for his code example.

Here is a demo project.

By the way, it is also possible to do the same thing by using TCairoPaintBox component. Demo here.
My projects are on Gitlab and on Codeberg.

domasz

  • Sr. Member
  • ****
  • Posts: 435
Re: Cardioid animation (TPaintBox)
« Reply #6 on: February 14, 2023, 06:34:15 pm »
Why are you showing us an ass pictured from below? ;)

 

TinyPortal © 2005-2018