sphore 0.0.1
SPH openGL rendering engine

src/viewport.h File Reference

Code handeling viewports corresponding to plots. More...

Go to the source code of this file.

Typedefs

typedef struct _viewport viewport_t
 Public handel to viewport.

Functions

viewport_tviewport_create (void)
 Creates a viewport object.
void viewport_destroy (viewport_t *vp)
 Destroys the given viewport.
void viewport_calculate_pixels (viewport_t *vp, int *left_x, int *bottom_y, int *width, int *height)
 Calculates the position (in pixels) of the viewport.
void viewport_update (viewport_t *vp, int old_width, int old_height, int new_width, int new_height)
 Updates the viewport after a change in device size.
void viewport_set (viewport_t *vp, float bottom, float left, float width, float height)
void viewport_set_keep_ratio (viewport_t *vp, SREbool value)
void viewport_get (viewport_t *vp, float *x, float *y, float *width, float *height)

Detailed Description

Code handeling viewports corresponding to plots.


Typedef Documentation

typedef struct _viewport viewport_t

Public handel to viewport.

Memory managment handeled with viewport_create and viewport_destroy.


Function Documentation

void viewport_calculate_pixels ( viewport_t vp,
int *  left_x,
int *  bottom_y,
int *  width,
int *  height 
)

Calculates the position (in pixels) of the viewport.

Parameters:
[in]vpThe viewport to query.
[in]deviceThe device the viewport is accossiated with.
[out]left_xThe x position of the bottom left corner of the viewport.
[out]bottom_yThe y position of the bottom left corner of the viewport.
[out]widthThe width of the viewport.
[out]heightThe height of the viewport.
viewport_t* viewport_create ( void  )

Creates a viewport object.

Returns:
A pointer to the new viewport.
void viewport_destroy ( viewport_t vp)

Destroys the given viewport.

Parameters:
[in]vpThe viewport to destroy.
void viewport_get ( viewport_t vp,
float *  x,
float *  y,
float *  width,
float *  height 
)
void viewport_set ( viewport_t vp,
float  bottom,
float  left,
float  width,
float  height 
)
void viewport_set_keep_ratio ( viewport_t vp,
SREbool  value 
)
void viewport_update ( viewport_t vp,
int  old_width,
int  old_height,
int  new_width,
int  new_height 
)

Updates the viewport after a change in device size.

Parameters:
[in]vpThe viewport to update.
[in]old_widthThe previous width of the device.
[in]old_heightThe previous height of the device.
[in]new_widthThe new width of the device.
[in]new_heightThe new height of the device.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines