CdInterp: colord Reference Manual

## CdInterp CdInterp — Interpolate 2D data using a variety of methods |

## Functions

GQuark | cd_interp_error_quark ()
CdInterpKind | cd_interp_get_kind ()
GArray * | cd_interp_get_x ()
GArray * | cd_interp_get_y ()
guint | cd_interp_get_size ()
void | cd_interp_insert ()
gboolean | cd_interp_prepare ()
gdouble | cd_interp_eval ()
const gchar * | cd_interp_kind_to_string ()

## Types and Values

#define | CD_INTERP_ERROR
#define | CD_INTERP_TYPE_ERROR
#define | CD_TYPE_INTERP
struct | CdInterpClass
enum | CdInterpError
enum | CdInterpKind
| CdInterp

## Description

This object is a superclass of different interpolation methods.

## Functions

### cd_interp_error_quark ()

    GQuark
    cd_interp_error_quark (void);

#### Returns

An error quark.

Since: 0.1.31

### cd_interp_get_kind ()

    CdInterpKind
    cd_interp_get_kind (CdInterp *interp);

Gets the kind of INTERP file.

#### Parameters

interp | a CdInterp instance. |

#### Returns

a CdInterpKind, e.g `CD_INTERP_KIND_AKIMA`.

Since: 0.1.31

### cd_interp_get_x ()

    GArray *
    cd_interp_get_x (CdInterp *interp);

Gets the X data used the interpolation.

NOTE: this is only guaranteed to return the data inserted by `cd_interp_insert()` *BEFORE* calling `cd_interp_prepare()`.

After prepating the CdInterp this data should be considered an implementation detail.

#### Parameters

interp | a CdInterp instance. |

#### Returns

The X co-ordinate data.

[transfer none][element-type gdouble]

Since: 0.1.31

### cd_interp_get_y ()

    GArray *
    cd_interp_get_y (CdInterp *interp);

Gets the Y data used the interpolation.

NOTE: this is only guaranteed to return the data inserted by `cd_interp_insert()` *BEFORE* calling `cd_interp_prepare()`.

After prepating the CdInterp this data should be considered an implementation detail.

#### Parameters

interp | a CdInterp instance. |

#### Returns

The Y co-ordinate data.

[transfer none][element-type gdouble]

Since: 0.1.31

### cd_interp_get_size ()

    guint
    cd_interp_get_size (CdInterp *interp);

Gets the number of items of data added with `cd_interp_insert()`.

NOTE: This method has to be called after `cd_interp_prepare()` and it returns the number of items originally in the array. If you need the updated private size then just use `cd_interp_get_x()` and read the size from that.

#### Parameters

interp | a CdInterp instance. |

#### Returns

The original array size

Since: 0.1.31

### cd_interp_insert ()

    void
    cd_interp_insert (CdInterp *interp,
                      gdouble x,
                      gdouble y);

Inserts data to be interpolated.

#### Parameters

interp | a CdInterp instance. |
x | X data |
y | Y data |

Since: 0.1.31

### cd_interp_prepare ()

    gboolean
    cd_interp_prepare (CdInterp *interp,
                       GError **error);

Prepares the data set so that `cd_interp_eval()` can be used.

#### Parameters

interp | a CdInterp instance. |

#### Returns

`TRUE` for success

Since: 0.1.31

### cd_interp_eval ()

    gdouble
    cd_interp_eval (CdInterp *interp,
                    gdouble value,
                    GError **error);

Evaluate the interpolation function at a specific point. You must have called `cd_interp_insert()` and `cd_interp_prepare()` before calling this method.

#### Parameters

interp | a CdInterp instance. |
value | The X co-ordinate |
error | a GError or `NULL` |

#### Returns

The Y co-ordinate, or -1 for error

Since: 0.1.31

### cd_interp_kind_to_string ()

    const gchar *
    cd_interp_kind_to_string (CdInterpKind kind);

## Types and Values

### CD_INTERP_ERROR

    #define CD_INTERP_ERROR		(cd_interp_error_quark ())

### CD_INTERP_TYPE_ERROR

    #define CD_INTERP_TYPE_ERROR (cd_interp_error_get_type ())

### CD_TYPE_INTERP

    #define CD_TYPE_INTERP (cd_interp_get_type ())

### struct CdInterpClass

    struct CdInterpClass {
    	GObjectClass		 parent_class;
    };

### enum CdInterpError

Errors that can be thrown

#### Members

CD_INTERP_ERROR_FAILED | the method failed for an unknown reason |

### enum CdInterpKind

The kind of interpolation.

#### Members

CD_INTERP_KIND_LINEAR |  |
CD_INTERP_KIND_AKIMA |  |

### CdInterp

    typedef struct _CdInterp CdInterp;