[Gambas-user] Cairo

Fabien Bodard gambas.fr at ...626...
Sat Mar 11 13:12:19 CET 2017


Le 11 mars 2017 00:46, "Benoît Minisini" <gambas at ...1...> a
écrit :

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,

I think Erik want to replace the old TextEdit widget.  So yes you need to
use a toolkit component as basis.

You can learn a lot with the gb.form.editor widget and gb.form.terminal.

Drawing a text is long. So think about using cached images of letters or
lines for quick refreshing.

I wish you a lot of fun and I'm  waiting for your editor ( I need one too)



--
Benoît Minisini

------------------------------------------------------------
------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list