libgimpprint API Reference: curve

Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

# curve

The curve type models a linear, spline or gamma curve. More...

## Data Structures
struct | stp_curve_point_t
| Point (x,y) for piecewise curve. More...
## Typedefs
typedef stp_curve | stp_curve_t
| The curve opaque data type.
## Enumerations
enum | stp_curve_type_t { STP_CURVE_TYPE_LINEAR, STP_CURVE_TYPE_SPLINE }
| Curve types. More...
enum | stp_curve_wrap_mode_t { STP_CURVE_WRAP_NONE, STP_CURVE_WRAP_AROUND }
| Wrapping mode. More...
enum | stp_curve_compose_t { STP_CURVE_COMPOSE_ADD, STP_CURVE_COMPOSE_MULTIPLY, STP_CURVE_COMPOSE_EXPONENTIATE }
| Composition types. More...
enum | stp_curve_bounds_t { STP_CURVE_BOUNDS_RESCALE, STP_CURVE_BOUNDS_CLIP, STP_CURVE_BOUNDS_ERROR }
| Behaviour when curve exceeds bounds. More...
## Functions
stp_curve_t * | stp_curve_create (stp_curve_wrap_mode_t wrap)
| Create a new curve.
stp_curve_t * | stp_curve_create_copy (const stp_curve_t *curve)
| Copy and allocate an curve.
void | stp_curve_copy (stp_curve_t *dest, const stp_curve_t *source)
| Copy an curve.
void | stp_curve_destroy (stp_curve_t *curve)
| Destroy an curve.
int | stp_curve_set_bounds (stp_curve_t *curve, double low, double high)
| Set the lower and upper bounds on a curve.
void | stp_curve_get_bounds (const stp_curve_t *curve, double *low, double *high)
| Get the lower and upper bounds on a curve.
stp_curve_wrap_mode_t | stp_curve_get_wrap (const stp_curve_t *curve)
| Get the wrapping mode.
int | stp_curve_is_piecewise (const stp_curve_t *curve)
| Determine whether the curve is piecewise.
void | stp_curve_get_range (const stp_curve_t *curve, double *low, double *high)
size_t | stp_curve_count_points (const stp_curve_t *curve)
| Get the number of allocated points in the curve.
int | stp_curve_set_interpolation_type (stp_curve_t *curve, stp_curve_type_t itype)
| Set the curve interpolation type.
stp_curve_type_t | stp_curve_get_interpolation_type (const stp_curve_t *curve)
| Get the curve interpolation type.
int | stp_curve_set_data (stp_curve_t *curve, size_t count, const double *data)
| Set all data points of the curve.
int | stp_curve_set_data_points (stp_curve_t *curve, size_t count, const stp_curve_point_t *data)
| Set all data points of the curve.
int | stp_curve_set_float_data (stp_curve_t *curve, size_t count, const float *data)
| Set the data points in a curve from float values.
int | stp_curve_set_long_data (stp_curve_t *curve, size_t count, const long *data)
| Set the data points in a curve from long values.
int | stp_curve_set_ulong_data (stp_curve_t *curve, size_t count, const unsigned long *data)
| Set the data points in a curve from unsigned long values.
int | stp_curve_set_int_data (stp_curve_t *curve, size_t count, const int *data)
| Set the data points in a curve from integer values.
int | stp_curve_set_uint_data (stp_curve_t *curve, size_t count, const unsigned int *data)
| Set the data points in a curve from unsigned integer values.
int | stp_curve_set_short_data (stp_curve_t *curve, size_t count, const short *data)
| Set the data points in a curve from short values.
int | stp_curve_set_ushort_data (stp_curve_t *curve, size_t count, const unsigned short *data)
| Set the data points in a curve from unsigned short values.
stp_curve_t * | stp_curve_get_subrange (const stp_curve_t *curve, size_t start, size_t count)
| Get a curve containing a subrange of data.
int | stp_curve_set_subrange (stp_curve_t *curve, const stp_curve_t *range, size_t start)
const double * | stp_curve_get_data (const stp_curve_t *curve, size_t *count)
| Get a pointer to the curve's raw data.
const stp_curve_point_t * | stp_curve_get_data_points (const stp_curve_t *curve, size_t *count)
| Get a pointer to the curve's raw data as points.
const float * | stp_curve_get_float_data (const stp_curve_t *curve, size_t *count)
| Get pointer to the curve's raw data as floats.
const long * | stp_curve_get_long_data (const stp_curve_t *curve, size_t *count)
| Get pointer to the curve's raw data as longs.
const unsigned long * | stp_curve_get_ulong_data (const stp_curve_t *curve, size_t *count)
| Get pointer to the curve's raw data as unsigned longs.
const int * | stp_curve_get_int_data (const stp_curve_t *curve, size_t *count)
| Get pointer to the curve's raw data as integers.
const unsigned int * | stp_curve_get_uint_data (const stp_curve_t *curve, size_t *count)
| Get pointer to the curve's raw data as unsigned integers.
const short * | stp_curve_get_short_data (const stp_curve_t *curve, size_t *count)
| Get pointer to the curve's raw data as shorts.
const unsigned short * | stp_curve_get_ushort_data (const stp_curve_t *curve, size_t *count)
| Get pointer to the curve's raw data as unsigned shorts.
const stp_sequence_t * | stp_curve_get_sequence (const stp_curve_t *curve)
| Get the underlying stp_sequence_t data structure which stp_curve_t is derived from.
int | stp_curve_set_gamma (stp_curve_t *curve, double f_gamma)
| Set the gamma of a curve.
double | stp_curve_get_gamma (const stp_curve_t *curve)
| Get the gamma value of the curve.
int | stp_curve_set_point (stp_curve_t *curve, size_t where, double data)
| Set a point along the curve.
int | stp_curve_get_point (const stp_curve_t *curve, size_t where, double *data)
| Get a point along the curve.
int | stp_curve_interpolate_value (const stp_curve_t *curve, double where, double *result)
| Interpolate a point along the curve.
int | stp_curve_resample (stp_curve_t *curve, size_t points)
| Resample a curve (change the number of points).
int | stp_curve_rescale (stp_curve_t *curve, double scale, stp_curve_compose_t mode, stp_curve_bounds_t bounds_mode)
| Rescale a curve (multiply all points by a scaling constant).
int | stp_curve_write (FILE *file, const stp_curve_t *curve)
| Write a curve to a file.
char * | stp_curve_write_string (const stp_curve_t *curve)
| Write a curve to a string.
stp_curve_t * | stp_curve_create_from_stream (FILE *fp)
| Create a curve from a stream.
stp_curve_t * | stp_curve_create_from_file (const char *file)
| Create a curve from a stream.
stp_curve_t * | stp_curve_create_from_string (const char *string)
| Create a curve from a string.
int | stp_curve_compose (stp_curve_t **retval, stp_curve_t *a, stp_curve_t *b, stp_curve_compose_t mode, int points)
| Compose two curves, creating a third curve.

## Detailed Description

The curve type models a linear, spline or gamma curve.

curve "inherits" from the sequence data structure (implemented via containment), since the curve data is represented internally as a sequence of numbers, for linear and spline curves. Linear Piecewise Curves (LPCs) should be implemented in the future which represent a curve in a more compact format.

Various operations are supported, including interpolation and composition.

## Typedef Documentation

typedef struct stp_curve stp_curve_t

| The curve opaque data type. Definition at line 63 of file curve.h. Referenced by adjust_print_quality(), canon_do_print(), check_curve(), clear_curve_data(), compute_a_curve_fast(), compute_a_curve_full(), compute_gcr_curve(), compute_intervals(), compute_linear_deltas(), compute_one_lut(), compute_spline_deltas(), compute_spline_deltas_dense(), compute_spline_deltas_piecewise(), compute_user_correction(), curve_dtor(), get_point_count(), get_real_point_count(), initialize_gcr_curve(), interpolate_gamma_internal(), interpolate_point_internal(), invalidate_auxiliary_data(), invert_curve(), lexmark_do_print(), olympus_do_print(), pcl_do_print(), stp_curve_cache_set_curve(), stp_curve_cache_set_curve_copy(), stp_curve_compose(), stp_curve_copy(), stp_curve_count_points(), stp_curve_create(), stp_curve_create_copy(), stp_curve_create_from_file(), stp_curve_create_from_stream(), stp_curve_create_from_string(), stp_curve_create_from_xmltree(), stp_curve_destroy(), stp_curve_get_bounds(), stp_curve_get_data(), stp_curve_get_data_points(), stp_curve_get_gamma(), stp_curve_get_interpolation_type(), stp_curve_get_point(), stp_curve_get_range(), stp_curve_get_sequence(), stp_curve_get_subrange(), stp_curve_get_wrap(), stp_curve_interpolate_value(), stp_curve_is_piecewise(), stp_curve_rescale(), stp_curve_set_bounds(), stp_curve_set_data(), stp_curve_set_data_points(), stp_curve_set_gamma(), stp_curve_set_interpolation_type(), stp_curve_set_point(), stp_curve_set_subrange(), stp_printer_create_from_xmltree(), stp_read_and_compose_curves(), stp_set_curve_parameter(), stp_set_default_curve_parameter(), stpi_compute_lut(), stpi_curve_check_parameters(), stpi_curve_ctor(), stpi_curve_get_data_internal(), stpi_curve_set_points(), verify_curve_param(), and xml_doc_get_curve().

## Enumeration Type Documentation

enum stp_curve_bounds_t

  | Behaviour when curve exceeds bounds. Enumeration values:
  STP_CURVE_BOUNDS_RESCALE | Rescale the bounds.
  STP_CURVE_BOUNDS_CLIP | Clip the curve to the existing bounds.
  STP_CURVE_BOUNDS_ERROR | Error if bounds are violated.
Definition at line 95 of file curve.h.

enum stp_curve_compose_t

  | Composition types. Enumeration values:
  STP_CURVE_COMPOSE_ADD | Add composition.
  STP_CURVE_COMPOSE_MULTIPLY | Multiply composition.
  STP_CURVE_COMPOSE_EXPONENTIATE | Exponentiate composition.
Definition at line 84 of file curve.h.

enum stp_curve_type_t

  | Curve types. Enumeration values:
  STP_CURVE_TYPE_LINEAR | Linear interpolation.
  STP_CURVE_TYPE_SPLINE | Spline interpolation.
Definition at line 66 of file curve.h. Referenced by stp_curve_create_from_xmltree(), and stp_xmltree_create_from_curve().

enum stp_curve_wrap_mode_t

  | Wrapping mode. Enumeration values:
  STP_CURVE_WRAP_NONE | The curve does not wrap.
  STP_CURVE_WRAP_AROUND | The curve wraps to its starting point.
Definition at line 75 of file curve.h. Referenced by stp_curve_create_from_xmltree(), and stp_xmltree_create_from_curve().

## Function Documentation

int stp_curve_compose | ( | stp_curve_t ** | retval,
|  | stp_curve_t * | a,
|  | stp_curve_t * | b,
|  | stp_curve_compose_t | mode,
|  | int | points
| ) |

  | Compose two curves, creating a third curve. Only add and multiply composition is currently supported. If both curves are gamma curves with the same sign, and the operation is multiplication or division, the returned curve is a gamma curve with the appropriate number of points. Both a and b must have the same wraparound type. Parameters:
  retval | a pointer to store the location of the newly-created output curve in.
  a | the first source curve.
  b | the second source curve.
  mode | the composition mode.
  points | the number of points in the output curve (must not exceed 1048576). It must be at least two, unless the curve is a gamma curve and the operation chosen is multiplication or division. If -1, the resulting number of points will be the least common multiplier of the number of points in the input and output curves (but will not exceed 1048576).
Returns: FALSE if element-wise composition fails. Definition at line 1318 of file curve.c. References create_gamma_curve(), curve_point_limit, interpolate_points(), lcm(), stp_curve::piecewise, STP_CURVE_BOUNDS_RESCALE, STP_CURVE_COMPOSE_ADD, STP_CURVE_COMPOSE_MULTIPLY, stp_curve_count_points(), stp_curve_create(), stp_curve_create_copy(), stp_curve_destroy(), stp_curve_get_bounds(), stp_curve_get_gamma(), stp_curve_get_wrap(), stp_curve_resample(), stp_curve_rescale(), stp_curve_set_data(), stp_curve_t, STP_CURVE_WRAP_AROUND, stp_free(), and stp_malloc(). Referenced by stp_read_and_compose_curves().

void stp_curve_copy | ( | stp_curve_t * | dest,
|  | const stp_curve_t * | source
| ) |

  | Copy an curve. Both dest and source must be valid curves previously created with stp_curve_create(). Parameters:
  dest | the destination curve.
  source | the source curve.
Definition at line 449 of file curve.c. References check_curve(), curve_dtor(), stp_curve::curve_type, stp_curve::gamma, stp_curve::piecewise, stp_curve::recompute_interval, stp_curve::seq, stp_curve_t, stp_sequence_create_copy(), and stp_curve::wrap_mode. Referenced by stp_curve_create_copy().

size_t stp_curve_count_points | ( | const stp_curve_t * | curve | ) |

  | Get the number of allocated points in the curve. Parameters:
  curve | the curve to use.
Returns: the number of points. Definition at line 500 of file curve.c. References check_curve(), get_point_count(), and stp_curve_t. Referenced by initialize_gcr_curve(), interpolate_points(), stp_curve_compose(), stp_curve_create_from_xmltree(), stp_curve_get_subrange(), and stp_curve_set_subrange().

stp_curve_t* stp_curve_create | ( | stp_curve_wrap_mode_t | wrap | ) |

  | Create a new curve. Curves have y=lower..upper. The default bounds are 0..1. The default interpolation type is linear. There are no points allocated, and the gamma is defaulted to 1. The curve is a dense (equally-spaced) curve. A wrapped curve has the same value at x=0 and x=1. The wrap mode of a curve cannot be changed except by routines that destroy the old curve entirely (e. g. stp_curve_copy, stp_curve_read). Parameters:
  wrap | the wrap mode of the curve.
Returns: the newly created curve. Definition at line 420 of file curve.c. References stp_curve_t, STP_CURVE_WRAP_AROUND, STP_CURVE_WRAP_NONE, stp_zalloc(), and stpi_curve_ctor(). Referenced by compute_gcr_curve(), create_gamma_curve(), stp_curve_compose(), stp_curve_create_copy(), stp_curve_create_from_xmltree(), and stp_curve_get_subrange().

stp_curve_t* stp_curve_create_copy | ( | const stp_curve_t * | curve | ) |

  | Copy and allocate an curve. dest will be created, and then the contents of source will be copied into it. dest must not have been previously allocated with stp_curve_create(). Parameters:
  curve | the source curve.
Returns: the new copy of the curve. Definition at line 463 of file curve.c. References check_curve(), stp_curve_copy(), stp_curve_create(), stp_curve_t, and stp_curve::wrap_mode. Referenced by compute_one_lut(), initialize_gcr_curve(), stp_curve_cache_set_curve_copy(), stp_curve_compose(), stp_set_curve_parameter(), stp_set_default_curve_parameter(), stpi_color_traditional_describe_parameter(), stpi_compute_lut(), and value_copy().

stp_curve_t* stp_curve_create_from_file | ( | const char * | file | ) |

  | Create a curve from a stream. Warning: NOTE that these calls are not thread-safe! These routines may manipulate the locale to achieve a safe representation. Parameters:
  file | the file to read.
Returns: the newly created curve, or NULL if an error occured. Definition at line 1832 of file curve.c. References stp_curve_t, STP_DBG_CURVE_ERRORS, STP_DBG_XML, stp_deprintf(), STP_MXML_NO_CALLBACK, stp_mxml_node_t, stp_mxmlDelete(), stp_mxmlLoadFile(), stp_xml_exit(), stp_xml_init(), and xml_doc_get_curve().

stp_curve_t* stp_curve_create_from_stream | ( | FILE * | fp | ) |

  | Create a curve from a stream. Warning: NOTE that these calls are not thread-safe! These routines may manipulate the locale to achieve a safe representation. Parameters:
  fp | the stream to read.
Returns: the newly created curve, or NULL if an error occured. Definition at line 1863 of file curve.c. References stp_curve_t, STP_DBG_XML, stp_deprintf(), STP_MXML_NO_CALLBACK, stp_mxml_node_t, stp_mxmlDelete(), stp_mxmlLoadFile(), stp_xml_exit(), stp_xml_init(), and xml_doc_get_curve().

stp_curve_t* stp_curve_create_from_string | ( | const char * | string | ) |

  | Create a curve from a string. Warning: NOTE that these calls are not thread-safe! These routines may manipulate the locale to achieve a safe representation. Parameters:
  string | the string to read.
Returns: the newly created curve, or NULL if an error occured. Definition at line 1884 of file curve.c. References stp_curve_t, STP_DBG_XML, stp_deprintf(), STP_MXML_NO_CALLBACK, stp_mxml_node_t, stp_mxmlDelete(), stp_mxmlLoadString(), stp_xml_exit(), stp_xml_init(), and xml_doc_get_curve(). Referenced by adjust_print_quality(), initialize_standard_curves(), olympus_do_print(), and stp_read_and_compose_curves().

void stp_curve_destroy | ( | stp_curve_t * | curve | ) |

  | Destroy an curve. It is an error to destroy the curve more than once. Parameters:
  curve | the curve to destroy.
Definition at line 442 of file curve.c. References curve_dtor(), stp_curve_t, and stp_free(). Referenced by adjust_print_quality(), create_gamma_curve(), olympus_do_print(), stp_curve_compose(), stp_curve_create_from_xmltree(), stp_curve_free_curve_cache(), stp_curve_get_subrange(), stp_parameter_description_destroy(), stp_printer_create_from_xmltree(), stp_read_and_compose_curves(), stp_set_curve_parameter(), and value_freefunc().

void stp_curve_get_bounds | ( | const stp_curve_t * | curve,
|  | double * | low,
|  | double * | high
| ) |

  | Get the lower and upper bounds on a curve. Parameters:
  curve | the curve to use.
  low | a pointer to a double to store the lower bound in.
  high | a pointer to a double to store the upper bound in.
Definition at line 480 of file curve.c. References check_curve(), stp_curve::seq, stp_curve_t, and stp_sequence_get_bounds(). Referenced by invert_curve(), stp_curve_compose(), stp_curve_get_subrange(), stp_xmltree_create_from_curve(), and verify_curve_param().

const double* stp_curve_get_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get a pointer to the curve's raw data. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This call also returns NULL if the curve is a piecewise curve. Definition at line 693 of file curve.c. References check_curve(), get_point_count(), stp_curve::piecewise, stp_curve::seq, stp_curve_t, and stp_sequence_get_data(). Referenced by invert_curve(), stp_curve_cache_curve_data(), stp_curve_cache_get_count(), stp_curve_cache_get_double_data(), and stp_curve_get_subrange().

const stp_curve_point_t* stp_curve_get_data_points | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get a pointer to the curve's raw data as points. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This call also returns NULL if the curve is a dense (equally-spaced) curve. Definition at line 705 of file curve.c. References check_curve(), get_point_count(), stp_curve::piecewise, stp_curve::seq, stp_curve_t, and stp_sequence_get_data().

const float* stp_curve_get_float_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get pointer to the curve's raw data as floats. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This also returns NULL if the curve is a piecewise curve.

double stp_curve_get_gamma | ( | const stp_curve_t * | curve | ) |

| Get the gamma value of the curve. Returns: the gamma value. A value of 0 indicates that the curve does not have a valid gamma value. Definition at line 550 of file curve.c. References check_curve(), stp_curve::gamma, and stp_curve_t. Referenced by invert_curve(), stp_curve_compose(), and stp_xmltree_create_from_curve().

const int* stp_curve_get_int_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get pointer to the curve's raw data as integers. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This also returns NULL if the curve is a piecewise curve.

stp_curve_type_t stp_curve_get_interpolation_type | ( | const stp_curve_t * | curve | ) |

  | Get the curve interpolation type. Parameters:
  curve | the curve to use.
Returns: the interpolation type. Definition at line 531 of file curve.c. References check_curve(), stp_curve::curve_type, and stp_curve_t. Referenced by stp_xmltree_create_from_curve().

const long* stp_curve_get_long_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get pointer to the curve's raw data as longs. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This also returns NULL if the curve is a piecewise curve.

int stp_curve_get_point | ( | const stp_curve_t * | curve,
|  | size_t | where,
|  | double * | data
| ) |

  | Get a point along the curve. Parameters:
  curve | the curve to use.
  where | the point to get.
  data | a pointer to a double to store the value of where in.
Returns: FALSE if where is outside of the number of valid points. This also returns NULL if the curve is a piecewise curve. Definition at line 853 of file curve.c. References check_curve(), get_point_count(), stp_curve::piecewise, stp_curve::seq, stp_curve_t, and stp_sequence_get_point(). Referenced by initialize_gcr_curve().

void stp_curve_get_range | ( | const stp_curve_t * | curve,
|  | double * | low,
|  | double * | high
| ) |

| Definition at line 493 of file curve.c. References check_curve(), stp_curve::seq, stp_curve_t, and stp_sequence_get_range().

const stp_sequence_t* stp_curve_get_sequence | ( | const stp_curve_t * | curve | ) |

  | Get the underlying stp_sequence_t data structure which stp_curve_t is derived from. This can be used for fast access to the raw data. Parameters:
  curve | the curve to use.
Returns: the stp_sequence_t. If the curve is a piecewise curve, the sequence returned is NULL; Definition at line 864 of file curve.c. References check_curve(), stp_curve::piecewise, stp_curve::seq, and stp_curve_t.

const short* stp_curve_get_short_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get pointer to the curve's raw data as shorts. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This also returns NULL if the curve is a piecewise curve.

stp_curve_t* stp_curve_get_subrange | ( | const stp_curve_t * | curve,
|  | size_t | start,
|  | size_t | count
| ) |

  | Get a curve containing a subrange of data. If the start or count is invalid, the returned curve will compare equal to NULL (i. e. it will be a null pointer). start and count must not exceed the number of points in the curve, and count must be at least 2. The curve must be a dense (equally-spaced) curve Parameters:
  curve | the curve to use.
  start | the start of the subrange.
  count | the number of point starting at start.
Returns: a curve containing the subrange. The returned curve is non-wrapping. Definition at line 783 of file curve.c. References stp_curve::piecewise, stp_curve_count_points(), stp_curve_create(), stp_curve_destroy(), stp_curve_get_bounds(), stp_curve_get_data(), stp_curve_set_bounds(), stp_curve_set_data(), stp_curve_t, and STP_CURVE_WRAP_NONE.

const unsigned int* stp_curve_get_uint_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get pointer to the curve's raw data as unsigned integers. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This also returns NULL if the curve is a piecewise curve.

const unsigned long* stp_curve_get_ulong_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get pointer to the curve's raw data as unsigned longs. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This also returns NULL if the curve is a piecewise curve.

const unsigned short* stp_curve_get_ushort_data | ( | const stp_curve_t * | curve,
|  | size_t * | count
| ) |

  | Get pointer to the curve's raw data as unsigned shorts. Parameters:
  curve | the curve to use.
  count | a pointer to a size_t to store the curve size in.
Returns: a pointer to the curve data. This data is not guaranteed to be valid beyond the next non-const curve call. If the curve is a pure gamma curve (no associated points), NULL is returned and the count is 0. This also returns NULL if the curve is a piecewise curve. Referenced by stp_curve_cache_curve_data(), and stp_curve_cache_get_ushort_data().

stp_curve_wrap_mode_t stp_curve_get_wrap | ( | const stp_curve_t * | curve | ) |

  | Get the wrapping mode. Parameters:
  curve | the curve to use.
Returns: the wrapping mode. Definition at line 507 of file curve.c. References check_curve(), stp_curve_t, and stp_curve::wrap_mode. Referenced by stp_curve_compose(), stp_xmltree_create_from_curve(), and verify_curve_param().

int stp_curve_interpolate_value | ( | const stp_curve_t * | curve,
|  | double | where,
|  | double * | result
| ) |

  | Interpolate a point along the curve. Parameters:
  curve | the curve to use.
  where | the point to interpolate.
  result | a pointer to double to store the value of where in. If interpolation would produce a value outside of the allowed range (as could happen with spline interpolation), the value is clipped to the range.
Returns: FALSE if 'where' is less than 0 or greater than the number of points, an error is returned. Also returns FALSE if the curve is a piecewise curve. Definition at line 1088 of file curve.c. References get_real_point_count(), interpolate_gamma_internal(), and stp_curve_t. Referenced by interpolate_points().

int stp_curve_is_piecewise | ( | const stp_curve_t * | curve | ) |

  | Determine whether the curve is piecewise. Parameters:
  curve | the curve to use.
Returns: whether the curve is piecewise Definition at line 514 of file curve.c. References check_curve(), stp_curve::piecewise, and stp_curve_t. Referenced by compute_one_lut(), stp_read_and_compose_curves(), and stpi_compute_lut().

int stp_curve_resample | ( | stp_curve_t * | curve,
|  | size_t | points
| ) |

  | Resample a curve (change the number of points). This does not destroy the gamma value of a curve. Points are interpolated as required; any interpolation that would place points outside of the bounds of the curve will be clipped to the bounds. The resulting curve is always dense (equally-spaced). This is the correct way to convert a piecewise curve to an equally-spaced curve. Parameters:
  curve | the curve to use (must not exceed 1048576).
  points | the number of points.
Returns: FALSE if the number of points is invalid (less than two, except that zero points is permitted for a gamma curve). Definition at line 1109 of file curve.c. References compute_intervals(), do_interpolate_spline(), stp_free(), and stp_sequence_get_bounds(). Referenced by compute_a_curve_fast(), compute_a_curve_full(), compute_one_lut(), compute_user_correction(), create_gamma_curve(), generic_cmy_to_kcmy(), initialize_gcr_curve(), stp_curve_compose(), stp_curve_set_gamma(), stp_read_and_compose_curves(), and stpi_compute_lut().

int stp_curve_rescale | ( | stp_curve_t * | curve,
|  | double | scale,
|  | stp_curve_compose_t | mode,
|  | stp_curve_bounds_t | bounds_mode
| ) |

  | Rescale a curve (multiply all points by a scaling constant). This also rescales the bounds. Note that this currently destroys the gamma property of the curve. Parameters:
  curve | the curve to use.
  scale | the scaling factor.
  mode | the composition mode.
  bounds_mode | the bounds exceeding mode.
Returns: FALSE if this would exceed floating point limits Definition at line 873 of file curve.c. References check_curve(), stp_curve::gamma, get_point_count(), get_real_point_count(), invalidate_auxiliary_data(), stp_curve::piecewise, stp_curve::recompute_interval, stp_curve::seq, STP_CURVE_BOUNDS_ERROR, STP_CURVE_BOUNDS_RESCALE, STP_CURVE_COMPOSE_ADD, STP_CURVE_COMPOSE_EXPONENTIATE, STP_CURVE_COMPOSE_MULTIPLY, stp_curve_t, stp_free(), stp_malloc(), stp_sequence_get_bounds(), stp_sequence_get_data(), stp_sequence_set_bounds(), stp_sequence_set_subrange(), and stpi_curve_set_points(). Referenced by compute_one_lut(), invert_curve(), stp_curve_compose(), and stpi_compute_lut().

int stp_curve_set_bounds | ( | stp_curve_t * | curve,
|  | double | low,
|  | double | high
| ) |

  | Set the lower and upper bounds on a curve. To change the bounds adjusting data as required, use stp_curve_rescale instead. Parameters:
  curve | the curve to use.
  low | the lower bound.
  high | the upper bound.
Returns: FALSE if any existing points on the curve are outside the bounds. Definition at line 473 of file curve.c. References check_curve(), stp_curve::seq, stp_curve_t, and stp_sequence_set_bounds(). Referenced by compute_gcr_curve(), create_gamma_curve(), initialize_gcr_curve(), stp_curve_create_from_xmltree(), and stp_curve_get_subrange().

int stp_curve_set_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const double * | data
| ) |

  | Set all data points of the curve. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of doubles (must be at least count in size).
Returns: 1 on success, 0 on failure. Definition at line 557 of file curve.c. References check_curve(), curve_point_limit, stp_curve::gamma, stp_curve::piecewise, stp_curve::recompute_interval, stp_curve::seq, stp_curve_t, STP_CURVE_WRAP_AROUND, STP_DBG_CURVE_ERRORS, stp_deprintf(), stp_sequence_get_bounds(), stp_sequence_set_point(), stp_sequence_set_subrange(), stpi_curve_set_points(), and stp_curve::wrap_mode. Referenced by compute_a_curve_fast(), compute_a_curve_full(), compute_gcr_curve(), compute_user_correction(), invert_curve(), stp_curve_compose(), stp_curve_create_from_xmltree(), and stp_curve_get_subrange().

int stp_curve_set_data_points | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const stp_curve_point_t * | data
| ) |

  | Set all data points of the curve. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a piecewise curve. Parameters:
  curve | the curve to use.
  count | the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of points (must be at least count in size). The first point must have X=0, and each point must have an X value at least .000001 greater than the previous point. If the curve is not a wraparound curve, the last point must have X=1.
Returns: 1 on success, 0 on failure. Definition at line 595 of file curve.c. References check_curve(), curve_point_limit, stp_curve::gamma, stp_curve::piecewise, stp_curve::recompute_interval, stp_curve::seq, stp_curve_t, STP_CURVE_WRAP_AROUND, STP_CURVE_WRAP_NONE, STP_DBG_CURVE_ERRORS, stp_deprintf(), stp_sequence_get_bounds(), stp_sequence_set_point(), stp_sequence_set_subrange(), stpi_curve_set_points(), stp_curve::wrap_mode, stp_curve_point_t::x, and stp_curve_point_t::y. Referenced by stp_curve_create_from_xmltree().

int stp_curve_set_float_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const float * | data
| ) |

  | Set the data points in a curve from float values. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of floats (must be at least count in size).
Returns: 1 on success, 0 on failure.

int stp_curve_set_gamma | ( | stp_curve_t * | curve,
|  | double | f_gamma
| ) |

  | Set the gamma of a curve. This replaces all existing points along the curve. The bounds are set to 0..1. If the gamma value is positive, the function is increasing; if negative, the function is decreasing. Count must be either 0 or at least 2. If the count is zero, the gamma of the curve is set for interpolation purposes, but points cannot be assigned to. It is illegal to set gamma on a wrap-mode curve. The resulting curve is treated as a dense (equally-spaced) curve. Parameters:
  curve | the curve to use.
  f_gamma | the gamma value to set.
Returns: FALSE if the gamma value is illegal (0, infinity, or NaN), or if the curve wraps around. Definition at line 538 of file curve.c. References check_curve(), clear_curve_data(), stp_curve::gamma, stp_curve_resample(), stp_curve_t, and stp_curve::wrap_mode. Referenced by create_gamma_curve(), invert_curve(), and stp_curve_create_from_xmltree().

int stp_curve_set_int_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const int * | data
| ) |

  | Set the data points in a curve from integer values. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of integers (must be at least count in size).
Returns: 1 on success, 0 on failure.

int stp_curve_set_interpolation_type | ( | stp_curve_t * | curve,
|  | stp_curve_type_t | itype
| ) |

  | Set the curve interpolation type. Parameters:
  curve | the curve to use.
  itype | the interpolation type.
Returns: 1 on success, or 0 if itype is invalid. Definition at line 521 of file curve.c. References check_curve(), stp_curve::curve_type, stp_curve_t, and stpi_curve_type_count. Referenced by stp_curve_create_from_xmltree().

int stp_curve_set_long_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const long * | data
| ) |

  | Set the data points in a curve from long values. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of longs (must be at least count in size).
Returns: 1 on success, 0 on failure.

int stp_curve_set_point | ( | stp_curve_t * | curve,
|  | size_t | where,
|  | double | data
| ) |

  | Set a point along the curve. This call destroys any gamma value assigned to the curve. Parameters:
  curve | the curve to use.
  where | the point to set.
  data | the value to set where to.
Returns: FALSE if data is outside the valid bounds or if where is outside the number of valid points. This also returns NULL if the curve is a piecewise curve. Definition at line 833 of file curve.c. References check_curve(), stp_curve::gamma, get_point_count(), invalidate_auxiliary_data(), stp_curve::piecewise, stp_curve::seq, stp_curve_t, STP_CURVE_WRAP_AROUND, stp_sequence_set_point(), and stp_curve::wrap_mode. Referenced by initialize_gcr_curve().

int stp_curve_set_short_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const short * | data
| ) |

  | Set the data points in a curve from short values. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of shorts (must be at least count in size).
Returns: 1 on success, 0 on failure.

int stp_curve_set_subrange | ( | stp_curve_t * | curve,
|  | const stp_curve_t * | range,
|  | size_t | start
| ) |

| Definition at line 806 of file curve.c. References check_curve(), stp_curve::gamma, invalidate_auxiliary_data(), stp_curve::piecewise, stp_curve::recompute_interval, stp_curve::seq, stp_curve_count_points(), stp_curve_t, stp_sequence_get_bounds(), stp_sequence_get_data(), stp_sequence_get_range(), and stp_sequence_set_subrange().

int stp_curve_set_uint_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const unsigned int * | data
| ) |

  | Set the data points in a curve from unsigned integer values. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of unsigned integers (must be at least count in size).
Returns: 1 on success, 0 on failure.

int stp_curve_set_ulong_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const unsigned long * | data
| ) |

  | Set the data points in a curve from unsigned long values. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of unsigned longs (must be at least count in size).
Returns: 1 on success, 0 on failure.

int stp_curve_set_ushort_data | ( | stp_curve_t * | curve,
|  | size_t | count,
|  | const unsigned short * | data
| ) |

  | Set the data points in a curve from unsigned short values. If any of the data points fall outside the bounds, the operation is not performed and FALSE is returned. This creates a curve with equally-spaced points. Parameters:
  curve | the curve to use.
  count | the number of the number of points (must be at least two and not more than 1048576).
  data | a pointer to an array of unsigned shorts (must be at least count in size).
Returns: 1 on success, 0 on failure.

int stp_curve_write | ( | FILE * | file,
|  | const stp_curve_t * | curve
| ) |

  | Write a curve to a file. The printable representation is guaranteed to contain only 7-bit printable ASCII characters, and is null-terminated. The curve will not contain any space, newline, single quote, or comma characters. Furthermore, a printed curve will be read back correctly in all locales. These calls are not guaranteed to provide more than 6 decimal places of precision or +/-0.5e-6 accuracy, whichever is less. Warning: NOTE that these calls are not thread-safe! These routines may manipulate the locale to achieve a safe representation. Parameters:
  file | the file to write.
  curve | the curve to use.
Returns: 1 on success, 0 on failure. Definition at line 1752 of file curve.c. References curve_whitespace_callback(), stp_mxml_node_t, stp_mxmlDelete(), stp_mxmlSaveFile(), stp_xml_exit(), stp_xml_init(), and xmldoc_create_from_curve().

char* stp_curve_write_string | ( | const stp_curve_t * | curve | ) |

  | Write a curve to a string. The printable representation is guaranteed to contain only 7-bit printable ASCII characters, and is null-terminated. The curve will not contain any space, newline, or comma characters. Furthermore, a printed curve will be read back correctly in all locales. These calls are not guaranteed to provide more than 6 decimal places of precision or +/-0.5e-6 accuracy, whichever is less. Warning: NOTE that these calls are not thread-safe! These routines may manipulate the locale to achieve a safe representation. Parameters:
  curve | the curve to use.
Returns: a pointer to a string. This is allocated on the heap, and it is the caller's responsibility to free it. Definition at line 1776 of file curve.c. References curve_whitespace_callback(), stp_mxml_node_t, stp_mxmlDelete(), stp_mxmlSaveAllocString(), stp_xml_exit(), stp_xml_init(), and xmldoc_create_from_curve(). Referenced by print_debug_params().