## gwypixfield gwypixfield — Draw GwyDataFields to GdkPixbufs |

## Functions

void | gwy_pixbuf_draw_data_field ()
void | gwy_pixbuf_draw_data_field_with_range ()
void | gwy_pixbuf_draw_data_field_adaptive ()
void | gwy_draw_data_field_map_adaptive ()
void | gwy_pixbuf_draw_data_field_as_mask ()

## Includes

    #include <libdraw/gwydraw.h>

## 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.

## Functions

### 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` .

#### Parameters

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` .

#### Parameters

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.

#### Parameters

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

### gwy_draw_data_field_map_adaptive ()

    void
    gwy_draw_data_field_map_adaptive (GwyDataField *data_field,
                                      const gdouble *z,
                                      gdouble *mapped,
                                      guint n);

Maps ordinate values to interval [0,1] as `gwy_pixbuf_draw_data_field_adaptive()` would do.

This is useful to find out which positions in the false colour gradient correspond to specific values.

#### Parameters

data_field | A data field to draw. |
z | Array of `n` data values to map. |
mapped | Output array of size `n` where mapped `z` values are to be stored. |
n | Number of elements in `z` and `mapped` . |

Since: 2.39

### 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 single-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.

#### Parameters

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