00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00029 #ifndef GIMP_PRINT_CURVE_H
00030 #define GIMP_PRINT_CURVE_H
00031
00032 #include <stdio.h>
00033 #include <stdlib.h>
00034
00035 #include <gimp-print/sequence.h>
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00041
00042
00043
00044
00045
00061 struct stp_curve;
00063 typedef struct stp_curve stp_curve_t;
00064
00066 typedef enum
00067 {
00069 STP_CURVE_TYPE_LINEAR,
00071 STP_CURVE_TYPE_SPLINE
00072 } stp_curve_type_t;
00073
00075 typedef enum
00076 {
00078 STP_CURVE_WRAP_NONE,
00080 STP_CURVE_WRAP_AROUND
00081 } stp_curve_wrap_mode_t;
00082
00084 typedef enum
00085 {
00087 STP_CURVE_COMPOSE_ADD,
00089 STP_CURVE_COMPOSE_MULTIPLY,
00091 STP_CURVE_COMPOSE_EXPONENTIATE
00092 } stp_curve_compose_t;
00093
00095 typedef enum
00096 {
00098 STP_CURVE_BOUNDS_RESCALE,
00100 STP_CURVE_BOUNDS_CLIP,
00102 STP_CURVE_BOUNDS_ERROR
00103 } stp_curve_bounds_t;
00104
00105
00117 extern stp_curve_t *stp_curve_create(stp_curve_wrap_mode_t wrap);
00118
00127 extern stp_curve_t *stp_curve_create_copy(const stp_curve_t *curve);
00128
00136 extern void stp_curve_copy(stp_curve_t *dest, const stp_curve_t *source);
00137
00143 extern void stp_curve_destroy(stp_curve_t *curve);
00144
00155 extern int stp_curve_set_bounds(stp_curve_t *curve, double low, double high);
00156
00163 extern void stp_curve_get_bounds(const stp_curve_t *curve,
00164 double *low, double *high);
00165
00171 extern stp_curve_wrap_mode_t stp_curve_get_wrap(const stp_curve_t *curve);
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 extern void stp_curve_get_range(const stp_curve_t *curve,
00182 double *low, double *high);
00183
00189 extern size_t stp_curve_count_points(const stp_curve_t *curve);
00190
00197 extern int stp_curve_set_interpolation_type(stp_curve_t *curve,
00198 stp_curve_type_t itype);
00199
00205 extern stp_curve_type_t stp_curve_get_interpolation_type(const stp_curve_t *curve);
00206
00218 extern int stp_curve_set_data(stp_curve_t *curve, size_t count,
00219 const double *data);
00220
00232 extern int stp_curve_set_float_data(stp_curve_t *curve,
00233 size_t count, const float *data);
00234
00246 extern int stp_curve_set_long_data(stp_curve_t *curve,
00247 size_t count, const long *data);
00248
00260 extern int stp_curve_set_ulong_data(stp_curve_t *curve,
00261 size_t count, const unsigned long *data);
00262
00274 extern int stp_curve_set_int_data(stp_curve_t *curve,
00275 size_t count, const int *data);
00276
00288 extern int stp_curve_set_uint_data(stp_curve_t *curve,
00289 size_t count, const unsigned int *data);
00290
00302 extern int stp_curve_set_short_data(stp_curve_t *curve,
00303 size_t count, const short *data);
00304
00316 extern int stp_curve_set_ushort_data(stp_curve_t *curve,
00317 size_t count, const unsigned short *data);
00318
00330 extern stp_curve_t *stp_curve_get_subrange(const stp_curve_t *curve,
00331 size_t start, size_t count);
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342 extern int stp_curve_set_subrange(stp_curve_t *curve, const stp_curve_t *range,
00343 size_t start);
00344
00354 extern const double *stp_curve_get_data(const stp_curve_t *curve, size_t *count);
00355
00356
00366 extern const float *stp_curve_get_float_data(const stp_curve_t *curve,
00367 size_t *count);
00368
00378 extern const long *stp_curve_get_long_data(const stp_curve_t *curve,
00379 size_t *count);
00380
00390 extern const unsigned long *stp_curve_get_ulong_data(const stp_curve_t *curve,
00391 size_t *count);
00392
00402 extern const int *stp_curve_get_int_data(const stp_curve_t *curve,
00403 size_t *count);
00404
00414 extern const unsigned int *stp_curve_get_uint_data(const stp_curve_t *curve,
00415 size_t *count);
00416
00426 extern const short *stp_curve_get_short_data(const stp_curve_t *curve,
00427 size_t *count);
00428
00438 extern const unsigned short *stp_curve_get_ushort_data(const stp_curve_t *curve,
00439 size_t *count);
00440
00448 extern const stp_sequence_t *stp_curve_get_sequence(const stp_curve_t *curve);
00449
00463 extern int stp_curve_set_gamma(stp_curve_t *curve, double f_gamma);
00464
00470 extern double stp_curve_get_gamma(const stp_curve_t *curve);
00471
00481 extern int stp_curve_set_point(stp_curve_t *curve, size_t where, double data);
00482
00491 extern int stp_curve_get_point(const stp_curve_t *curve, size_t where,
00492 double *data);
00493
00505 extern int stp_curve_interpolate_value(const stp_curve_t *curve,
00506 double where, double *result);
00507
00518 extern int stp_curve_resample(stp_curve_t *curve, size_t points);
00519
00530 extern int stp_curve_rescale(stp_curve_t *curve, double scale,
00531 stp_curve_compose_t mode,
00532 stp_curve_bounds_t bounds_mode);
00533
00549 extern int stp_curve_write(FILE *file, const stp_curve_t *curve);
00550
00566 extern char *stp_curve_write_string(const stp_curve_t *curve);
00567
00576 extern stp_curve_t *stp_curve_create_from_stream(FILE* fp);
00577
00586 extern stp_curve_t *stp_curve_create_from_file(const char* file);
00587
00596 extern stp_curve_t *stp_curve_create_from_string(const char* string);
00597
00618 extern int stp_curve_compose(stp_curve_t **retval,
00619 stp_curve_t *a, stp_curve_t *b,
00620 stp_curve_compose_t mode, int points);
00621
00624 #ifdef __cplusplus
00625 }
00626 #endif
00627
00628 #endif
00629
00630
00631