.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "G2 3pm" .TH G2 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME G2 \- A simple graphics library ported to Perl. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use G2; \& \& $dev1 = newX11 G2::Device(775, 575); \& $dev2 = newGD G2::Device("test.png",600,200); \& \& $dev1\->rectangle(20,20,150,150); \& $dev1\->circle(100,150,60); \& \& $dev2\->circle(100,150,60); \& $dev2\->string(100,50,"A circle in a PNG file"); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" g2 is a simple to use graphics library for 2D graphical applications. This library provides a comprehensive set of functions for simultaneous generation of graphical output on different types of devices. Presently, following devices are currently supported by g2: X11, PNG, PostScript (xfig is in development). One major feature of the g2_library is the concept of virtual devices. An arbitrary number of physical devices (such as PNG, or X11) can be grouped to create a so-called virtual device. Commands sent to such a virtual devices will automatically issued to all attached physical devices. This allows for example simultaneous output to a PNG file and a Postscript file. A virtual device in turn can be attached to another virtual device, allowing to construct trees of devices. Virtual devices can also be useful when using different user-coordinate systems. E.g. one X11 window showing an overview of a graphical output, and a second window showing a zoom of a more detailed area of the graphic. Drawing in both windows is performed by one single command to the virtual device. Please see g2 documentation (C interface) for up to date version. .SH "Exported constants" .IX Header "Exported constants" .Vb 3 \& G2LD \& G2_H \& G2_VERSION .Ve .SH "Exported functions" .IX Header "Exported functions" .SS "Creating new devices" .IX Subsection "Creating new devices" .ie n .IP """newX11""" 5 .el .IP \f(CWnewX11\fR 5 .IX Item "newX11" \&\f(CW\*(C`G2::Device::newX11(width,height)\*(C'\fR \fIclass method\fR .Sp opens an X11 window with width and height of X11 window given in pixels. returns : a new X11 device. .ie n .IP """newPS""" 5 .el .IP \f(CWnewPS\fR 5 .IX Item "newPS" \&\f(CW\*(C`G2::Device::newPS(filename,paper,orientation)\*(C'\fR \fIclass method\fR .Sp opens a new PostScript device. file_name: name of PostScript file paper: Paper size (e.g. g2_A4, g2_Letter). See PostScript paper sizes for a full list of supported sizes. orientation: paper orientation. Either g2_PS_land for landscape or g2_PS_port for portrait returns : a new PostScript device. .ie n .IP """newGD""" 5 .el .IP \f(CWnewGD\fR 5 .IX Item "newGD" \&\f(CW\*(C`G2::Device::newGD(filename,width,height,type)\*(C'\fR \fIclass method\fR .Sp open a new GD device width,height: width and height of the image in pixels filename: name of the output file. type: file type, 0\-jpeg, 1\-png returns : a new GD device .ie n .IP """newVD""" 5 .el .IP \f(CWnewVD\fR 5 .IX Item "newVD" \&\f(CWG2::Device::newVD()\fR \fIclass method\fR .Sp Create a new Virtual Device. An arbitrary number of physical devices (such as PNG, or X11) can be grouped to create a so-called virtual device. Commands sent to such a virtual devices will automatically issued to all attached physical devices. This allows for example simultaneous output to a PNG file and a Postscript file. A virtual device in turn can be attached to another virtual device, allowing to construct trees of devices. Virtual devices can also be useful when using different user-coordinate systems. E.g. one X11 window showing an overview of a graphical output, and a second window showing a zoom of a more detailed area of the graphic. Drawing in both windows is performed by one single command to the virtual device. .SS "Device Functions" .IX Subsection "Device Functions" .ie n .IP """""" 5 .el .IP \f(CW\fR 5 .IX Item "" \&\f(CWG2::Device::attach(dev)\fR \fIobject method\fR .ie n .IP """""" 5 .el .IP \f(CW\fR 5 .IX Item "" \&\f(CWG2::Device::detach(dev)\fR \fIobject method\fR .ie n .IP """""" 5 .el .IP \f(CW\fR 5 .IX Item "" \&\f(CWG2::Device::close()\fR \fIobject method\fR .ie n .IP """set_auto_flush""" 5 .el .IP \f(CWset_auto_flush\fR 5 .IX Item "set_auto_flush" \&\f(CWG2::Device::set_auto_flush(on_off)\fR \fIobject method\fR .ie n .IP """flush""" 5 .el .IP \f(CWflush\fR 5 .IX Item "flush" \&\f(CWG2::Device::flush()\fR \fIobject method\fR .ie n .IP """save""" 5 .el .IP \f(CWsave\fR 5 .IX Item "save" \&\f(CWG2::Device::save()\fR \fIobject method\fR .ie n .IP """set_coordinate_system""" 5 .el .IP \f(CWset_coordinate_system\fR 5 .IX Item "set_coordinate_system" \&\f(CW\*(C`G2::Device::set_coordinate_system(x_origin, y_origin, x_mul, y_mul)\*(C'\fR \fIobject method\fR .ie n .IP """ld""" 5 .el .IP \f(CWld\fR 5 .IX Item "ld" \&\f(CWG2::Device::ld()\fR \fIobject method\fR .ie n .IP """set_ld""" 5 .el .IP \f(CWset_ld\fR 5 .IX Item "set_ld" \&\f(CWG2::Device::set_ld( dev)\fR \fIobject method\fR .ie n .IP """ink""" 5 .el .IP \f(CWink\fR 5 .IX Item "ink" \&\f(CW\*(C`G2::Device::ink( pd_dev, red, green, blue)\*(C'\fR \fIobject method\fR .ie n .IP """pen""" 5 .el .IP \f(CWpen\fR 5 .IX Item "pen" \&\f(CWG2::Device::pen(color)\fR \fIobject method\fR .ie n .IP """set_dash""" 5 .el .IP \f(CWset_dash\fR 5 .IX Item "set_dash" \&\f(CW\*(C`G2::Device::set_dash(N, *dashes)\*(C'\fR \fIobject method\fR .ie n .IP """set_font_size""" 5 .el .IP \f(CWset_font_size\fR 5 .IX Item "set_font_size" \&\f(CWG2::Device::set_font_size(size)\fR \fIobject method\fR .ie n .IP """set_line_width""" 5 .el .IP \f(CWset_line_width\fR 5 .IX Item "set_line_width" \&\f(CWG2::Device::set_line_width(w)\fR \fIobject method\fR .ie n .IP """clear_palette""" 5 .el .IP \f(CWclear_palette\fR 5 .IX Item "clear_palette" \&\f(CWG2::Device::clear_palette( dev)\fR \fIobject method\fR .ie n .IP """reset_palette""" 5 .el .IP \f(CWreset_palette\fR 5 .IX Item "reset_palette" \&\f(CWG2::Device::reset_palette( dev)\fR \fIobject method\fR .ie n .IP """allocate_basic_colors""" 5 .el .IP \f(CWallocate_basic_colors\fR 5 .IX Item "allocate_basic_colors" \&\f(CWG2::Device::allocate_basic_colors( dev)\fR \fIobject method\fR .ie n .IP """clear""" 5 .el .IP \f(CWclear\fR 5 .IX Item "clear" \&\f(CWG2::Device::clear( dev)\fR \fIobject method\fR .ie n .IP """set_background""" 5 .el .IP \f(CWset_background\fR 5 .IX Item "set_background" \&\f(CWG2::Device::set_background(color)\fR \fIobject method\fR .SS "Drawing Functions" .IX Subsection "Drawing Functions" .ie n .IP """move""" 5 .el .IP \f(CWmove\fR 5 .IX Item "move" \&\f(CW\*(C`G2::Device::move(x, y)\*(C'\fR \fIobject method\fR .ie n .IP """move_r""" 5 .el .IP \f(CWmove_r\fR 5 .IX Item "move_r" \&\f(CW\*(C`G2::Device::move_r(dx, dy)\*(C'\fR \fIobject method\fR .ie n .IP """plot""" 5 .el .IP \f(CWplot\fR 5 .IX Item "plot" \&\f(CW\*(C`G2::Device::plot(x, y)\*(C'\fR \fIobject method\fR .ie n .IP """plot_r""" 5 .el .IP \f(CWplot_r\fR 5 .IX Item "plot_r" \&\f(CW\*(C`G2::Device::plot_r(dx, dy)\*(C'\fR \fIobject method\fR .ie n .IP """line""" 5 .el .IP \f(CWline\fR 5 .IX Item "line" \&\f(CW\*(C`G2::Device::line(x1, y1, x2, y2)\*(C'\fR \fIobject method\fR .ie n .IP """line_r""" 5 .el .IP \f(CWline_r\fR 5 .IX Item "line_r" \&\f(CW\*(C`G2::Device::line_r(dx, dy)\*(C'\fR \fIobject method\fR .ie n .IP """line_to""" 5 .el .IP \f(CWline_to\fR 5 .IX Item "line_to" \&\f(CW\*(C`G2::Device::line_to(x, y)\*(C'\fR \fIobject method\fR .ie n .IP """poly_line""" 5 .el .IP \f(CWpoly_line\fR 5 .IX Item "poly_line" \&\f(CW\*(C`G2::Device::poly_line(N_pt, *pos)\*(C'\fR \fIobject method\fR .ie n .IP """triangle""" 5 .el .IP \f(CWtriangle\fR 5 .IX Item "triangle" \&\f(CW\*(C`G2::Device::triangle(x1, y1, x2, y2, x3, y3)\*(C'\fR \fIobject method\fR .ie n .IP """filled_triangle""" 5 .el .IP \f(CWfilled_triangle\fR 5 .IX Item "filled_triangle" \&\f(CW\*(C`G2::Device::filled_triangle(x1, y1, x2, y2, x3, y3)\*(C'\fR \fIobject method\fR .ie n .IP """rectangle""" 5 .el .IP \f(CWrectangle\fR 5 .IX Item "rectangle" \&\f(CW\*(C`G2::Device::rectangle(x1, y1, x2, y2)\*(C'\fR \fIobject method\fR .ie n .IP """filled_rectangle""" 5 .el .IP \f(CWfilled_rectangle\fR 5 .IX Item "filled_rectangle" \&\f(CW\*(C`G2::Device::filled_rectangle(x1, y1, x2, y2)\*(C'\fR \fIobject method\fR .ie n .IP """polygon""" 5 .el .IP \f(CWpolygon\fR 5 .IX Item "polygon" \&\f(CW\*(C`G2::Device::polygon(N_pt, *pos)\*(C'\fR \fIobject method\fR .ie n .IP """filled_polygon""" 5 .el .IP \f(CWfilled_polygon\fR 5 .IX Item "filled_polygon" \&\f(CW\*(C`G2::Device::filled_polygon(N_pt, *pos)\*(C'\fR \fIobject method\fR .ie n .IP """circle""" 5 .el .IP \f(CWcircle\fR 5 .IX Item "circle" \&\f(CW\*(C`G2::Device::circle(x, y, r)\*(C'\fR \fIobject method\fR .ie n .IP """filled_circle""" 5 .el .IP \f(CWfilled_circle\fR 5 .IX Item "filled_circle" \&\f(CW\*(C`G2::Device::filled_circle(x, y, r)\*(C'\fR \fIobject method\fR .ie n .IP """ellipse""" 5 .el .IP \f(CWellipse\fR 5 .IX Item "ellipse" \&\f(CW\*(C`G2::Device::ellipse(x, y, r1, r2)\*(C'\fR \fIobject method\fR Draw an ellipse on device dev x,y: center point r1,r2: x and y radius .ie n .IP """filled_ellipse""" 5 .el .IP \f(CWfilled_ellipse\fR 5 .IX Item "filled_ellipse" \&\f(CW\*(C`G2::Device::filled_ellipse(x, y, r1, r2)\*(C'\fR \fIobject method\fR Draw a filled ellipse on device dev x,y: center point r1,r2: x and y radius .ie n .IP """arc""" 5 .el .IP \f(CWarc\fR 5 .IX Item "arc" \&\f(CW\*(C`G2::Device::arc(x, y, r1, r2, a1, a2)\*(C'\fR \fIobject method\fR .Sp Draw an arc with center point at (x,y), x and y radius given by r1,r2 and starting and ending angle in radians a1,a2 .ie n .IP """filled_arc""" 5 .el .IP \f(CWfilled_arc\fR 5 .IX Item "filled_arc" \&\f(CW\*(C`G2::Device::filled_arc(x, y, r1, r2, a1, a2)\*(C'\fR \fIobject method\fR Draw a filled arc on device dev x,y: center point r1,r2: x and y radius a1,a2: starting and ending angle in radians .ie n .IP """string""" 5 .el .IP \f(CWstring\fR 5 .IX Item "string" \&\f(CW\*(C`G2::Device::string(x, y, char *text)\*(C'\fR \fIobject method\fR .ie n .IP """""" 5 .el .IP \f(CW\fR 5 .IX Item "" \&\f(CW\*(C`G2::Device::set_QP(d, enum QPshape shape)\*(C'\fR \fIobject method\fR .ie n .IP """""" 5 .el .IP \f(CW\fR 5 .IX Item "" \&\f(CW\*(C`G2::Device::plot_QP(x, y)\*(C'\fR \fIobject method\fR .SH AUTHORS .IX Header "AUTHORS" Horst Wagner (wagner/users\-sourceforge.net) and Ljubomir Milanovic (ljubo/users\-sourceforge\-net) .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 1998\-2001 Ljubomir Milanovic & Horst Wagner This file is part of the g2 library .PP This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. .PP This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. .PP You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111\-1307 USA