((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/g2" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "g2" (toc) (section 3 "Description" (p "An interface to the " (link "http://g2.sourceforge.net" "g2") " graphics library.")) (section 3 "Author" (p (int-link "/users/felix winkelmann" "felix winkelmann"))) (section 3 "Requirements" (p (int-link "easyffi"))) (section 3 "Documentation" (p "The following definitions are exported from this extension. Consult the g2 documentation for more information.") (def (sig (constant "qpcirc" (id qpcirc)) (constant "qprect" (id qprect))) (p "Part of enum " (tt "QPSHAPE") ".")) (def (sig (procedure "(g2:poly-line DEVICE NUM F64VECTOR)" (id g2:poly-line)) (procedure "(g2:set-background DEVICE COLOR)" (id g2:set-background)) (procedure "(g2:arc DEVICE X Y R1 R2 A1 A2)" (id g2:arc)) (procedure "(g2:filled-arc DEVICE X Y R1 R2 A1 A2)" (id g2:filled-arc)))) (def (sig (procedure "(g2:ld DEVICE)" (id g2:ld))) (p "(returns " (tt "LD") ")")) (def (sig (procedure "(g2:set-ld DEVICE)" (id g2:set-ld)) (procedure "(g2:string DEVICE X Y STRING)" (id g2:string)) (procedure "(g2:set-qp DEVICE D QPSHAPE)" (id g2:set-qp)) (procedure "(g2:set-coordinate-system DEVICE XORIGIN YORIGIN XMUL YMUL)" (id g2:set-coordinate-system)) (procedure "(g2:set-dash DEVICE NUM F64FECTOR)" (id g2:set-dash)) (procedure "(g2:close DEVICE)" (id g2:close)) (procedure "(g2:move-r DEVICE DX DY)" (id g2:move-r)) (procedure "(g2:line-to DEVICE X Y)" (id g2:line-to)) (procedure "(g2:pen DEVICE COLOR)" (id g2:pen)) (procedure "(g2:flush DEVICE)" (id g2:flush)) (procedure "(g2:set-line-width DEVICE WIDTH)" (id g2:set-line-width)) (procedure "(g2:clear DEVICE)" (id g2:clear)) (procedure "(g2:set-auto-flush DEVICE BOOL)" (id g2:set-auto-flush)) (procedure "(g2:allocate-basic-colors DEVICE)" (id g2:allocate-basic-colors)) (procedure "(g2:image DEVICE X Y XSIZE YSIZE S32VECTOR)" (id g2:image)) (procedure "(g2:detach VDEVICE DEVICE)" (id g2:detach)) (procedure "(g2:polygon DEVICE NUM F64VECTOR)" (id g2:polygon)) (procedure "(g2:filled-polygon DEVICE NUM F64VECTOR)" (id g2:filled-polygon)))) (def (sig (procedure "(g2:open-vd)" (id g2:open-vd))) (p "Returns a " (tt "VDEVICE"))) (def (sig (procedure "(g2:plot DEVICCE X Y)" (id g2:plot)) (procedure "(g2:reset-palette DEVICE)" (id g2:reset-palette)) (procedure "(g2:clear-palette DEVICE)" (id g2:clear-palette)) (procedure "(g2:spline DEVICE NUM F64VECTOR O)" (id g2:spline)) (procedure "(g2:b-spline DEVICE NUM F64VECTOR O)" (id g2:b-spline)) (procedure "(g2:filled-spline DEVICE NUM F64VECTOR O)" (id g2:filled-spline)) (procedure "(g2:filled-b-spline DEVICE NUM F64VECTOR O)" (id g2:filled-b-spline)) (procedure "(g2:set-font-size DEVICE SIZE)" (id g2:set-font-size)) (procedure "(g2:plot-r DEVICE DX DY)" (id g2:plot-r)) (procedure "(g2:save DEVICE)" (id g2:save)) (procedure "(g2:move DEVICE X Y)" (id g2:move)))) (def (sig (procedure "(g2:ink DEVICE RED GREEN BLUE)" (id g2:ink))) (p "Returns a " (tt "COLOR"))) (def (sig (procedure "(g2:raspln DEVICE NUM F64VECTOR)" (id g2:raspln)) (procedure "(g2:filled-raspln DEVICE NUM F64VECTOR)" (id g2:filled-raspln)) (procedure "(g2:attach VDEVICE DEVICE)" (id g2:attach)) (procedure "(g2:line DEVICE X1 Y1 X2 Y2)" (id g2:line)) (procedure "(g2:triangle DEVICE X1 Y1 X2 Y2 X3 Y3)" (id g2:triangle)) (procedure "(g2:filled-triangle DEVICE X1 Y1 X2 Y2 X3 Y3)" (id g2:filled-triangle)) (procedure "(g2:circle DEVICE X Y R)" (id g2:circle)) (procedure "(g2:filled-circle DEVICE X Y R)" (id g2:filled-circle)) (procedure "(g2:rectangle DEVICE X1 Y1 X2 Y2)" (id g2:rectangle)) (procedure "(g2:filled-rectangle DEVICE X1 Y1 X2 Y2)" (id g2:filled-rectangle)) (procedure "(g2:ellipse DEVICE X Y R1 R2)" (id g2:ellipse)) (procedure "(g2:filled-ellipse DEVICE X Y R1 R2)" (id g2:filled-ellipse)) (procedure "(g2:line DEVICE DX DY)" (id g2:line)) (procedure "(g2:para-3 DEVICE NUM F64VECTOR)" (id g2:para-3)) (procedure "(g2:para-5 DEVICE NUM F64VECTOR)" (id g2:para-5)) (procedure "(g2:filled-para-3 DEVICE NUM F64VECTOR)" (id g2:filled-para-3)) (procedure "(g2:filled-para-5 DEVICE NUM F64VECTOR)" (id g2:filled-para-5)) (procedure "(g2:plot-qp DEVICE X Y)" (id g2:plot-qp)))) (def (sig (procedure "(g2:query-pointer DEVICE)" (id g2:query-pointer))) (p "Returns " (tt "X") ", " (tt "Y") " and " (tt "BUTTON"))) (def (sig (constant "g2:ps-land" (id g2:ps-land)) (constant "g2:ps-port" (id g2:ps-port))) (p "Part of enum " (tt "PS-ORIENTATION"))) (def (sig (constant "g2:a0" (id g2:a0)) (constant "g2:a1" (id g2:a1)) (constant "g2:a2" (id g2:a2)) (constant "g2:a3" (id g2:a3)) (constant "g2:a4" (id g2:a4)) (constant "g2:a5" (id g2:a5)) (constant "g2:a6" (id g2:a6)) (constant "g2:a7" (id g2:a7)) (constant "g2:a8" (id g2:a8)) (constant "g2:a9" (id g2:a9)) (constant "g2:b0" (id g2:b0)) (constant "g2:b1" (id g2:b1)) (constant "g2:b2" (id g2:b2)) (constant "g2:b3" (id g2:b3)) (constant "g2:b4" (id g2:b4)) (constant "g2:b5" (id g2:b5)) (constant "g2:b6" (id g2:b6)) (constant "g2:b7" (id g2:b7)) (constant "g2:b8" (id g2:b8)) (constant "g2:b9" (id g2:b9)) (constant "g2:b10" (id g2:b10)) (constant "g2:dl-envelope" (id g2:dl-envelope)) (constant "g2:c5-envelope" (id g2:c5-envelope)) (constant "g2:comm-10-envelope" (id g2:comm-10-envelope)) (constant "g2:folio" (id g2:folio)) (constant "g2:executive" (id g2:executive)) (constant "g2:legal" (id g2:legal)) (constant "g2:letter" (id g2:letter)) (constant "g2:ledger" (id g2:ledger)) (constant "g2:tabloid" (id g2:tabloid))) (p "Part of enum " (tt "PS-PAPER") ".")) (def (sig (constant "g2:ps-epsf" (id g2:ps-epsf)) (constant "g2:ps-epsf-clip" (id g2:ps-epsf-clip)) (constant "g2:ps-post-script" (id g2:ps-post-script))) (p "Part of enum " (tt "PS-FORMAT") ".")) (def (sig (procedure "(g2:open-ps FILENAME PS-PAPER PS-ORIENTATION)" (id g2:open-ps)) (procedure "(g2:open-epsf FILENAME)" (id g2:open-epsf)) (procedure "(g2:open-epsf-clip FILENAME WIDTH HEIGHT)" (id g2:open-epsf-clip)) (procedure "(g2:open-fig FILENAME)" (id g2:open-fig))) (p "Return a " (tt "DEVICE") " object.")) (section 4 "GD integration" (p "If the " (link "http://www.boutell.com/gd" "GD") " library is installed on your system, the following definitions are available:") (def (sig (constant "g2:gd-jpeg" (id g2:gd-jpeg)) (constant "g2:gd-png" (id g2:gd-png))) (p "Part of enum " (tt "GD-TYPE"))) (def (sig (procedure "(g2:open-gd FILENAME WIDTH HEIGHT GD-TYPE)" (id g2:open-gd))) (p "Returns a " (tt "DEVICE") " object."))) (section 4 "X11 integration" (p "If X11 is available, you can also create X11 Window devices:") (def (sig (procedure "(g2:open-x11 WIDTH HEIGHT)" (id g2:open-x11)) (procedure "(g2:open-x11x WIDTH HEIGHT X Y WINDOWNAME ICONNAME U8VECTOR ICONWIDTH ICONHEIGHT)" (id g2:open-x11x))) (p "Both procedures return a " (tt "DEVICE") " object.")))) (section 3 "Example" (highlight scheme "(require-extension g2 extras)\n\n(define d (g2:open-x11 50 50))\n(g2:line d 5 5 45 45)\n(g2:circle d 25 25 20)\n\n(let loop ()\n  (let-values (((_ _ b) (g2:query-pointer d)))\n    (when (< b 256) (loop))))\n\n(g2:close d)")) (section 3 "Assorted tips" (p "On Debian and Debian-derived systems (e.g., Ubuntu), you'll need the following packages: " (tt "libg2-dev") " and " (tt "libgd2-xpm-dev"))) (section 3 "Changelog" (ul (li "1.2 Ported to chicken 4 (" (int-link "/users/mario-domenech-goulart" "Mario Domenech Goulart") ")") (li "1.1 Adapted to new easyffi egg, fixed a few bugs") (li "1.0 Initial release"))) (section 3 "License" (pre "Copyright (c) 2011, Felix L. Winkelmann\nAll rights reserved.\n \nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\nRedistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n \nNeither the name of the author nor the names of its contributors may\nbe used to endorse or promote products derived from this software\nwithout specific prior written permission.\n  \nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\nBUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\nOF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\nAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY\nWAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE."))))