chickadee » g2

g2

Description

An interface to the g2 graphics library.

Author

felix winkelmann

Requirements

easyffi

Documentation

The following definitions are exported from this extension. Consult the g2 documentation for more information.

qpcirc constant
qprect constant

Part of enum QPSHAPE.

(g2:poly-line DEVICE NUM F64VECTOR) procedure
(g2:set-background DEVICE COLOR) procedure
(g2:arc DEVICE X Y R1 R2 A1 A2) procedure
(g2:filled-arc DEVICE X Y R1 R2 A1 A2) procedure
(g2:ld DEVICE) procedure

(returns LD)

(g2:set-ld DEVICE) procedure
(g2:string DEVICE X Y STRING) procedure
(g2:set-qp DEVICE D QPSHAPE) procedure
(g2:set-coordinate-system DEVICE XORIGIN YORIGIN XMUL YMUL) procedure
(g2:set-dash DEVICE NUM F64FECTOR) procedure
(g2:close DEVICE) procedure
(g2:move-r DEVICE DX DY) procedure
(g2:line-to DEVICE X Y) procedure
(g2:pen DEVICE COLOR) procedure
(g2:flush DEVICE) procedure
(g2:set-line-width DEVICE WIDTH) procedure
(g2:clear DEVICE) procedure
(g2:set-auto-flush DEVICE BOOL) procedure
(g2:allocate-basic-colors DEVICE) procedure
(g2:image DEVICE X Y XSIZE YSIZE S32VECTOR) procedure
(g2:detach VDEVICE DEVICE) procedure
(g2:polygon DEVICE NUM F64VECTOR) procedure
(g2:filled-polygon DEVICE NUM F64VECTOR) procedure
(g2:open-vd) procedure

Returns a VDEVICE

(g2:plot DEVICCE X Y) procedure
(g2:reset-palette DEVICE) procedure
(g2:clear-palette DEVICE) procedure
(g2:spline DEVICE NUM F64VECTOR O) procedure
(g2:b-spline DEVICE NUM F64VECTOR O) procedure
(g2:filled-spline DEVICE NUM F64VECTOR O) procedure
(g2:filled-b-spline DEVICE NUM F64VECTOR O) procedure
(g2:set-font-size DEVICE SIZE) procedure
(g2:plot-r DEVICE DX DY) procedure
(g2:save DEVICE) procedure
(g2:move DEVICE X Y) procedure
(g2:ink DEVICE RED GREEN BLUE) procedure

Returns a COLOR

(g2:raspln DEVICE NUM F64VECTOR) procedure
(g2:filled-raspln DEVICE NUM F64VECTOR) procedure
(g2:attach VDEVICE DEVICE) procedure
(g2:line DEVICE X1 Y1 X2 Y2) procedure
(g2:triangle DEVICE X1 Y1 X2 Y2 X3 Y3) procedure
(g2:filled-triangle DEVICE X1 Y1 X2 Y2 X3 Y3) procedure
(g2:circle DEVICE X Y R) procedure
(g2:filled-circle DEVICE X Y R) procedure
(g2:rectangle DEVICE X1 Y1 X2 Y2) procedure
(g2:filled-rectangle DEVICE X1 Y1 X2 Y2) procedure
(g2:ellipse DEVICE X Y R1 R2) procedure
(g2:filled-ellipse DEVICE X Y R1 R2) procedure
(g2:line DEVICE DX DY) procedure
(g2:para-3 DEVICE NUM F64VECTOR) procedure
(g2:para-5 DEVICE NUM F64VECTOR) procedure
(g2:filled-para-3 DEVICE NUM F64VECTOR) procedure
(g2:filled-para-5 DEVICE NUM F64VECTOR) procedure
(g2:plot-qp DEVICE X Y) procedure
(g2:query-pointer DEVICE) procedure

Returns X, Y and BUTTON

g2:ps-land constant
g2:ps-port constant

Part of enum PS-ORIENTATION

g2:a0 constant
g2:a1 constant
g2:a2 constant
g2:a3 constant
g2:a4 constant
g2:a5 constant
g2:a6 constant
g2:a7 constant
g2:a8 constant
g2:a9 constant
g2:b0 constant
g2:b1 constant
g2:b2 constant
g2:b3 constant
g2:b4 constant
g2:b5 constant
g2:b6 constant
g2:b7 constant
g2:b8 constant
g2:b9 constant
g2:b10 constant
g2:dl-envelope constant
g2:c5-envelope constant
g2:comm-10-envelope constant
g2:folio constant
g2:executive constant
g2:legal constant
g2:letter constant
g2:ledger constant
g2:tabloid constant

Part of enum PS-PAPER.

g2:ps-epsf constant
g2:ps-epsf-clip constant
g2:ps-post-script constant

Part of enum PS-FORMAT.

(g2:open-ps FILENAME PS-PAPER PS-ORIENTATION) procedure
(g2:open-epsf FILENAME) procedure
(g2:open-epsf-clip FILENAME WIDTH HEIGHT) procedure
(g2:open-fig FILENAME) procedure

Return a DEVICE object.

GD integration

If the GD library is installed on your system, the following definitions are available:

g2:gd-jpeg constant
g2:gd-png constant

Part of enum GD-TYPE

(g2:open-gd FILENAME WIDTH HEIGHT GD-TYPE) procedure

Returns a DEVICE object.

X11 integration

If X11 is available, you can also create X11 Window devices:

(g2:open-x11 WIDTH HEIGHT) procedure
(g2:open-x11x WIDTH HEIGHT X Y WINDOWNAME ICONNAME U8VECTOR ICONWIDTH ICONHEIGHT) procedure

Both procedures return a DEVICE object.

Example

(require-extension g2 extras)

(define d (g2:open-x11 50 50))
(g2:line d 5 5 45 45)
(g2:circle d 25 25 20)

(let loop ()
  (let-values (((_ _ b) (g2:query-pointer d)))
    (when (< b 256) (loop))))

(g2:close d)

Assorted tips

On Debian and Debian-derived systems (e.g., Ubuntu), you'll need the following packages: libg2-dev and libgd2-xpm-dev

Changelog

License

Copyright (c) 2011, Felix L. Winkelmann
All rights reserved.
 
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
 
Neither the name of the author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
  
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Contents »