Main Page | Namespace List | Compound List | File List | Namespace Members | Compound Members | File Members

KGLImageView::KGLImageViewer Class Reference

#include <kglimageviewer.h>

List of all members.

Public Types

typedef QValueList< KGLImageKGLImageList

Public Slots

virtual void updateGL ()

Public Member Functions

 KGLImageViewer (QWidget *parent, const char *name, float fps=25, bool interactive=true)
 ~KGLImageViewer ()
void setInteractive (bool interactive=true)
void setCanvas (const QColor &color, bool update=true)
float position (Axis a) const
float rotation (Axis a) const
float scaleFactor (Axis a) const
void rotate (Axis a, float degrees, int msecs=0)
void rotate (float xDegrees, float yDegrees, float zDegrees, bool update=true)
void rotateTo (Axis a, float degrees, int msecs=0)
void rotateTo (float xDegrees, float yDegrees, float zDegrees, bool update=true)
void scale (Axis a, float percent, int msecs=0)
void scale (float xPercent, float yPercent, bool update=true)
void scaleTo (Axis a, float percent, int msecs=0)
void scaleTo (float xPercent, float yPercent, bool update=true)
void move (Axis a, float percent, int msecs=0)
void move (float xPercent, float yPercent, float zPercent, bool update=true)
void moveTo (Axis a, float percent, int msecs=0)
void moveTo (float xPercent, float yPercent, float zPercent, bool update=true)
void message (int x, int y, QString message, int msecs, const QColor *color=0L)
void hideMessage ()
uint load (const KGLImage &image, bool show=false)
uint load (const QImage &img, bool show=false)
int load (const QString &imgPath, bool show=false)
uint load (const QPixmap &pix, bool show=false)
void remove (uint id)
int fpsDelay ()
bool providesShaders ()
KGLImageListimages ()
bool isTimerActive () const
GLhandleARB loadShader (QString file, GLenum shaderType)
ShaderListshaders ()

Protected Member Functions

void ensureTimerIsActive ()
virtual void mergeCnB (KGLImage &img)
virtual void initializeGL ()
virtual void paintGL ()
virtual void resizeGL (int w, int h)
virtual void mousePressEvent (QMouseEvent *e)
virtual void mouseReleaseEvent (QMouseEvent *e)
virtual void mouseMoveEvent (QMouseEvent *e)
virtual void wheelEvent (QWheelEvent *e)
void blur (KGLImage &img)

Friends

class KGLImage


Member Typedef Documentation

typedef QValueList<KGLImage> KGLImageView::KGLImageViewer::KGLImageList
 


Constructor & Destructor Documentation

KGLImageView::KGLImageViewer::KGLImageViewer QWidget *  parent,
const char *  name,
float  fps = 25,
bool  interactive = true
 

Creates a new image display area

Parameters:
parent The parenting QWidget
name string name for the widget
fps The framerate for animated transitions (defaults to 25/PAL, NTSC uses 29.4)
interactive Controls wheter the user may change the view position/roation/scale

KGLImageView::KGLImageViewer::~KGLImageViewer  ) 
 


Member Function Documentation

void KGLImageView::KGLImageViewer::blur KGLImage img  )  [protected]
 

void KGLImageView::KGLImageViewer::ensureTimerIsActive  )  [protected]
 

int KGLImageView::KGLImageViewer::fpsDelay  )  [inline]
 

The FPS delay, i.e. after how many milliseconds the screen is updated in animations (1000/fps)

void KGLImageView::KGLImageViewer::hideMessage  ) 
 

KGLImageList& KGLImageView::KGLImageViewer::images  )  [inline]
 

A QValueList of all currently loaded KGLImages

virtual void KGLImageView::KGLImageViewer::initializeGL  )  [protected, virtual]
 

Reimplemented from QGLWidget

bool KGLImageView::KGLImageViewer::isTimerActive  )  const
 

uint KGLImageView::KGLImageViewer::load const QPixmap &  pix,
bool  show = false
 

Conveniance function, see below.
Converts the QPixmap to a QImage and loads that

Parameters:
pix A QPixmap
show The Image is not displayed unless this flag is true or it's explicitly shown later (see KGLImage::show())

int KGLImageView::KGLImageViewer::load const QString &  imgPath,
bool  show = false
 

Conveniance function, see below.
Loads an image from a file.

Parameters:
imgPath A relative or absolute path to the image
show The Image is not displayed unless this flag is true or it's explicitly shown later (see KGLImage::show())
Returns:
the id of the just loaded image or -1 if unable to open image from path

uint KGLImageView::KGLImageViewer::load const QImage &  img,
bool  show = false
 

Load an image from a QImage
It can be accessed as images().last() as long as no other Image was loaded

Parameters:
img The QImage to use. May contain alpha level, different from OpenGL textures there are NO restrictions on the size.
show The Image is not displayed unless this flag is true or it's explicitly shown later (see KGLImage::show())
Returns:
the id of the just loaded image

uint KGLImageView::KGLImageViewer::load const KGLImage image,
bool  show = false
 

Load an image from a KGLImage
It can be referred accessed as images().last() as long as no other Image was loaded
This constructor creates a "Flat" copy of the image, i.e. the /same/ KGLImage::glObject() is used
You can however set any parameters (transformation, coloring, etc.) on this image without influencing the original

Parameters:
image The KGLImage to use. May contain alpha level, different from OpenGL textures there are NO restrictions on the size.
show The Image is not displayed unless this flag is true or it's explicitly shown later (see KGLImage::show())
Returns:
the id of the just loaded image

GLhandleARB KGLImageView::KGLImageViewer::loadShader QString  file,
GLenum  shaderType
 

Loads a vertex or fragment shader Returns the shader id (all shaders a stored in the shaders()) or 0 if shader could not be created from file

Parameters:
file The textfile that contains the shader
shaderType use GL_VERTEX_SHADER_ARB (vertexshader) or GL_FRAGMENT_SHADER_ARB (pixelshader)

virtual void KGLImageView::KGLImageViewer::mergeCnB KGLImage img  )  [protected, virtual]
 

void KGLImageView::KGLImageViewer::message int  x,
int  y,
QString  message,
int  msecs,
const QColor *  color = 0L
 

Display a message (string)

Parameters:
x The X offset in pixels
y The Y offset in pixels
message The string to display
msecs how long the Message shall be displayed
color The text color. The message will have an inverse colored translucent background.
If NULL (the default) the Widgets foreground color will be used (i might change this to the textcolor in the future)

virtual void KGLImageView::KGLImageViewer::mouseMoveEvent QMouseEvent *  e  )  [protected, virtual]
 

Reimplemented from QWidget for the interaction feature

virtual void KGLImageView::KGLImageViewer::mousePressEvent QMouseEvent *  e  )  [protected, virtual]
 

Reimplemented from QWidget for the interaction feature

virtual void KGLImageView::KGLImageViewer::mouseReleaseEvent QMouseEvent *  e  )  [protected, virtual]
 

Reimplemented from QWidget for the interaction feature

void KGLImageView::KGLImageViewer::move float  xPercent,
float  yPercent,
float  zPercent,
bool  update = true
 

void KGLImageView::KGLImageViewer::move Axis  a,
float  percent,
int  msecs = 0
 

void KGLImageView::KGLImageViewer::moveTo float  xPercent,
float  yPercent,
float  zPercent,
bool  update = true
 

void KGLImageView::KGLImageViewer::moveTo Axis  a,
float  percent,
int  msecs = 0
 

virtual void KGLImageView::KGLImageViewer::paintGL  )  [protected, virtual]
 

Reimplemented from QGLWidget, you may want to reimplement it yourself to change the scene rendering

float KGLImageView::KGLImageViewer::position Axis  a  )  const [inline]
 

The position of the viewer

Parameters:
a On which axis

bool KGLImageView::KGLImageViewer::providesShaders  )  [inline]
 

void KGLImageView::KGLImageViewer::remove uint  id  ) 
 

Removes the image with the id (glObject()) id from view
The function handles the GLlist containing the image
DON'T DARE TO CALL images().remove() directly unless you REALLY!!! know what you're doing

Parameters:
id the images glObject()

virtual void KGLImageView::KGLImageViewer::resizeGL int  w,
int  h
[protected, virtual]
 

Reimplemented from QGLWidget, you may want to reimplement it yourself to change the behaviour on resizes

void KGLImageView::KGLImageViewer::rotate float  xDegrees,
float  yDegrees,
float  zDegrees,
bool  update = true
 

Rotate around all three axes (accumulating)
Keep in mind that this is a 3D environment. If you rotate around the X xor the Y axis by 180°, the rotation direction (CW/CCW) around the Z axis is swapped

Parameters:
xDegrees Rotation around the X axis (horizontal axis)
yDegrees Rotation around the Y axis (vertical axis)
zDegrees Rotation around the Z axis (2D rotation)
update Whether the screen should be updated after this action (set false in case you want to perform several translations to the view and this is not the last)

void KGLImageView::KGLImageViewer::rotate Axis  a,
float  degrees,
int  msecs = 0
 

Rotate by some degrees (accumulating)
Keep in mind that this is a 3D environment. If you rotate around the X xor the Y axis by 180°, the rotation direction (CW/CCW) around the Z axis is swapped

Parameters:
a On which axis (use Z for a 2D rotation)
degrees How much. Values may be positive (CW) or negative (CCW). Rotates accumulative (new rotation = current rotation + degrees)
msecs How long the rotation shall last, the default is 0 - thus the new rotation is reached immediately. NOTICE: that rotation() will allways respond the current value, not the final value, while the rotation is active

void KGLImageView::KGLImageViewer::rotateTo float  xDegrees,
float  yDegrees,
float  zDegrees,
bool  update = true
 

Rotate around all three axes (NOT accumulative)
Keep in mind that this is a 3D environment. If you rotate around the X xor the Y axis by 180°, the rotation direction (CW/CCW) around the Z axis is swapped

Parameters:
xDegrees Rotation around the X axis (horizontal axis)
yDegrees Rotation around the Y axis (vertical axis)
zDegrees Rotation around the Z axis (2D rotation)
update Whether the screen should be updated after this action (set false in case you want to perform several translations to the view and this is not the last)

void KGLImageView::KGLImageViewer::rotateTo Axis  a,
float  degrees,
int  msecs = 0
 

Rotate by some degrees (NOT accumulative)
Keep in mind that this is a 3D environment. If you rotate around the X xor the Y axis by 180°, the rotation direction (CW/CCW) around the Z axis is swapped

Parameters:
a On which axis (use Z for a 2D rotation)
degrees How much. Values may be positive (CW) or negative (CCW). Rotates nonaccumulative (new rotation = degrees)
msecs How long the rotation shall last, the default is 0 - thus the new rotation is reached immediately. NOTICE: that rotation() will allways respond the current value, not the final value, while the rotation is active

float KGLImageView::KGLImageViewer::rotation Axis  a  )  const [inline]
 

The rotation of the viewer

Parameters:
a On which axis

void KGLImageView::KGLImageViewer::scale float  xPercent,
float  yPercent,
bool  update = true
 

Scale X and Y axis by some percent (accumulating)

Parameters:
yPercent 
xPercent How much. Values should be positive. Scales accumulative, i.e. if your view was previously scaled to 80% scale(X, 50%); will end up with a 40% scaled view
update Whether the screen should be updated after this action (set false in case you want to perform several translations to the view and this is not the last)

void KGLImageView::KGLImageViewer::scale Axis  a,
float  percent,
int  msecs = 0
 

Scale by some percent (accumulating)

Parameters:
a On which axis (use X or Y, Z is ignored as images don't have a third dimension)
percent How much. Values should be positive. Scales accumulative, i.e. if your view was previously scaled to 80% scale(X, 50%); will end up with a 40% scaled view
msecs How long the scaling shall last, the default is 0 - thus the new scale is reached immediately. NOTICE: that scacleFactor() will allways respond the current value, not the final value, while scaling is active

float KGLImageView::KGLImageViewer::scaleFactor Axis  a  )  const [inline]
 

The scale of the view

Parameters:
a On which axis

void KGLImageView::KGLImageViewer::scaleTo float  xPercent,
float  yPercent,
bool  update = true
 

Scale X and Y axis by some percent (NOT accumulative)

Parameters:
yPercent 
xPercent How much. Values should be positive. Scales accumulative, i.e. if your view was previously scaled to 80% scale(X, 50%); will end up with a 50% scaled view
update Whether the screen should be updated after this action (set false in case you want to perform several translations to the view and this is not the last)

void KGLImageView::KGLImageViewer::scaleTo Axis  a,
float  percent,
int  msecs = 0
 

Scale by some percent (NOT accumulative)

Parameters:
a On which axis (use X or Y, Z is ignored as images don't have a third dimension)
percent How much. Values should be positive. Scales NOT accumulative, i.e. if your view was previously scaled to 80% scale(X, 50%); will end up with a 50% scaled view
msecs How long the scaling shall last, the default is 0 - thus the new scale is reached immediately. NOTICE: that scacleFactor() will allways respond the current value, not the final value, while scaling is active

void KGLImageView::KGLImageViewer::setCanvas const QColor &  color,
bool  update = true
 

Sets the canvas, i.e. glClear Color (the background where no images appear... defaults to black)

Parameters:
color The color
update Whether to update the view right after updating the color

void KGLImageView::KGLImageViewer::setInteractive bool  interactive = true  )  [inline]
 

Whether the user may influence the view using the mouse cursor

Parameters:
interactive Yes or No ;)

ShaderList& KGLImageView::KGLImageViewer::shaders  )  [inline]
 

Returns a list of all available shader programs

virtual void KGLImageView::KGLImageViewer::updateGL  )  [virtual, slot]
 

Reimplemented to skip if timer is active, i.e. we have an animation

virtual void KGLImageView::KGLImageViewer::wheelEvent QWheelEvent *  e  )  [protected, virtual]
 

Not really reimplemented from QWidget yet


Friends And Related Function Documentation

friend class KGLImage [friend]
 


The documentation for this class was generated from the following file:
Generated on Fri Jul 28 22:36:13 2006 for KGlImageViewer by doxygen 1.3.3