GooCan...oTypes(3pm)

πŸ’– GooCanvas2::CairoTypes(3pm) πŸ’–

okay bestie so this is a Perl manual page, contributed by the community, and it's literally called GooCanvas2::CairoTypes β€” and yes it does exactly what the name says, it's a bridge between GooCanvas2 and Cairo types. no cap. 🫢

✨ NAME ✨

GooCanvas2::CairoTypes β€” a bridge between GooCanvas2 and Cairo types πŸŒ‰

πŸŽ€ SYNOPSIS πŸŽ€

like here's the whole vibe, copy-paste energy:

        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);

so you load GooCanvas2 and then you load GooCanvas2::CairoTypes, and suddenly the 'fill-pattern' => $pattern line is not fighting you for its life anymore. and then there's that second part where ->set_filter('linear) sometimes just... doesn't. sometimes it works, sometimes it doesn't, nobody knows why 😭 but the fix is to wrap it in GooCanvas2::CairoTypes::cairoize_pattern(...) and then it ~behaves~. iconic. πŸ’…


🌈 DESCRIPTION 🌈

okay so real talk. there's a whole situation going on between GooCanvas, GObject Introspection, Cairo, and their Perl bindings, and the way they talk to each other is lowkey broken, which means some functionality is just straight-up unusable from the Perl side. not dramatic, just facts.

it's described way better over here: https://stackoverflow.com/questions/64625955/cairosolidpattern-is-not-of-type-goocanvas2cairopattern

and yes, someone did attempt to fix it upstream, here: https://gitlab.gnome.org/GNOME/goocanvas/-/merge_requests/9

but until that gets fixed for real, this module is here to serve as a workaround. it's giving "temporary but make it slay". πŸ’…

so right now, this module only "fixes" the "Cairo::Pattern/GooCanvas2::CairoPattern" interop. that's it. that's the whole thing it does presently. for certain calls it just works if this module was included β€” like you did nothing, and the universe said yes. ✨ for some other calls though? nope, you have to explicitly convert the type. main character energy required.

and if you, bestie, have any idea how to fix those cases so they don't need such a call, or if you need to bridge more types β€” pull requests are so welcome omg: https://github.com/DarthGandalf/GooCanvas2-CairoTypes 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Alexey Sokolov, <sokolov@google.com>

Copyright (C) 2021 by Google

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.22.3 or, at your option, any later version of Perl 5 you may have available.


and that's the whole page, bestie πŸ’œ this one shipped as perl v5.42.3 on 2026-08-21, so if you're reading it, you're reading it at exactly the right time. periodt. πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from