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

ufo::UGL_Graphics Class Reference

OpenGL implementation of the UGraphics interface. More...

#include <ugl_graphics.hpp>

Inheritance diagram for ufo::UGL_Graphics:

ufo::UGraphics ufo::UObject ufo::UCollectable List of all members.

Public Member Functions

 UGL_Graphics (UContext *context)
virtual UContextgetContext () const
virtual void resetDeviceAttributes ()
virtual void resetDeviceViewMatrix ()
virtual URectangle mapToDevice (const URectangle &rect)
virtual URectangle mapFromDevice (const URectangle &rect)
virtual void begin ()
virtual void end ()
virtual void flush ()
virtual void clear ()
virtual UImageIOdump ()
virtual void setColor (const UColor &color)
virtual UColor getColor () const
virtual void setClearColor (const UColor &clearColor)
virtual UColor getClearColor () const
virtual void setFont (const UFont &font)
virtual UFont getFont () const
virtual void setEnabled (GCState state, bool b)
virtual bool isEnabled (GCState state) const
virtual void drawString (const std::string &text, int x=0, int y=0)
virtual UDimension getStringSize (const std::string &string)
virtual void setClipRect (const URectangle &rect)
virtual URectangle getClipRect () const
virtual void setLineWidth (float width)
virtual float getLineWidth () const
virtual void translate (float x, float y)
virtual float getTranslationX () const
virtual float getTranslationY () const
virtual void drawRect (const URectangle &rect)
virtual void fillRect (const URectangle &rect)
virtual void drawLine (const UPoint &p1, const UPoint &p2)
virtual void drawVertexArray (VertexType type, UVertexArray *buffer)
virtual void drawImage (UImage *image, const URectangle &rect)
virtual void drawSubImage (UImage *image, const URectangle &srcRect, const URectangle &destRect)

Detailed Description

OpenGL implementation of the UGraphics interface.

This class is not part of the official UFO API and may be changed without warning.

Author:
Johannes Schmidt


Member Function Documentation

virtual void ufo::UGL_Graphics::begin  )  [virtual]
 

Begins drawing operations. This sets all desired states and view transformation for painting UFO widgets. Drawing may be cached and delayed until the end call (or even later).

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::clear  )  [virtual]
 

Clears the screen with the clear color.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::drawImage UImage image,
const URectangle rect
[virtual]
 

Draws the given image at the specified position, eventually scaled on the fly when width and height differ from the image size.

Parameters:
x The x coordinate for drawing
y The y coordinate for drawing
w The width of the drawn image
h The height of the drawn image

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::drawLine const UPoint p1,
const UPoint p2
[virtual]
 

Draws a line with the given coordinates and the current color.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::drawRect const URectangle rect  )  [virtual]
 

draws the outline of the given rectangle with the current writing color.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::drawString const std::string &  text,
int  x = 0,
int  y = 0
[virtual]
 

Draws the given character string at the specified position using the current font.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::drawSubImage UImage image,
const URectangle srcRect,
const URectangle destRect
[virtual]
 

Draws the given image at the specified position, eventually scaled on the fly when width and height differ from the sub image size. If destRect.w and destRect.h are 0, the image is drawn without scaling

Parameters:
srcRect The source rectangle of the sub image
destLocation The location on this graphics object to paint the subimage

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::drawVertexArray VertexType  type,
UVertexArray buffer
[virtual]
 

Draws the given vertex array with the given drawing method. Note that for triangles, only convex polygons are allowed. Order should always be clockwise!

Implements ufo::UGraphics.

virtual UImageIO* ufo::UGL_Graphics::dump  )  [virtual]
 

Dumps the screen contence to the new image io object. May be very slow when using hardware accelereated rendering.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::end  )  [virtual]
 

Ends drawing operations and reverts all changed states to the old state. Flushes all drawing operations.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::fillRect const URectangle rect  )  [virtual]
 

fills the given rectangle with the current writing color.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::flush  )  [virtual]
 

Deprecated:

Reimplemented from ufo::UGraphics.

virtual URectangle ufo::UGL_Graphics::getClipRect  )  const [virtual]
 

Returns the clip rect in root coordinates.

Implements ufo::UGraphics.

virtual UColor ufo::UGL_Graphics::getColor  )  const [virtual]
 

Returns the color which was previously set by setColor. May differ from the color of the underlying graphics context, when the color was directly set (without this graphics object).

See also:
setColor

Implements ufo::UGraphics.

virtual UContext* ufo::UGL_Graphics::getContext  )  const [virtual]
 

Returns the context which is used for the drawing operations.

Implements ufo::UGraphics.

virtual UFont ufo::UGL_Graphics::getFont  )  const [virtual]
 

Returns the font for this graphics object.

Implements ufo::UGraphics.

virtual UDimension ufo::UGL_Graphics::getStringSize const std::string &  string  )  [virtual]
 

Returns the bounding rect for the given character string using the current font.

Implements ufo::UGraphics.

virtual URectangle ufo::UGL_Graphics::mapFromDevice const URectangle rect  )  [virtual]
 

Maps the rectangle rect from the underlying graphics device, i.e. the OpenGL context to root coordinates! (which means to coordinates of the root pane)

Implements ufo::UGraphics.

virtual URectangle ufo::UGL_Graphics::mapToDevice const URectangle rect  )  [virtual]
 

Maps the rectangle rect, which is in the coordinate space of this graphics object, to the underlying graphics device, i.e. the OpenGL context.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::resetDeviceAttributes  )  [virtual]
 

Explicitly resets attributes. Is also called by begin. This might be interesting if calling begin is not an option.

See also:
begin

Reimplemented from ufo::UGraphics.

virtual void ufo::UGL_Graphics::resetDeviceViewMatrix  )  [virtual]
 

Explicitly resets the view matrix. Is also called by begin. This might be interesting if calling begin is not an option.

See also:
begin

Reimplemented from ufo::UGraphics.

virtual void ufo::UGL_Graphics::setClipRect const URectangle rect  )  [virtual]
 

Sets the clip rect in root coordinates. If rect is empty, clipping is disabled.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::setColor const UColor color  )  [virtual]
 

Sets the color for this graphics object. Changes internally the color for the underlying graphics context.

Parameters:
color The new color for this graphics object

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::setFont const UFont font  )  [virtual]
 

Sets the font for this graphics object.

Implements ufo::UGraphics.

virtual void ufo::UGL_Graphics::translate float  x,
float  y
[virtual]
 

Translates the coordinate system by the given x and y values.

Implements ufo::UGraphics.


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt