## gwypixfield

gwypixfield — Draw GwyDataFields to GdkPixbufs

## Synopsis

    #include <libdraw/gwydraw.h>

    void                gwy_pixbuf_draw_data_field          (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             GwyGradient *gradient);
    void                gwy_pixbuf_draw_data_field_with_range
                                                            (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             GwyGradient *gradient,
                                                             gdouble minimum,
                                                             gdouble maximum);
    void                gwy_pixbuf_draw_data_field_adaptive (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             GwyGradient *gradient);
    void                gwy_pixbuf_draw_data_field_as_mask  (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             const GwyRGBA *color);

## Description

The simpliest method to render a GwyDataField to a GdkPixbuf with a false color scale is `gwy_pixbuf_draw_data_field()` which uniformly stretches the color gradient from value minimum to maximum. Functions `gwy_pixbuf_draw_data_field_with_range()` and `gwy_pixbuf_draw_data_field_adaptive()` offer other false color mapping possibilities. A bit different is `gwy_pixbuf_draw_data_field_as_mask()` which represents the values as opacities of a signle color.

## Details

### gwy_pixbuf_draw_data_field ()

    void                gwy_pixbuf_draw_data_field          (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             GwyGradient *gradient);

Paints a data field to a pixbuf with an auto-stretched color gradient.

Minimum data value is mapped to start of `gradient`, maximum value to its end, values between are mapped linearly to `gradient`.

`pixbuf` : | A Gdk pixbuf to draw to.
`data_field` : | A data field to draw.
`gradient` : | A color gradient to draw with.

### gwy_pixbuf_draw_data_field_with_range ()

    void                gwy_pixbuf_draw_data_field_with_range
                                                            (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             GwyGradient *gradient,
                                                             gdouble minimum,
                                                             gdouble maximum);

Paints a data field to a pixbuf with an explicite color gradient range.

`minimum` and all smaller values are mapped to start of `gradient`, `maximum` and all greater values to its end, values between are mapped linearly to `gradient`.

`pixbuf` : | A Gdk pixbuf to draw to.
`data_field` : | A data field to draw.
`gradient` : | A color gradient to draw with.
`minimum` : | The value corresponding to gradient start.
`maximum` : | The value corresponding to gradient end.

### gwy_pixbuf_draw_data_field_adaptive ()

    void                gwy_pixbuf_draw_data_field_adaptive (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             GwyGradient *gradient);

Paints a data field to a pixbuf with a color gradient adaptively.

The mapping from data field (minimum, maximum) range to gradient is nonlinear, deformed using inverse function to height density cummulative distribution.

`pixbuf` : | A Gdk pixbuf to draw to.
`data_field` : | A data field to draw.
`gradient` : | A color gradient to draw with.

### gwy_pixbuf_draw_data_field_as_mask ()

    void                gwy_pixbuf_draw_data_field_as_mask  (GdkPixbuf *pixbuf,
                                                             GwyDataField *data_field,
                                                             const GwyRGBA *color);

Paints a data field to a pixbuf as a signle-color mask with varying opacity.

Values equal or smaller to 0.0 are drawn as fully transparent, values greater or equal to 1.0 as fully opaque, values between are linearly mapped to pixel opacity.

`pixbuf` : | A Gdk pixbuf to draw to.
`data_field` : | A data field to draw.
`color` : | A color to use.