=item get_corners Return the corners of the visible part of the canvas as a list: (minx, miny, maxx, maxy). This will not work if the scrollregion is smaller than the visible region. =cut sub get_corners { my $c = shift; $c->view_to_coords($c->xview, $c->yview); } =item view_to_coords($xv1,$xv2,$yv1,$yv2) Convert the result of xview/yview to coordinates. See comment in C. The result is the list ($x1,$y1,$x2,$y2). (Please note that the order is not the same as in the argument list! This is too make it easier to pass the arguments from xview and yview and to use the result in a scrollregion configuration.) =cut sub view_to_coords { my($c,$xv1,$xv2,$yv1,$yv2) = @_; my(@scrollregion) = ($Tk::VERSION == 800.017 ? $c->cget(-scrollregion) : @{$c->cget(-scrollregion)}); my $width = ($scrollregion[2]-$scrollregion[0]); my $height = ($scrollregion[3]-$scrollregion[1]); ($xv1 * $width + $scrollregion[0], $yv1 * $height + $scrollregion[1], $xv2 * $width + $scrollregion[0], $yv2 * $height + $scrollregion[1], ); }