Graphics::Grid::Functions - Function interface for Graphics::Grid
version 0.001
use Graphics::Grid::Functions qw(:all); grid_driver( width => 900, height => 300, format => 'svg' ); grid_rect(); # draw white background for my $setting ( { color => 'red', x => 1 / 6 }, { color => 'green', x => 0.5 }, { color => 'blue', x => 5 / 6 } ) { push_viewport( viewport( x => $setting->{x}, y => 0.5, width => 0.2, height => 0.6 ) ); grid_rect( gp => { fill => $setting->{color}, lty => 'blank' } ); grid_text( label => $setting->{color}, y => -0.1 ); pop_viewport(); } grid_write("foo.svg");
This is the function interface for Graphics::Grid. In this package it has a global Graphics::Grid object, on which the functions are operated.
Set the device driver. If you don't run this function, the default driver will be effective.
If $driver consumes Graphics::Grid::Driver, $driver is assigned to the global Graphics::Grid object, and %rest is ignored.
$driver
%rest
grid_driver(driver => Graphics::Grid::Driver::Cairo->new(...));
If $driver is a string, a Graphics::Grid::Driver::$driver object is created with %rest as construction parameters, and is assigned to the global Graphics::Grid object.
grid_driver(driver => 'Cairo', width => 800, height => 600);
You may run it at the the beginning of you code. At present changing driver settings at the middle is not guarenteed to work.
This function returns current width and height.
my $driver = grid_device();
It's same as Graphics::Grid::Unit->new.
Graphics::Grid::Unit->new
It's same as Graphics::Grid::UnitList->new.
Graphics::Grid::UnitList->new
It's same as Graphics::Grid::GPar->new.
Graphics::Grid::GPar->new
It's same as Graphics::Grid::Viewport->new.
Graphics::Grid::Viewport->new
It's same as Graphics::Grid::ViewportTree->new.
Graphics::Grid::ViewportTree->new
It's same as Graphics::Grid's push_viewport method.
push_viewport
It's same as Graphics::Grid's pop_viewport method.
pop_viewport
It's same as Graphics::Grid's up_viewport method.
up_viewport
It's same as Graphics::Grid's down_viewport method.
down_viewport
It's same as Graphics::Grid's seek_viewport method.
seek_viewport
It's same as Graphics::Grid::Layout->new.
Graphics::Grid::Layout->new
It's same as Graphics::Grid's draw method.
draw
It's same as Graphics::Grid's write method.
write
It's same as Graphics::Grid::GTree->new.
Graphics::Grid::GTree->new
This creates a grill object.
This creates a grill object and draws it.
This creates a grob object.
$grob_type can be one of following,
$grob_type
This creates a grob, and draws it. This is same as Graphics::Grid's ${grob_type}(...) method.
See above for possible $grob_type.
Graphics::Grid
Examples in the examples directory of the package release.
examples
Stephan Loyd <sloyd@cpan.org>
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.
To install Graphics::Grid, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graphics::Grid
CPAN shell
perl -MCPAN -e shell install Graphics::Grid
For more information on module installation, please visit the detailed CPAN module installation guide.