sphore 0.0.1
SPH openGL rendering engine

src/colour-ramp.c File Reference

Code for managing colour ramps. More...

#include <math.h>
#include <stdlib.h>
#include <GL/gl.h>
#include "colour-ramp.h"
#include "sphore.h"
#include "warning.h"
#include "settings.h"

Data Structures

struct  _colour_ramp

Functions

colour_ramp_tcolour_ramp_create ()
 Creates a new colour ramp.
SREbool colour_ramp_set (colour_ramp_t *cr, int n, float *controlPoints, float *red, float *green, float *blue)
 Sets the colour ramp to the one given.
void colour_ramp_get_rgb (colour_ramp_t *cr, float pos, float *red, float *green, float *blue)
 Gets the red, green and blue values from the given colour ramp at the given position.
void colour_ramp_destroy (colour_ramp_t *cr)
 Frees the memory accosiated with a given colour ramp.
void colour_ramp_onto_device (colour_ramp_t *cr)

Detailed Description

Code for managing colour ramps.


Function Documentation

colour_ramp_t* colour_ramp_create ( )

Creates a new colour ramp.

The ramp will be initialised to a monochrome ramp.

Returns:
A pointer to the new colour ramp, or NULL if something failed.
void colour_ramp_destroy ( colour_ramp_t cr)

Frees the memory accosiated with a given colour ramp.

Parameters:
[in]crThe colour ramp to destroy.
void colour_ramp_get_rgb ( colour_ramp_t cr,
float  pos,
float *  red,
float *  green,
float *  blue 
)

Gets the red, green and blue values from the given colour ramp at the given position.

Parameters:
[in]crThe ramp to query.
[in]posThe position on the ramp in normalised units.
[out]redGets set to the red component at pos.
[out]greenGets set to the green component at pos.
[out]blueGets set to the blue component at pos.
void colour_ramp_onto_device ( colour_ramp_t cr)
SREbool colour_ramp_set ( colour_ramp_t cr,
int  n,
float *  controlPoints,
float *  red,
float *  green,
float *  blue 
)

Sets the colour ramp to the one given.

Parameters:
[in]crThe colour ramp object to set
[in]nThe number of control points to be used
[in]controlPointsThe position of the control points on the ramp. in normalised units i.e. 0 at the begining, 1 at the end.
[in]redThe value of the red component of the colour at each control point.
[in]greenThe value of the green component of the colour at each control point.
[in]blueThe value of the blue component of the colour at each control point.
Returns:
The success of setting the colour ramp.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines