Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/home/landauf/painter/miniproject/framewk/framewk.cpp File Reference

#include <stdlib.h>
#include <math.h>
#include <imagergba.h>
#include "framewk.h"
#include <iostream.h>

Go to the source code of this file.

Compounds

struct  Image
 Anonymous image struct. More...


Defines

#define HAVE_GLCOPYTEXSUBIMAGE2D

Functions

void fwkPostRedisplayNoChange (void)
 Requests a redraw of the displayed image.

void fwkWindowToImageCoordinates (int x, int y, float *ix, float *iy)
 Converts window to image coordinates.

void fwkSetDisplayHotSpot (int x, int y)
 Sets the display hot spot.

bool fwkUpdateRasterPos (void)
unsigned nextPowerOfTwo (unsigned x)
void fwkRedrawCB (void)
void fwkKeyboardCB (unsigned char key, int x, int y)
void fwkSpecialCB (int key, int x, int y)
void fwkMouseCB (int button, int state, int x, int y)
void fwkMotionCB (int x, int y)
void fwkPassiveMotionCB (int x, int y)
void fwkInit (int *argc, const char *argv[])
 Initializes the exercise framework.

void fwkMainLoop (void)
 Starts the application main-loop.

void fwkSetDisplayImage (const void *img)
 Sets the currently displayed image.

float fwkGetDisplayZoom (void)
 Gets the current zoom factor.

void fwkSetDisplayZoom (float zoom)
 Sets the current zoom factor.

void fwkPostRedisplay (void)
 Requests a redraw of the displayed image.


Variables

const ImagedisplayImage = NULL
GLdouble displayZoom = 1.0
GLint displayHotSpotX = 0
GLint displayHotSpotY = 0
GLdouble displayRasterX = 0
GLdouble displayRasterY = 0
bool displayChanged = true
int glutWindowId = -1
GLuint imageTexID = 0
unsigned texWidth = 0
unsigned texHeight = 0
GLenum texId = 0


Define Documentation

#define HAVE_GLCOPYTEXSUBIMAGE2D
 

Definition at line 66 of file framewk.cpp.


Function Documentation

float fwkGetDisplayZoom void   
 

Gets the current zoom factor.

Definition at line 410 of file framewk.cpp.

References displayZoom.

Referenced by keyboardCB(), and effect::useMenu().

void fwkInit int *    argc,
const char *    argv[]
 

Initializes the exercise framework.

Initializes GLUT and opens a GLUT window. See pgdocFramework for more details.

Parameters:
argc  A pointer to the unchanged argc argument of main().
argv  The unchanged argv argument of main().

Definition at line 342 of file framewk.cpp.

References fwkKeyboardCB(), fwkMotionCB(), fwkMouseCB(), fwkPassiveMotionCB(), fwkRedrawCB(), fwkSpecialCB(), and glutWindowId.

Referenced by main().

void fwkKeyboardCB unsigned char    key,
int    x,
int    y
[static]
 

Definition at line 281 of file framewk.cpp.

References fwkSetDisplayHotSpot(), fwkWindowToImageCoordinates(), and keyboardCB().

Referenced by fwkInit().

void fwkMainLoop void   
 

Starts the application main-loop.

(Actually starts the GLUT main-loop.)

See pgdocFramework for more details.

Definition at line 379 of file framewk.cpp.

Referenced by main().

void fwkMotionCB int    x,
int    y
[static]
 

Definition at line 314 of file framewk.cpp.

References fwkSetDisplayHotSpot(), fwkWindowToImageCoordinates(), and motionCB().

Referenced by fwkInit().

void fwkMouseCB int    button,
int    state,
int    x,
int    y
[static]
 

Definition at line 303 of file framewk.cpp.

References fwkSetDisplayHotSpot(), fwkWindowToImageCoordinates(), and mouseCB().

Referenced by fwkInit().

void fwkPassiveMotionCB int    x,
int    y
[static]
 

This callback function is called, when the mouse is moved without any mouse button pressed.

Parameters:
x, y  Current mouse position. The position is measured in pixel coordinates, relative to the top-left corner of the window canvas.

Definition at line 325 of file framewk.cpp.

References fwkSetDisplayHotSpot().

Referenced by fwkInit().

void fwkPostRedisplay void   
 

Requests a redraw of the displayed image.

Call this function if the image content has changed.

Subsequent calls to fwkPostRedisplay() are cumulated. See fwUsageImageData for more details.

Definition at line 446 of file framewk.cpp.

References displayChanged.

Referenced by idleCB().

void fwkPostRedisplayNoChange void    [static]
 

Requests a redraw of the displayed image.

In contrast to fwkPosyRedisplay() this function assumes that the image content did not change.

Subsequent calls to fwkPostRedisplayNoChange() are cumulated. See fwUsageImageData for more details.

Definition at line 457 of file framewk.cpp.

Referenced by fwkSetDisplayHotSpot(), and fwkSetDisplayZoom().

void fwkRedrawCB void    [static]
 

Definition at line 148 of file framewk.cpp.

References Image::bytesPerPixel, Image::data, displayChanged, displayRasterX, displayRasterY, displayZoom, fwkUpdateRasterPos(), Image::height, nextPowerOfTwo(), texHeight, texId, texWidth, and Image::width.

Referenced by fwkInit().

void fwkSetDisplayHotSpot int    x,
int    y
[static]
 

Sets the display hot spot.

The current image pixel will be centered around the display hot spot.

Definition at line 424 of file framewk.cpp.

References displayHotSpotX, displayHotSpotY, fwkPostRedisplayNoChange(), and fwkUpdateRasterPos().

Referenced by fwkKeyboardCB(), fwkMotionCB(), fwkMouseCB(), fwkPassiveMotionCB(), and fwkSpecialCB().

void fwkSetDisplayImage const void *    img
 

Sets the currently displayed image.

img can be a pointer to an ImageGray or ImageRGBA struct, as well. If img was not displayed before, a fwkPostRedisplay() is implicitly called. See fwUsageImageData for more details.

Parameters:
img  Pointer to an ImageGray or ImageRGBA struct.

Definition at line 390 of file framewk.cpp.

References glutWindowId.

Referenced by scroll::idleAction(), main(), and effect::refreshImage().

void fwkSetDisplayZoom float    zoom
 

Sets the current zoom factor.

Definition at line 415 of file framewk.cpp.

References displayZoom, and fwkPostRedisplayNoChange().

Referenced by keyboardCB(), and effect::useMenu().

void fwkSpecialCB int    key,
int    x,
int    y
[static]
 

Definition at line 292 of file framewk.cpp.

References fwkSetDisplayHotSpot(), fwkWindowToImageCoordinates(), and specialCB().

Referenced by fwkInit().

bool fwkUpdateRasterPos void    [static]
 

Definition at line 68 of file framewk.cpp.

References displayHotSpotX, displayHotSpotY, displayRasterX, displayRasterY, displayZoom, Image::height, and Image::width.

Referenced by fwkRedrawCB(), and fwkSetDisplayHotSpot().

void fwkWindowToImageCoordinates int    x,
int    y,
float *    ix,
float *    iy
[static]
 

Converts window to image coordinates.

The origin of the image coordinates is located at the top-left corner of the top-left pixel. The resultung image coordinates are written to *ix and *iy, respectively.

Parameters:
x, y  Window coordinates measured in pixels, relative to the top-left corner of the window canvas.
ix, iy  Pointers to the float variables, where the resulting image coordinates will be stored.

Definition at line 107 of file framewk.cpp.

References displayRasterX, displayRasterY, and displayZoom.

Referenced by fwkKeyboardCB(), fwkMotionCB(), fwkMouseCB(), and fwkSpecialCB().

unsigned nextPowerOfTwo unsigned    x [static]
 

Definition at line 131 of file framewk.cpp.

Referenced by fwkRedrawCB().


Variable Documentation

bool displayChanged = true [static]
 

Definition at line 42 of file framewk.cpp.

Referenced by fwkPostRedisplay(), and fwkRedrawCB().

GLint displayHotSpotX = 0 [static]
 

Definition at line 36 of file framewk.cpp.

Referenced by fwkSetDisplayHotSpot(), and fwkUpdateRasterPos().

GLint displayHotSpotY = 0 [static]
 

Definition at line 37 of file framewk.cpp.

Referenced by fwkSetDisplayHotSpot(), and fwkUpdateRasterPos().

const Image* displayImage = NULL [static]
 

Definition at line 32 of file framewk.cpp.

GLdouble displayRasterX = 0 [static]
 

Definition at line 39 of file framewk.cpp.

Referenced by fwkRedrawCB(), fwkUpdateRasterPos(), and fwkWindowToImageCoordinates().

GLdouble displayRasterY = 0 [static]
 

Definition at line 40 of file framewk.cpp.

Referenced by fwkRedrawCB(), fwkUpdateRasterPos(), and fwkWindowToImageCoordinates().

GLdouble displayZoom = 1.0 [static]
 

Definition at line 34 of file framewk.cpp.

Referenced by fwkGetDisplayZoom(), fwkRedrawCB(), fwkSetDisplayZoom(), fwkUpdateRasterPos(), and fwkWindowToImageCoordinates().

int glutWindowId = -1 [static]
 

Definition at line 44 of file framewk.cpp.

Referenced by fwkInit(), and fwkSetDisplayImage().

GLuint imageTexID = 0
 

Definition at line 129 of file framewk.cpp.

unsigned texHeight = 0
 

Definition at line 144 of file framewk.cpp.

Referenced by fwkRedrawCB().

GLenum texId = 0
 

Definition at line 145 of file framewk.cpp.

Referenced by fwkRedrawCB().

unsigned texWidth = 0
 

Definition at line 143 of file framewk.cpp.

Referenced by fwkRedrawCB().


Generated on Mon Jan 30 09:13:03 2006 for Painter Framework by doxygen1.2.18