Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Graphic Class Reference

Graphic library. More...

#include <graphic.hpp>

Inheritance diagram for Graphic:

Inheritance graph
[legend]
Collaboration diagram for Graphic:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Graphic ()
 Constructor.
 ~Graphic ()
 Destructor.
bool createWindow (int, int, bool)
 Create a window for drawing.
void setBGColor (float, float, float)
 Sets the background color.
void setFGColor (float, float, float)
 Sets the foreground color, that is the color used for drawing things.
void drawFixationCross ()
 Draw fixation cross at screen center.
void drawFixationCross (int, int)
 Draw fixation cross at screen center with given height and width.
void drawLine (Point, Point)
 Draw a line between two points.
void drawTriangle (Point, Point, Point)
 Draw a triangle defined by three points.
void drawRectangle (Point, Point, Point, Point)
 Draw a rectangle defined by four points.
void drawUnfilledCircle (Point, float)
 Draw an unfilled circle.
void drawCircle (Point, float)
 Draw a circle.
void clear ()
 Clear the backbuffer.
void swap ()
 Swap the backbuffer.
int addTexture (char *)
 Load a texture.
void drawTexturedRectangle (PointTex, PointTex, PointTex, PointTex, int)
 Draw a textured rectangle defined by four points with texture coordinates.

Detailed Description

Graphic library.

Definition at line 59 of file graphic.hpp.


Constructor & Destructor Documentation

Graphic::Graphic  ) 
 

Constructor.

Definition at line 27 of file graphic.cpp.

Graphic::~Graphic  ) 
 

Destructor.

Definition at line 34 of file graphic.cpp.


Member Function Documentation

int Graphic::addTexture char *  fname  ) 
 

Load a texture.

Supported are bitmap (.bmp) files.

Parameters:
fname file namePop
Returns:
index of loaded texture
Definition at line 275 of file graphic.cpp.

References clear(), drawTexturedRectangle(), ERROR, PtfCore::getMessageLog(), Singleton< PtfCore >::getSingleton(), PointTex::u, PointTex::v, PointTex::x, and PointTex::y.

Here is the call graph for this function:

void Graphic::clear  ) 
 

Clear the backbuffer.

Definition at line 259 of file graphic.cpp.

Referenced by addTexture(), and drawFixationCross().

bool Graphic::createWindow int  w,
int  h,
bool  fullscreen
 

Create a window for drawing.

Parameters:
w width of window
h height of windowOpen
fullscreen fullscreen flag
Returns:
true if window was successfully openend, else false
Definition at line 48 of file graphic.cpp.

References ERROR, PtfCore::getMessageLog(), Singleton< PtfCore >::getSingleton(), and MESSAGE.

Referenced by PtfCore::PtfCore().

Here is the call graph for this function:

void Graphic::drawCircle Point  p,
float  radius
 

Draw a circle.

Parameters:
p center point
radius radius
Definition at line 243 of file graphic.cpp.

References Point::x, and Point::y.

void Graphic::drawFixationCross int  w,
int  h
 

Draw fixation cross at screen center with given height and width.

Parameters:
w width
h height
Definition at line 156 of file graphic.cpp.

References clear(), drawLine(), setFGColor(), Point::x, and Point::y.

Here is the call graph for this function:

void Graphic::drawFixationCross  ) 
 

Draw fixation cross at screen center.

Definition at line 140 of file graphic.cpp.

References clear(), drawLine(), setFGColor(), Point::x, and Point::y.

Here is the call graph for this function:

void Graphic::drawLine Point  p1,
Point  p2
 

Draw a line between two points.

Parameters:
p1 first point
p2 second point
Definition at line 184 of file graphic.cpp.

References Point::x, and Point::y.

Referenced by drawFixationCross().

void Graphic::drawRectangle Point  p1,
Point  p2,
Point  p3,
Point  p4
 

Draw a rectangle defined by four points.

Parameters:
p1 first point
p2 second point
p3 third point
p4 fourth point
Definition at line 212 of file graphic.cpp.

References Point::x, and Point::y.

void Graphic::drawTexturedRectangle PointTex  p1,
PointTex  p2,
PointTex  p3,
PointTex  p4,
int  tex
 

Draw a textured rectangle defined by four points with texture coordinates.

Parameters:
p1 first point
p2 second point
p3 third point
p4 fourth point
tex index of texture
Definition at line 342 of file graphic.cpp.

References ERROR, PtfCore::getMessageLog(), Singleton< PtfCore >::getSingleton(), PointTex::u, PointTex::v, PointTex::x, and PointTex::y.

Referenced by addTexture().

Here is the call graph for this function:

void Graphic::drawTriangle Point  p1,
Point  p2,
Point  p3
 

Draw a triangle defined by three points.

Parameters:
p1 first point
p2 second point
p3 third point
Definition at line 197 of file graphic.cpp.

References Point::x, and Point::y.

void Graphic::drawUnfilledCircle Point  p,
float  radius
 

Draw an unfilled circle.

Parameters:
p center point
radius radius
Definition at line 226 of file graphic.cpp.

References Point::x, and Point::y.

void Graphic::setBGColor float  r,
float  g,
float  b
 

Sets the background color.

The background will have this color after the window was cleared.

Parameters:
r red color component
g green color component
b blue color component
Definition at line 133 of file graphic.cpp.

void Graphic::setFGColor float  r,
float  g,
float  b
 

Sets the foreground color, that is the color used for drawing things.

Parameters:
r red color component
g green color component
b blue color component
Definition at line 175 of file graphic.cpp.

Referenced by drawFixationCross().

void Graphic::swap  ) 
 

Swap the backbuffer.

Definition at line 266 of file graphic.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Dec 17 14:54:28 2004 for Psychological Test Framework by doxygen 1.3.8