| Top |
| GwyColorMappingType | color-mapping | Read / Write |
| GwyDataField * | field | Read / Write |
| GwyGradient * | gradient | Read / Write |
| GwyDataField * | mask | Read / Write |
| GwyRGBA * | mask-color | Read / Write |
| gboolean | real-square | Read / Write |
| gboolean | resizable | Read / Write |
| double | zoom | Read / Write |
GwyDataView is a basic two-dimensional data display widget. The actual rendering is performed by one or more
GwyDataViewLayer's, pluggable into the data view. Each layer generally displays different data field from the
container supplied to gwy_data_view_new().
The size of a data view is affected by two factors: zoom and outer constraints. If an explicit size set by window
manager or by Gtk+ means, the view scales the displayed data to fit into this size (while keeping x/y ratio). Zoom
controlls the size a data view requests, and can be set with gwy_data_view_set_zoom().
Several helper functions are available for transformation between screen coordinates in the view and physical
coordinates in the displayed data field: gwy_data_view_coords_widget_to_real(), gwy_data_view_get_xmeasure(),
gwy_data_view_get_hexcess(), and others. Physical coordinates are always taken from data field displayed by base
layer.
GtkWidget *
gwy_data_view_new (void);
Creates a new data field-displaying widget.
Use gwy_data_view_set_field() to set the data field to display.
[constructor]
GwyDataField *
gwy_data_view_get_field (GwyDataView *view);
Gets the data field currently shown by the data view.
void gwy_data_view_set_field (GwyDataView *view,GwyDataField *field);
Sets the data field to display in a data view.
GwyDataField *
gwy_data_view_get_mask (GwyDataView *view);
Gets the mask field currently shown by the data view.
void gwy_data_view_set_mask (GwyDataView *view,GwyDataField *mask);
Sets the .
GwyVectorLayer *
gwy_data_view_get_interactive_layer (GwyDataView *view);
Returns the top layer this data view currently uses, or NULL if none is present.
void gwy_data_view_set_interactive_layer (GwyDataView *view,GwyVectorLayer *layer);
Plugs layer
to view
as the top layer.
If another top layer is present, it's unplugged.
The layer can be NULL, meaning no top layer is to be used.
gboolean
gwy_data_view_get_real_square (GwyDataView *view);
Gets the whether the aspect ratio of a data view should be based on physical or pixel coordinates.
void gwy_data_view_set_real_square (GwyDataView *view,gboolean real_square);
Sets the whether the aspect ratio of a data view should be based on physical or pixel coordinates.
void gwy_data_view_get_color_range (GwyDataView *view,gdouble *min,gdouble *max);
Gets the actual colour mapping range of a data view.
The actual range is updated only when the widet is actually drawn. See gwy_data_view_get_fixed_color_range() for
the fixed colour mapping range, which applied in the GWY_COLOR_MAPPING_FIXED mode.
void gwy_data_view_get_fixed_color_range (GwyDataView *view,gdouble *min,gdouble *max);
Gets the fixed colour mapping range of a data view.
See gwy_data_view_get_color_range() for the actual range, even when it is automatic.
void gwy_data_view_set_fixed_color_range (GwyDataView *view,gdouble min,gdouble max);
Sets the fixed colour mapping range of a data view.
The fixed minimum and maximum apply if the mapping type GWY_COLOR_MAPPING_FIXED, as set by
gwy_data_view_set_color_mapping().
GwyColorMappingType
gwy_data_view_get_color_mapping (GwyDataView *view);
Gets the colour mapping type of a data view.
void gwy_data_view_set_color_mapping (GwyDataView *view,GwyColorMappingType mapping);
Sets the colour mapping type of a data view.
The mapping type determines how data values are visualised as colours.
GwyGradient *
gwy_data_view_get_gradient (GwyDataView *view);
Gets the colour gradient use for data visualisation in a data view.
If no specific gradient has been set and the default one is used, the function returns NULL. This is consistent
with getting the corresponding property. If you still need the GwyGradient object in such case, use
gwy_gradients_get_gradient() with NULL argument.
void gwy_data_view_set_gradient (GwyDataView *view,GwyGradient *gradient);
Sets the colour gradient to use for data visualisation in a data view.
If NULL is passed as gradient
, the data view will use the default gradient. Within libgwyui alone, the default
gradient is greyscale. However, when Gwyddion user settings are loaded, the default gradient is set according to
user preferences.
void gwy_data_view_get_mask_color (GwyDataView *view,GwyRGBA *color);
Gets the colour used for mask visualisation in a data view.
void gwy_data_view_set_mask_color (GwyDataView *view,const GwyRGBA *color);
Sets the colour used for mask visualisation in a data view.
gdouble
gwy_data_view_get_hexcess (GwyDataView *view);
Return the horizontal excess of widget size to data size.
Do not use. Only useful for GwyDataWindow implementation.
gdouble
gwy_data_view_get_vexcess (GwyDataView *view);
Return the vertical excess of widget size to data size.
Do not use. Only useful for GwyDataWindow implementation.
gdouble
gwy_data_view_get_zoom (GwyDataView *view);
Returns current ideal zoom of a data view.
More precisely the zoom value requested by gwy_data_view_set_zoom(), if it's in use (real zoom may differ a bit due
to pixel rounding). If zoom was set by explicite widget size change, real and requested zoom are considered to be
the same.
When a resize is queued, the new zoom value is returned.
In other words, this is the zoom view
would like to have. Use gwy_data_view_get_real_zoom() to get the real
zoom.
void gwy_data_view_set_zoom (GwyDataView *view,gdouble zoom);
Sets zoom of view
to zoom
.
Zoom greater than 1 means larger image on screen and vice versa.
Note window manager can prevent the window from resize and thus the zoom from change.
gdouble
gwy_data_view_get_real_zoom (GwyDataView *view);
Returns current real zoom of a data view.
This is the zoom value a data view may not wish to have, but was imposed by window manager or other constraints.
Unlike ideal zoom set by gwy_data_view_set_zoom(), this value cannot be set.
When a resize is queued, the current (old) value is returned.
gboolean gwy_data_view_coords_widget_clamp (GwyDataView *view,gdouble *xscr,gdouble *yscr);
Fixes screen coordinates xscr
and yscr
to be inside the data-displaying area (which can be smaller than widget
size).
gboolean gwy_data_view_coords_widget_cut_line (GwyDataView *view,gdouble *x0scr,gdouble *y0scr,gdouble *x1scr,gdouble *y1scr);
Fixes screen coordinates of line endpoints to be inside the data-displaying area (which can be smaller than widget size).
void gwy_data_view_coords_widget_to_real (GwyDataView *view,gdouble xscr,gdouble yscr,gdouble *xreal,gdouble *yreal);
Recomputes screen coordinates relative to widget origin to physical coordinates in the sample.
Note that data fields offsets are not taken into account. Coordinates xreal
, yreal
are just
relative coordinates to the top left field corner.
void gwy_data_view_coords_real_to_widget (GwyDataView *view,gdouble xreal,gdouble yreal,gdouble *xscr,gdouble *yscr);
Recomputes physical coordinate in the sample to screen coordinate relative to widget origin, keeping them as floating point values.
Note that data fields offsets are not taken into account. Coordinates xreal
, yreal
are just
relative coordinates to the top left field corner.
gdouble
gwy_data_view_get_xmeasure (GwyDataView *view);
Returns the ratio between horizontal physical lengths and horizontal screen lengths in pixels.
gdouble
gwy_data_view_get_ymeasure (GwyDataView *view);
Returns the ratio between vertical physical lengths and horizontal screen lengths in pixels.
gdouble
gwy_data_view_get_xzoom (GwyDataView *view);
Gets the ratio between screen and image horizontal coordinates in a data view.
gdouble
gwy_data_view_get_yzoom (GwyDataView *view);
Gets the ratio between screen and image vertical coordinates in a data view.
void gwy_data_view_set_resizable (GwyDataView *view,gboolean resizable);
Sets the resizeability of a data view.
By default, data views adapt to any size they get allocated and request very small minimum size. This is useful in data windows which should be freely resizeable, for instance.
Module dialogs usually have small fixed-size previews. The data view never grows, but could be still shrinked. In
such case resizable
should be set to FALSE to prevent the shrinking. The data view will then request minimum size
according to zoom.
void gwy_data_view_get_pixel_data_sizes (GwyDataView *view,gint *xres,gint *yres);
Obtains pixel dimensions of data displayed by a data view.
This is a convenience method, the same values could be obtained by gwy_data_field_get_xres() and
gwy_data_field_get_yres() of the data field displayed by the base layer.
void gwy_data_view_get_real_data_sizes (GwyDataView *view,gdouble *xreal,gdouble *yreal);
Obtains physical dimensions of data displayed by a data view.
Physical coordinates are always taken from data field displayed by the base layer. This is a convenience method,
the same values could be obtained by gwy_data_field_get_xreal() and gwy_data_field_get_yreal() of the data field
displayed by the base layer.
void gwy_data_view_get_metric (GwyDataView *view,gdouble *metric);
Fills metric matrix for a data view.
The metric matrix essentially transforms distances in physical coordinates to screen distances. It is to be used
with functions like gwy_math_find_nearest_point() and gwy_math_find_nearest_line() when the distance should be
screen-Euclidean.
GdkPixbuf * gwy_data_view_get_pixbuf (GwyDataView *view,gint max_width,gint max_height);
Creates and returns a pixbuf from the data view.
If the data is not square, the resulting pixbuf is also nonsquare. The returned pixbuf also never has an alpha channel.
void gwy_data_view_set_named_cursor (GwyDataView *view,const gchar *name);
Sets the pointer cursor for a data view to a named cursor.
The cursor name is the same as one would pass to gdk_cursor_new_from_name().
The data view needs to be realised.
This function is intended for the implementation of editable data view layers. If an application sets the cursor, a data view layer will likely change it again soon.
“color-mapping” property“color-mapping” GwyColorMappingType
Type of mapping from data values to colors.
Owner: GwyDataView
Flags: Read / Write
Default value: GWY_COLOR_MAPPING_FULL
“field” property“field” GwyDataField *
Data field to display.
Owner: GwyDataView
Flags: Read / Write
“gradient” property“gradient” GwyGradient *
Color gradient used for data visualization.
Owner: GwyDataView
Flags: Read / Write
“mask” property“mask” GwyDataField *
Mask field to display.
Owner: GwyDataView
Flags: Read / Write
“mask-color” property “mask-color” GwyRGBA *
Color use for mask visualization.
Owner: GwyDataView
Flags: Read / Write
“real-square” property “real-square” gboolean
Whether to display data with physical aspect ratio (as opposed to square pixels).
Owner: GwyDataView
Flags: Read / Write
Default value: FALSE
“resizable” property “resizable” gboolean
Whether resizing by the user is enabled.
Owner: GwyDataView
Flags: Read / Write
Default value: TRUE
“redrawn” signalvoid user_function (GwyDataView *gwydataview, gpointer user_data)
The ::redrawn signal is emitted when GwyDataView redraws pixbufs after an update. That is, when it's the
right time to get a new pixbuf from gwy_data_view_get_pixbuf().
gwydataview |
The GwyDataView which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“resized” signalvoid user_function (GwyDataView *gwydataview, gpointer user_data)
The ::resized signal is emitted when GwyDataView wants to be resized, that is when the dimensions of base data field changes or square mode is changed. Its purpose is to subvert the normal resizing logic of GwyDataWindow (due to geometry hints, its size requests are generally ignored, so an explicit resize is needed). You should usually ignore it.
gwydataview |
The GwyDataView which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First
GwyDataWindow -- window combining data view with other controls, GwyDataViewLayer -- layers a data view is composed of,
pixbuf-render --low level functions for painting data fields, Gwy3DView -- OpenGL 3D data display