pscanvas.h

Go to the documentation of this file.
00001 
00004 
00005 //
00006 // Copyright (c) 2001-2004 California Institute of Technology
00007 // Copyright (c) 2004-2007 University of Southern California
00008 // Rob Peters <rjpeters at usc dot edu>
00009 //
00010 // created: Mon Aug 27 17:18:49 2001
00011 // commit: $Id: pscanvas.h 10065 2007-04-12 05:54:56Z rjpeters $
00012 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/gfx/pscanvas.h $
00013 //
00014 // --------------------------------------------------------------------
00015 //
00016 // This file is part of GroovX.
00017 //   [http://ilab.usc.edu/rjpeters/groovx/]
00018 //
00019 // GroovX is free software; you can redistribute it and/or modify it
00020 // under the terms of the GNU General Public License as published by
00021 // the Free Software Foundation; either version 2 of the License, or
00022 // (at your option) any later version.
00023 //
00024 // GroovX is distributed in the hope that it will be useful, but
00025 // WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027 // General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with GroovX; if not, write to the Free Software Foundation,
00031 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00032 //
00034 
00035 #ifndef GROOVX_GFX_PSCANVAS_H_UTC20050626084024_DEFINED
00036 #define GROOVX_GFX_PSCANVAS_H_UTC20050626084024_DEFINED
00037 
00038 #include "gfx/canvas.h"
00039 
00040 namespace Gfx
00041 {
00042   class PSCanvas;
00043 }
00044 
00046 class Gfx::PSCanvas : public Gfx::Canvas
00047 {
00048 public:
00049   PSCanvas(const char* filename);
00050 
00051   virtual ~PSCanvas() throw();
00052 
00053   virtual geom::vec3<double> screenFromWorld3(const geom::vec3<double>& world_pos) const;
00054   virtual geom::vec3<double> worldFromScreen3(const geom::vec3<double>& screen_pos) const;
00055 
00056   virtual geom::rect<int> getScreenViewport() const;
00057 
00058 
00059   virtual bool isRgba() const;
00060   virtual bool isColorIndex() const;
00061   virtual bool isDoubleBuffered() const;
00062 
00063   virtual unsigned int bitsPerPixel() const;
00064 
00065   virtual void throwIfError(const char* where,
00066                             const rutz::file_pos& pos) const;
00067 
00068 
00069   virtual void pushAttribs(const char* comment="");
00070   virtual void popAttribs();
00071 
00072   virtual void drawOnFrontBuffer();
00073   virtual void drawOnBackBuffer();
00074 
00075   virtual void setColor(const Gfx::RgbaColor& rgba);
00076   virtual void setClearColor(const Gfx::RgbaColor& rgba);
00077 
00078   virtual void setColorIndex(unsigned int index);
00079   virtual void setClearColorIndex(unsigned int index);
00080 
00083   virtual void swapForeBack();
00084 
00085   virtual void setPolygonFill(bool on);
00086   virtual void setPointSize(double size);
00087   virtual void setLineWidth(double width);
00088   virtual void setLineStipple(unsigned short bit_pattern);
00089 
00090   virtual void enableAntialiasing();
00091 
00092 
00093 
00094   virtual void viewport(int x, int y, int w, int h);
00095 
00096   virtual void orthographic(const geom::rect<double>& bounds,
00097                             double zNear, double zFar);
00098 
00099   virtual void perspective(double fovy, double aspect,
00100                            double zNear, double zFar);
00101 
00102 
00103   virtual void pushMatrix(const char* comment="");
00104   virtual void popMatrix();
00105 
00106   virtual void translate(const geom::vec3<double>& v);
00107   virtual void scale(const geom::vec3<double>& v);
00108   virtual void rotate(const geom::vec3<double>& v, double degrees);
00109 
00110   virtual void transform(const geom::txform& tx);
00111   virtual void loadMatrix(const geom::txform& tx);
00112 
00113 
00114 
00115   virtual void drawPixels(const media::bmap_data& data,
00116                           const geom::vec3<double>& world_pos,
00117                           const geom::vec2<double>& zoom);
00118 
00119   virtual void drawBitmap(const media::bmap_data& data,
00120                           const geom::vec3<double>& world_pos);
00121 
00122   virtual void grabPixels(const geom::rect<int>& bounds,
00123                           media::bmap_data& data_out);
00124 
00125   virtual void clearColorBuffer();
00126   virtual void clearColorBuffer(const geom::rect<int>& screen_rect);
00127 
00128   virtual void drawRect(const geom::rect<double>& rect);
00129 
00130   virtual void drawCircle(double inner_radius, double outer_radius, bool fill,
00131                           unsigned int slices, unsigned int loops);
00132 
00133   virtual void drawCylinder(double base_radius, double top_radius,
00134                             double height, int slices, int stacks,
00135                             bool fill);
00136 
00137   virtual void drawSphere(double radius, int slices, int stacks,
00138                           bool fill);
00139 
00140   virtual void drawBezier4(const geom::vec3<double>& p1,
00141                            const geom::vec3<double>& p2,
00142                            const geom::vec3<double>& p3,
00143                            const geom::vec3<double>& p4,
00144                            unsigned int subdivisions);
00145 
00146   virtual void drawBezierFill4(const geom::vec3<double>& center,
00147                                const geom::vec3<double>& p1,
00148                                const geom::vec3<double>& p2,
00149                                const geom::vec3<double>& p3,
00150                                const geom::vec3<double>& p4,
00151                                unsigned int subdivisions);
00152 
00153   virtual void beginPoints(const char* comment="");
00154   virtual void beginLines(const char* comment="");
00155   virtual void beginLineStrip(const char* comment="");
00156   virtual void beginLineLoop(const char* comment="");
00157   virtual void beginTriangles(const char* comment="");
00158   virtual void beginTriangleStrip(const char* comment="");
00159   virtual void beginTriangleFan(const char* comment="");
00160   virtual void beginQuads(const char* comment="");
00161   virtual void beginQuadStrip(const char* comment="");
00162   virtual void beginPolygon(const char* comment="");
00163 
00164   virtual void vertex2(const geom::vec2<double>& v);
00165   virtual void vertex3(const geom::vec3<double>& v);
00166 
00167   virtual void end();
00168 
00169   virtual void drawRasterText(const rutz::fstring& text,
00170                               const GxRasterFont& font);
00171   virtual void drawVectorText(const rutz::fstring& text,
00172                               const GxVectorFont& font);
00173 
00174   virtual void flushOutput();
00175 
00176   class Impl;
00177 
00178 private:
00179   PSCanvas(const PSCanvas&);
00180   PSCanvas& operator=(const PSCanvas&);
00181 
00182   Impl* rep;
00183 };
00184 
00185 static const char __attribute__((used)) vcid_groovx_gfx_pscanvas_h_utc20050626084024[] = "$Id: pscanvas.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00186 #endif // !GROOVX_GFX_PSCANVAS_H_UTC20050626084024_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:39 2008 by Doxygen version 1.5.5.