- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ugl_graphics.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/gl/ugl_graphics.hpp 00008 begin : Fri Oct 17 2003 00009 $Id: ugl_graphics.hpp,v 1.6 2005/10/11 19:16:39 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00026 ***************************************************************************/ 00027 00028 #ifndef UGL_GRAPHICS_HPP 00029 #define UGL_GRAPHICS_HPP 00030 00031 #include "../ugraphics.hpp" 00032 00033 #include "../util/urectangle.hpp" 00034 #include "../util/ucolor.hpp" 00035 00036 namespace ufo { 00037 00038 class UImageIO; 00039 00050 class UFO_EXPORT UGL_Graphics : public UGraphics { 00051 UFO_DECLARE_DYNAMIC_CLASS(UGL_Graphics) 00052 public: 00053 UGL_Graphics(UContext * context); 00054 virtual ~UGL_Graphics(); 00055 00056 public: // Implements UGraphics 00057 virtual UContext * getContext() const; 00058 00059 virtual void resetDeviceAttributes(); 00060 virtual void resetDeviceViewMatrix(); 00061 00062 virtual URectangle mapToDevice(const URectangle & rect); 00063 virtual URectangle mapFromDevice(const URectangle & rect); 00064 00065 virtual void begin(); 00066 virtual void end(); 00067 virtual void flush(); 00068 virtual void clear(); 00069 virtual UImageIO * dump(); 00070 00071 virtual void setColor(const UColor & color); 00072 virtual UColor getColor() const; 00073 00074 virtual void setClearColor(const UColor & clearColor); 00075 virtual UColor getClearColor() const; 00076 00077 virtual void setFont(const UFont & font); 00078 virtual UFont getFont() const; 00079 00080 virtual void setEnabled(GCState state, bool b); 00081 virtual bool isEnabled(GCState state) const; 00082 00083 00084 virtual void drawString(const std::string & text, int x = 0, int y = 0); 00085 virtual UDimension getStringSize(const std::string & string); 00086 00087 00088 //virtual void pushClipRect(); 00089 //virtual void popClipRect(); 00090 virtual void setClipRect(const URectangle & rect); 00091 virtual URectangle getClipRect() const; 00092 00093 virtual void setLineWidth(float width); 00094 virtual float getLineWidth() const; 00095 00096 virtual void translate(float x, float y); 00097 virtual float getTranslationX() const; 00098 virtual float getTranslationY() const; 00099 00100 00101 virtual void drawRect(const URectangle & rect); 00102 virtual void fillRect(const URectangle & rect); 00103 virtual void drawLine(const UPoint & p1, const UPoint & p2); 00104 00105 virtual void drawVertexArray(VertexType type, UVertexArray * buffer); 00106 00107 virtual void drawImage(UImage * image, const URectangle & rect); 00108 00109 virtual void drawSubImage(UImage * image, 00110 const URectangle & srcRect, const URectangle & destRect); 00111 00112 private: 00113 UContext * m_context; 00114 UColor m_color; 00115 UColor m_clearColor; 00116 UFont m_font; 00117 URectangle m_clipRect; 00118 float m_translationX; 00119 float m_translationY; 00120 }; 00121 00122 } // namespace ufo 00123 00124 #endif // UGL_GRAPHICS_HPP

The libUFO Project - written by Johannes Schmidt