[Gambas-user] Using gb.Cairo
dovey.john at gmail.com
Mon May 17 21:35:58 CEST 2021
Thank you Tobias. You went above and beyond on this one!
All the best
On Mon, 17 May 2021 at 14:34, Tobias Boege <tobs at taboege.de> wrote:
> On Mon, 17 May 2021, John Dovey wrote:
> > Hi,
> > I am quite keen to use the Cairo component. I am having no luck though
> > starting.
> > The docs tell me that
> > "Before starting drawing anything, you must call the Begin
> > <http://gambaswiki.org/wiki/comp/gb.cairo/cairo/begin> method by
> passing it
> > the Image <http://gambaswiki.org/wiki/comp/gb.image.effect/image> where
> > want to draw."
> > I figured the simplest way to do this would be to create a Picturebox on
> > form, and pass that to Cairo.Begin. That didn't work.
> > A hint on how to do this would help tremendously.
> A PictureBox is a control which displays a Picture. You cannot draw on
> a PictureBox directly. You have to draw with Cairo on a Picture object
> and then display the result in a PictureBox (actually, you draw on an
> Image object, which is slightly different from a Picture). Alternatively,
> you can draw on a DrawingArea, but not with the Cairo component, only
> with the (GUI toolkit-specific) Paint class whose interface is very
> similar to Cairo...
> If that was too confusing, don't worry. I have also attached a project
> which implements most(!) of your C code in Gambas. I think once you have
> figured out how to start drawing, the translation is straightforward.
> The only thing I could not copy is the cairo_pattern_set_extend()
> setting, so the result looks different (the gradient is not repeating).
> There is only one mention of this function in the gb.cairo source code
> and that is limited to Cairo.ImagePattern(). Apparently you cannot
> apply an Extend to a LinearGradient currently.
> This is probably an oversight and you should file a feature request
> at http://gambaswiki.org/bugtracker
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User