NAME
Graphics::Grid::Grob::Segments - Line segments grob
VERSION
version 0.001
SYNOPSIS
use Graphics::Grid::Grob::Segments;
use Graphics::Grid::GPar;
my $lines = Graphics::Grid::Grob::Segments->new(
x0 => 0, y0 => 0,
x1 => 1, y1 => 1,
gp => Graphics::Grid::GPar->new()
);
# or use the function interface
use Graphics::Grid::Functions qw(:all);
my $lines = segments_grob(%params);
DESCRIPTION
This class represents a "line segments" graphical object. It's a little bit similar to Graphics::Grid::Grob::Polyline in that a segments grob can also be implemented by a ployline grob.
ATTRIBUTES
x0
A Graphics::Grid::Unit object specifying the starting x-values of the line segments.
y0
A Graphics::Grid::Unit object specifying the starting y-values of the line segments.
x1
A Graphics::Grid::Unit object specifying the stopping x-values of the line segments.
y1
A Graphics::Grid::Unit object specifying the stopping y-values of the line segments.
gp
An object of Graphics::Grid::GPar. Default is an empty gpar object.
vp
A viewport object. When drawing a grob, if the grob has this attribute, the viewport would be temporily pushed onto the global viewport stack before drawing takes place, and be poped after drawing. If the grob does not have this attribute set, it would be drawn on the existing current viewport in the global viewport stack.
elems
Get number of sub-elements in the grob.
Grob classes shall implement a _build_elems()
method to support this attribute.
METHODS
length
This is an alias of elems
.
extents($grid)
Returns info about the grob's extents (bounding box, etc) on the drawing layer, in cm.
Note that not all grob classes have got this method implemented.
For this module elems
always returns 1.
SEE ALSO
Graphics::Grid::Grob::Polyline
AUTHOR
Stephan Loyd <sloyd@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018-2023 by Stephan Loyd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.