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

ufo::UGraphics Class Reference

The Graphics object is a basic wrapper for drawing functions and some higher level drawing functions. More...

#include <ugraphics.hpp>

Inheritance diagram for ufo::UGraphics:

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

Public Types

enum  VertexType {
  Points, Lines, LineStrip, Triangles,
  TriangleStrip, TriangleFan
}
enum  GCState { Blending = 1, SmoothShading, LineAntialiasing, FillAntialiasing }

Public Member Functions

virtual UContextgetContext () const =0
virtual URectangle mapToDevice (const URectangle &rect)=0
virtual URectangle mapFromDevice (const URectangle &rect)=0
virtual void begin ()=0
virtual void end ()=0
virtual void clear ()=0
virtual UImageIOdump ()=0
virtual void resetDeviceAttributes ()
virtual void resetDeviceViewMatrix ()
void flush ()
virtual void setEnabled (GCState state, bool b)=0
virtual bool isEnabled (GCState state) const =0
virtual void setColor (const UColor &color)=0
virtual UColor getColor () const =0
virtual void setClearColor (const UColor &clearColor)=0
virtual UColor getClearColor () const =0
virtual void setFont (const UFont &font)=0
virtual UFont getFont () const =0
virtual void drawString (const std::string &string, int x=0, int y=0)=0
virtual UDimension getStringSize (const std::string &string)=0
virtual void setClipRect (const URectangle &rect)=0
virtual URectangle getClipRect () const =0
virtual void setLineWidth (float width)=0
virtual float getLineWidth () const =0
virtual void translate (float x, float y)=0
virtual float getTranslationX () const =0
virtual float getTranslationY () const =0
virtual void drawRect (const URectangle &rect)=0
virtual void fillRect (const URectangle &rect)=0
virtual void drawLine (const UPoint &p1, const UPoint &p2)=0
virtual void drawVertexArray (VertexType type, UVertexArray *buffer)=0
virtual void drawImage (UImage *image, const URectangle &rect)=0
virtual void drawSubImage (UImage *image, const URectangle &srcRect, const URectangle &destRect)=0
void drawRect (int x, int y, int w, int h)
void fillRect (int x, int y, int w, int h)
void drawLine (int x1, int y1, int x2, int y2)
void drawImage (UImage *image, int x, int y)
void drawImage (UImage *image, const UPoint &p)
void drawImage (UImage *image, int x, int y, int w, int h)
void drawSubImage (UImage *image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY)
void drawSubImage (UImage *image, const URectangle &srcRect, const UPoint &destLocation)
void drawSubImage (UImage *image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight)

Detailed Description

The Graphics object is a basic wrapper for drawing functions and some higher level drawing functions.

The first argument of every drawing method (paint...) is a pointer to the graphics object.

The graphics object may paint directly to the screen, to an OpenGL context or to an offscreen image.

Author:
Johannes Schmidt


Member Function Documentation

virtual void ufo::UGraphics::begin  )  [pure 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).

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::clear  )  [pure virtual]
 

Clears the screen with the clear color.

Implemented in ufo::UGL_Graphics.

void ufo::UGraphics::drawImage UImage image,
int  x,
int  y
[inline]
 

virtual void ufo::UGraphics::drawImage UImage image,
const URectangle rect
[pure 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

Implemented in ufo::UGL_Graphics.

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

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

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::drawRect const URectangle rect  )  [pure virtual]
 

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

Implemented in ufo::UGL_Graphics.

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

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

Implemented in ufo::UGL_Graphics.

void ufo::UGraphics::drawSubImage UImage image,
const URectangle srcRect,
const UPoint destLocation
[inline]
 

virtual void ufo::UGraphics::drawSubImage UImage image,
const URectangle srcRect,
const URectangle destRect
[pure 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

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::drawVertexArray VertexType  type,
UVertexArray buffer
[pure 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!

Implemented in ufo::UGL_Graphics.

virtual UImageIO* ufo::UGraphics::dump  )  [pure virtual]
 

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

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::end  )  [pure virtual]
 

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

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::fillRect const URectangle rect  )  [pure virtual]
 

fills the given rectangle with the current writing color.

Implemented in ufo::UGL_Graphics.

void ufo::UGraphics::flush  )  [inline]
 

Deprecated:

Reimplemented in ufo::UGL_Graphics.

virtual URectangle ufo::UGraphics::getClipRect  )  const [pure virtual]
 

Returns the clip rect in root coordinates.

Implemented in ufo::UGL_Graphics.

virtual UColor ufo::UGraphics::getColor  )  const [pure 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

Implemented in ufo::UGL_Graphics.

virtual UContext* ufo::UGraphics::getContext  )  const [pure virtual]
 

Returns the context which is used for the drawing operations.

Implemented in ufo::UGL_Graphics.

virtual UFont ufo::UGraphics::getFont  )  const [pure virtual]
 

Returns the font for this graphics object.

Implemented in ufo::UGL_Graphics.

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

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

Implemented in ufo::UGL_Graphics.

virtual URectangle ufo::UGraphics::mapFromDevice const URectangle rect  )  [pure 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)

Implemented in ufo::UGL_Graphics.

virtual URectangle ufo::UGraphics::mapToDevice const URectangle rect  )  [pure 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.

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::resetDeviceAttributes  )  [inline, virtual]
 

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

See also:
begin

Reimplemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::resetDeviceViewMatrix  )  [inline, 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 in ufo::UGL_Graphics.

virtual void ufo::UGraphics::setClipRect const URectangle rect  )  [pure virtual]
 

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

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::setColor const UColor color  )  [pure 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

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::setFont const UFont font  )  [pure virtual]
 

Sets the font for this graphics object.

Implemented in ufo::UGL_Graphics.

virtual void ufo::UGraphics::translate float  x,
float  y
[pure virtual]
 

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

Implemented in ufo::UGL_Graphics.


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