| 1 |
NAME |
| 2 |
GooCanvas2::CairoTypes - Bridge between GooCanvas2 and Cairo types |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use GooCanvas2; |
| 6 |
use GooCanvas2::CairoTypes; |
| 7 |
|
| 8 |
my $pattern = Cairo::SolidPattern->create_rgba(0, 0, 0, 0); |
| 9 |
my $rect = GooCanvas2::CanvasRect->new( |
| 10 |
..., |
| 11 |
'fill-pattern' => $pattern, # fails without CairoTypes, just works with |
| 12 |
); |
| 13 |
|
| 14 |
# Sometimes (but not always, no idea why) this fails: |
| 15 |
$rect->get('fill-pattern')->set_filter('linear); |
| 16 |
# Here's the solution: |
| 17 |
GooCanvas2::CairoTypes::cairoize_pattern($rect->get('fill-pattern')) |
| 18 |
->set_filter('linear); |
| 19 |
|
| 20 |
DESCRIPTION |
| 21 |
There is an issue in the interaction between GooCanvas, GObject |
| 22 |
Introspection, Cairo, and their Perl bindings, which causes some |
| 23 |
functionality to be unusable from Perl side. This is better described |
| 24 |
here |
| 25 |
<https://stackoverflow.com/questions/64625955/cairosolidpattern-is-not-o |
| 26 |
f-type-goocanvas2cairopattern>, and there was an attempt |
| 27 |
<https://gitlab.gnome.org/GNOME/goocanvas/-/merge_requests/9> to fix it |
| 28 |
upstream. Until it's fixed, this can serve as a workaround for it. |
| 29 |
|
| 30 |
Currently this module only "fixes" |
| 31 |
"Cairo::Pattern/GooCanvas2::CairoPattern" interop. For certain calls it |
| 32 |
just works if this module was included; for some other calls you need to |
| 33 |
explicitly convert the type. |
| 34 |
|
| 35 |
If you have any idea how to fix those cases to not require such call, or |
| 36 |
need to bridge more types, pull requests |
| 37 |
<https://github.com/DarthGandalf/GooCanvas2-CairoTypes> are welcome! |
| 38 |
|
| 39 |
AUTHOR |
| 40 |
Alexey Sokolov, <[email protected]> |
| 41 |
|
| 42 |
COPYRIGHT AND LICENSE |
| 43 |
Copyright (C) 2021 by Google |
| 44 |
|
| 45 |
This library is free software; you can redistribute it and/or modify it |
| 46 |
under the same terms as Perl itself, either Perl version 5.22.3 or, at |
| 47 |
your option, any later version of Perl 5 you may have available. |
| 48 |
|