GwyDataView

GwyDataView — Data field displaying area

Synopsis




            GwyDataView;
            GwyDataViewClass;
GtkWidget*  gwy_data_view_new               (GwyContainer *data);
GwyPixmapLayer* gwy_data_view_get_base_layer
                                            (GwyDataView *data_view);
GwyPixmapLayer* gwy_data_view_get_alpha_layer
                                            (GwyDataView *data_view);
GwyVectorLayer* gwy_data_view_get_top_layer (GwyDataView *data_view);
void        gwy_data_view_set_base_layer    (GwyDataView *data_view,
                                             GwyPixmapLayer *layer);
void        gwy_data_view_set_alpha_layer   (GwyDataView *data_view,
                                             GwyPixmapLayer *layer);
void        gwy_data_view_set_top_layer     (GwyDataView *data_view,
                                             GwyVectorLayer *layer);
gdouble     gwy_data_view_get_hexcess       (GwyDataView *data_view);
gdouble     gwy_data_view_get_vexcess       (GwyDataView *data_view);
void        gwy_data_view_set_zoom          (GwyDataView *data_view,
                                             gdouble zoom);
gdouble     gwy_data_view_get_zoom          (GwyDataView *data_view);
gdouble     gwy_data_view_get_real_zoom     (GwyDataView *data_view);
GwyContainer* gwy_data_view_get_data        (GwyDataView *data_view);
void        gwy_data_view_coords_xy_clamp   (GwyDataView *data_view,
                                             gint *xscr,
                                             gint *yscr);
void        gwy_data_view_coords_xy_to_real (GwyDataView *data_view,
                                             gint xscr,
                                             gint yscr,
                                             gdouble *xreal,
                                             gdouble *yreal);
void        gwy_data_view_coords_real_to_xy (GwyDataView *data_view,
                                             gdouble xreal,
                                             gdouble yreal,
                                             gint *xscr,
                                             gint *yscr);
gdouble     gwy_data_view_get_xmeasure      (GwyDataView *data_view);
gdouble     gwy_data_view_get_ymeasure      (GwyDataView *data_view);
GdkPixbuf*  gwy_data_view_get_thumbnail     (GwyDataView *data_view,
                                             gint size);
GdkPixbuf*  gwy_data_view_get_pixbuf        (GwyDataView *data_view,
                                             gint max_width,
                                             gint max_height);

Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GwyDataView

Implemented Interfaces

GwyDataView implements AtkImplementorIface.

Properties


  "zoom"                 gdouble               : Read / Write

Signal Prototypes


"redrawn"   void        user_function      (GwyDataView *gwydataview,
                                            gpointer user_data);

Description

Details

GwyDataView

typedef struct _GwyDataView GwyDataView;


GwyDataViewClass

typedef struct {
    GtkWidgetClass parent_class;

    void (*redrawn)(GwyDataView *data_view);

    gpointer reserved2;
} GwyDataViewClass;


gwy_data_view_new ()

GtkWidget*  gwy_data_view_new               (GwyContainer *data);

Creates a new data-displaying widget for data.

A newly created GwyDataView doesn't display anything. You have to add some layers to it, at least a base layer with gwy_data_view_set_base_layer(), and possibly others with gwy_data_view_set_alpha_layer() and gwy_data_view_set_top_layer().

The top layer is special. It must be a vector layer and can receive mouse and keyboard events.

The base layer it also special. It must be always present, and must not be transparent or vector.

data : A GwyContainer containing the data to display.
Returns : A newly created data view as a GtkWidget.

gwy_data_view_get_base_layer ()

GwyPixmapLayer* gwy_data_view_get_base_layer
                                            (GwyDataView *data_view);

Returns the base layer this data view currently uses.

A base layer should be always present.

data_view : A data view.
Returns : The currently used base layer.

gwy_data_view_get_alpha_layer ()

GwyPixmapLayer* gwy_data_view_get_alpha_layer
                                            (GwyDataView *data_view);

Returns the alpha layer this data view currently uses, or NULL if none is present.

data_view : A data view.
Returns : The currently used alpha layer.

gwy_data_view_get_top_layer ()

GwyVectorLayer* gwy_data_view_get_top_layer (GwyDataView *data_view);

Returns the top layer this data view currently uses, or NULL if none is present.

data_view : A data view.
Returns : The currently used top layer.

gwy_data_view_set_base_layer ()

void        gwy_data_view_set_base_layer    (GwyDataView *data_view,
                                             GwyPixmapLayer *layer);

Plugs layer to data_view as the base layer.

If another base layer is present, it's unplugged.

The layer must not be a vector layer. Theoretically, it can be NULL to use no base layer, but then data_view will probably display garbage.

data_view : A data view.
layer : A layer to be used as the base layer for data_view.

gwy_data_view_set_alpha_layer ()

void        gwy_data_view_set_alpha_layer   (GwyDataView *data_view,
                                             GwyPixmapLayer *layer);

Plugs layer to data_view as the alpha layer.

If another alpha layer is present, it's unplugged.

The layer must not be a vector layer. It can be NULL, meaning no alpha layer is to be used.

data_view : A data view.
layer : A layer to be used as the alpha layer for data_view.

gwy_data_view_set_top_layer ()

void        gwy_data_view_set_top_layer     (GwyDataView *data_view,
                                             GwyVectorLayer *layer);

Plugs layer to data_view as the top layer.

If another top layer is present, it's unplugged.

The layer must be a vector layer. It can be NULL, meaning no top layer is to be used.

data_view : A data view.
layer : A layer to be used as the top layer for data_view.

gwy_data_view_get_hexcess ()

gdouble     gwy_data_view_get_hexcess       (GwyDataView *data_view);

Return the horizontal excess of widget size to data size.

Do not use. Only useful for GwyDataWindow implementation.

data_view : A data view.
Returns : The execess.

gwy_data_view_get_vexcess ()

gdouble     gwy_data_view_get_vexcess       (GwyDataView *data_view);

Return the vertical excess of widget size to data size.

Do not use. Only useful for GwyDataWindow implementation.

data_view : A data view.
Returns : The execess.

gwy_data_view_set_zoom ()

void        gwy_data_view_set_zoom          (GwyDataView *data_view,
                                             gdouble zoom);

Sets zoom of data_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.

data_view : A data view.
zoom : A new zoom value.

gwy_data_view_get_zoom ()

gdouble     gwy_data_view_get_zoom          (GwyDataView *data_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 data_view would like to have. Use gwy_data_view_get_real_zoom() to get the real zoom.

data_view : A data view.
Returns : The zoom as a ratio between ideal displayed size and base data field size.

gwy_data_view_get_real_zoom ()

gdouble     gwy_data_view_get_real_zoom     (GwyDataView *data_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.

data_view : A data view.
Returns : The zoom as a ratio between real displayed size and base data field size.

gwy_data_view_get_data ()

GwyContainer* gwy_data_view_get_data        (GwyDataView *data_view);

Returns the data container used by data_view.

data_view : A data view.
Returns : The data as a GwyContainer.

gwy_data_view_coords_xy_clamp ()

void        gwy_data_view_coords_xy_clamp   (GwyDataView *data_view,
                                             gint *xscr,
                                             gint *yscr);

Fixes screen coordinates xscr and yscr to be inside the data-displaying area (which can be smaller than widget size).

data_view : A data view.
xscr : A screen x-coordinate relative to widget origin.
yscr : A screen y-coordinate relative to widget origin.

gwy_data_view_coords_xy_to_real ()

void        gwy_data_view_coords_xy_to_real (GwyDataView *data_view,
                                             gint xscr,
                                             gint yscr,
                                             gdouble *xreal,
                                             gdouble *yreal);

Recomputes screen coordinates relative to widget origin to physical coordinates in the sample.

data_view : A data view.
xscr : A screen x-coordinate relative to widget origin.
yscr : A screen y-coordinate relative to widget origin.
xreal : Where the physical x-coordinate in the data sample should be stored.
yreal : Where the physical y-coordinate in the data sample should be stored.

gwy_data_view_coords_real_to_xy ()

void        gwy_data_view_coords_real_to_xy (GwyDataView *data_view,
                                             gdouble xreal,
                                             gdouble yreal,
                                             gint *xscr,
                                             gint *yscr);

Recomputes physical coordinate in the sample to screen coordinate relative to widget origin.

data_view : A data view.
xreal : A physical x-coordinate in the data sample..
yreal : A physical y-coordinate in the data sample.
xscr : Where the screen x-coordinate relative to widget origin should be stored.
yscr : Where the screen y-coordinate relative to widget origin should be stored.

gwy_data_view_get_xmeasure ()

gdouble     gwy_data_view_get_xmeasure      (GwyDataView *data_view);

Returns the ratio between horizontal physical lengths and horizontal screen lengths in pixels.

data_view : A data view.
Returns : The horizontal measure.

gwy_data_view_get_ymeasure ()

gdouble     gwy_data_view_get_ymeasure      (GwyDataView *data_view);

Returns the ratio between vertical physical lengths and horizontal screen lengths in pixels.

data_view : A data view.
Returns : The vertical measure.

gwy_data_view_get_thumbnail ()

GdkPixbuf*  gwy_data_view_get_thumbnail     (GwyDataView *data_view,
                                             gint size);

Creates and returns a thumbnail of the data view.

If the data is not square, it is centered onto the pixbuf, with transparent borders. The returned pixbuf always has an alpha channel, even if it fits exactly.

data_view : A data view.
size : Requested thumbnail size.
Returns : The thumbnail as a newly created GdkPixbuf, which should be freed when no longer needed.

gwy_data_view_get_pixbuf ()

GdkPixbuf*  gwy_data_view_get_pixbuf        (GwyDataView *data_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, this is different from gwy_data_view_get_thumbnail(). The returned pixbuf also never has alpha channel.

data_view : A data view.
max_width : Pixbuf width that should not be exceeeded. Value smaller than 1 means unlimited size.
max_height : Pixbuf height that should not be exceeeded. Value smaller than 1 means unlimited size.
Returns : The pixbuf as a newly created GdkPixbuf, it should be freed when no longer needed. It is never larger than the actual data size, as max_width and max_height are only upper limits.

Properties

The "zoom" property

  "zoom"                 gdouble               : Read / Write

The :zoom property is the ratio between displayed and real data size.

Allowed values: [0.0625,16]

Default value: 1

Signals

The "redrawn" signal

void        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_thumbnail() or gwy_data_view_get_pixbuf().

gwydataview : The GwyDataView which received the signal.
user_data : user data set when the signal handler was connected.