|
NAMEText::Graphics -- A text graphics rendering toolkitDESCRIPTIONThis is a toolkit for rendering plain text via an API like that used for graphics rendering in GUI toolkits. This package might be used when you want to do sophisticated rendering of plain text, e.g., for graphing, creating of complex forms for email and fax, and so on.SYNOPSISuse Text::Graphics; my $text = "A text graphics rendering toolkit.\n"; my $page = Text::Graphics::Page->new( 20, 10); my $panel0 = Text::Graphics::BorderedPanel->new( 20, 10); my $panel1 = Text::Graphics::FilledBorderedTextPanel->new($text x 3, 25, 12); $panel0->setBackground("#"); $panel1->setBackground(" "); $page->add($panel0); $page->add($panel1, 5, 2); $page->render(); +-------------------+ |###################| |####+--------------+ |####|A text graphic| |####|rendering tool| |####|text graphics | |####|toolkit. A tex| |####|graphics rende| |####|toolkit. | |####| | +----+--------------+ User API"Text::Graphics::Page"Class to represent a page.
"Text::Graphics::Panel"Class to represent a panel.
SubclassingMost of the work you might do with this module will be by subclassing panel. The idea is you make a new panel, like LinePanel, that has a constructor setting character to draw and the start and end coordinates for the line. Then, in the LinePanels "_drawSelf(gc)" routine, it calls on the gc to draw a line:package LinePanel; use vars qw (@ISA); @ISA = qw (Panel); sub new { my $this = {}; bless $this, shift; $this->{char} = shift; $this->{startx} = shift; $this->{starty} = shift; $this->{endx} = shift; $this->{endy} = shift; return $this; } sub _drawSelf { my $this = shift; my $gc = shift; $gc->drawLine($this->{char}, $this->{startx}, $this->{starty}, $this->{endx}, $this->{endy}); } There are some other subclasses included, particularly those for text handling. Actually the "drawLine()" method for the GraphicsContext is not included b/c I just do not need it, though I have a mostly working version if anyone is interested (it is not complicated =). GraphicsContext does include the following methods, however:
AUTHORSStephen Farrell <stephen@farrell.org> Jeremy Mayes POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |