GooCanvas2::CairoTypes(3pm)

GooCanvas2::CairoTypes3pm

Bridge between goocanvas2 and cairo types

Usage

        use GooCanvas2;
        use GooCanvas2::CairoTypes;
        my $pattern = Cairo::SolidPattern->create_rgba(0, 0, 0, 0);
        my $rect = GooCanvas2::CanvasRect->new(
                ...,
                'fill-pattern' => $pattern,  # fails without CairoTypes, just works with
        );
        # Sometimes (but not always, no idea why) this fails:
        $rect->get('fill-pattern')->set_filter('linear);
        # Here's the solution:
        GooCanvas2::CairoTypes::cairoize_pattern($rect->get('fill-pattern'))
                ->set_filter('linear);

Overview

There is an issue in the interaction between GooCanvas, GObject Introspection, Cairo, and their Perl bindings, which causes some functionality to be unusable from Perl side. This is better described here <https://stackoverflow.com/questions/64625955/cairosolidpattern-is-not-of-type-goocanvas2cairopattern>, and there was an attempt <https://gitlab.gnome.org/GNOME/goocanvas/-/merge_requests/9> to fix it upstream. Until it's fixed, this can serve as a workaround for it.

Currently this module only "fixes" "Cairo::Pattern/GooCanvas2::CairoPattern" interop. For certain calls it just works if this module was included; for some other calls you need to explicitly convert the type.

If you have any idea how to fix those cases to not require such call, or need to bridge more types, pull requests <https://github.com/DarthGandalf/GooCanvas2-CairoTypes> are welcome!

Releases

3 releases since Debian 12 (Bookworm); the text changed 2 times.

  1. 12
  2. 13
  3. Arch

Author

Alexey Sokolov, <[email protected]>

From perl-goocanvas2-cairotypes 0.001-11 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.