[Gambas-user] Cairo

Benoît Minisini gambas at ...1...
Sat Mar 11 00:44:50 CET 2017


Le 10/03/2017 à 22:08, Moviga Technologies a écrit :
> Hi!
>
> What source code would be the best to study in order to learn how to use
> the cairo component properly? I am interested in learning more about the
> function's that allow one to refresh certain areas of the surface (clip
> and matrix?). My long term goals for learning it in the first place is
> to be able to first create a simple (perhaps monospaced) text editor,
> then a formatted text rendering surface (preferably with images) and
> lastly a rich text editor.
>
> Kind regards
> Erik
>

The gb.cairo component has almost the same API as cairo, so any cairo 
source code example can be easily transposed to Gambas. Just ask 
questions on a specific example if you encounter problems.

As for making a rich text editor, cairo is not enough, as it is 
rudimentary when displaying text.

You have to rely on the Pango library, but there is no "gb.pango" component.

And how will you handle input?

For that, you will have to use the gb.gtk component, that uses 
internally cairo and pango for the drawing, and handles the input method 
stuff for entering non ascii characters with your keyboard.

It's just that the API is not the same, but simpler.

Regards,

-- 
Benoît Minisini




More information about the User mailing list