Gnome2:...s::main(3)
π NAME π
Gnome2::Canvas::main β a structured graphics canvas, bestie. It's section 3 of the User Contributed Perl Documentation, and it's so much.
Okay so real talk: this is the canvas you draw stuff onto. Items, coordinates, zooming, scrolling, the whole vibe. Let's get into it π
β¨ METHODS β¨
π widget = Gnome2::Canvas->new
Makes you a brand new empty canvas, and it's in non-antialiased mode. Crunchy pixels, no smoothing, we love her.
π¦ widget = Gnome2::Canvas->new_aa
Same deal, brand new empty canvas, but this one is in antialiased mode. Smooth edges, soft life. β¨
π boolean = $canvas->aa
Returns true if $canvas was created in anti-aliased mode. Just a little vibe check on your canvas.
πΈ ($bx1, $by1, $bx2, $by2) = Gnome2::Canvas->get_butt_points ($x1, $y1, $x2, $y2, $width, $project)
$x1(double)$y1(double)$x2(double)$y2(double)$width(double)$project(integer)
π
(wx, wy) = $canvas->c2w ($cx, $cy)
$cx(integer)$cy(integer)
π«Ά boolean = $canvas->get_center_scroll_region
π«Ά $canvas->set_center_scroll_region ($center_scroll_region)
$center_scroll_region(boolean)
π list = $canvas->get_color ($spec)
$spec(string)
Returns an integer indicating the success of the color allocation and a GdkColor. Two things, one call, icon behaviour fr.
π₯ unsigned = $canvas->get_color_pixel ($rgba)
$rgba(integer)
π rgbdither = $canvas->get_dither
π $canvas->set_dither ($dither)
$dither(Gtk2::Gdk::RgbDither)
π item = $canvas->get_item_at ($x, $y)
$x(double)$y(double)
π ($mx1, $my1, $mx2, $my2) = Gnome2::Canvas->get_miter_points ($x1, $y1, $x2, $y2, $x3, $y3, $width)
$x1(double)$y1(double)$x2(double)$y2(double)$x3(double)$y3(double)$width(double)
π§ double = $canvas->get_pixels_per_unit
Fetches $canvas' scale factor. That's it, that's the whole method.
π§ $canvas->set_pixels_per_unit ($n)
$n(double)
Sets the zooming factor of $canvas by telling it how many screen pixels correspond to one canvas unit. Zoom zoom, main character energy.
β double = Gnome2::Canvas->polygon_to_point ($poly_ref, $x, $y)
$poly_ref(arrayref) β coordinate pairs that make up the polygon$x(double)$y(double)
Returns the distance from the point $x,$y to the polygon described by the vertices in $poly_ref, or zero if the point is inside the polygon.
π $canvas->request_redraw ($x1, $y1, $x2, $y2)
$x1(integer)$y1(integer)$x2(integer)$y2(integer)
π group = $canvas->root
π (cx, cy) = $canvas->get_scroll_offsets
π (x1, y1, x2, y2) = $canvas->get_scroll_region
π $canvas->set_scroll_region ($x1, $y1, $x2, $y2)
$x1(double)$y1(double)$x2(double)$y2(double)
π¦ $canvas->scroll_to ($cx, $cy)
$cx(integer)$cy(integer)
π¦ $canvas->set_stipple_origin ($gc)
$gc(Gtk2::Gdk::GC)
π¦ $canvas->update_now
π (cx, cy) = $canvas->w2c ($wx, $wy)
$wx(double)$wy(double)
π $affine = $canvas->w2c_affine
Fetches the affine transform that converts from world coordinates to canvas pixel coordinates. So useful, no cap.
π Note: this method was completely broken for all $Gnome2::Canvas::VERSION < 1.002. Not "a little weird", not "slightly off" β completely broken. If you're on an old version, that's the tea. π
π (cx, cy) = $canvas->w2c_d ($wx, $wy)
$wx(double)$wy(double)
π (worldx, worldy) = $canvas->window_to_world ($winx, $winy)
$winx(double)$winy(double)
π (winx, winy) = $canvas->world_to_window ($worldx, $worldy)
$worldx(double)$worldy(double)
πΈ ENUMS AND FLAGS πΈ
π enum Gtk2::Gdk::RgbDither
'none'/'GDK_RGB_DITHER_NONE''normal'/'GDK_RGB_DITHER_NORMAL''max'/'GDK_RGB_DITHER_MAX'
π«Ά SEE ALSO π«Ά
Gnome2::Canvas
π COPYRIGHT π
Copyright (C) 2003-2004 by the Gtk2-Perl Team.
This software is licensed under the LGPL; see Gnome2::Canvas for a full notice.
And that's the whole page, bestie π This was perl v5.42.0, dated 2025-07-25, page Gnome2:...s::main(3). Go forth and draw something iconic πβ¨
π¦ where this page comes from
- fedora 43: perl-Gnome2-Canvas 1.006-18.fc43 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms