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