GimpPreview

GimpPreview — A widget providing a GimpPreviewArea plus framework to update the preview.

Synopsis

                    GimpPreview;
gboolean            gimp_preview_get_update             (GimpPreview *preview);
void                gimp_preview_set_update             (GimpPreview *preview,
                                                         gboolean update);
void                gimp_preview_set_bounds             (GimpPreview *preview,
                                                         gint xmin,
                                                         gint ymin,
                                                         gint xmax,
                                                         gint ymax);
void                gimp_preview_get_size               (GimpPreview *preview,
                                                         gint *width,
                                                         gint *height);
void                gimp_preview_get_position           (GimpPreview *preview,
                                                         gint *x,
                                                         gint *y);
void                gimp_preview_transform              (GimpPreview *preview,
                                                         gint src_x,
                                                         gint src_y,
                                                         gint *dest_x,
                                                         gint *dest_y);
void                gimp_preview_untransform            (GimpPreview *preview,
                                                         gint src_x,
                                                         gint src_y,
                                                         gint *dest_x,
                                                         gint *dest_y);
GtkWidget *         gimp_preview_get_area               (GimpPreview *preview);
void                gimp_preview_draw                   (GimpPreview *preview);
void                gimp_preview_draw_buffer            (GimpPreview *preview,
                                                         const guchar *buffer,
                                                         gint rowstride);
void                gimp_preview_invalidate             (GimpPreview *preview);
void                gimp_preview_set_default_cursor     (GimpPreview *preview,
                                                         GdkCursor *cursor);
GtkWidget *         gimp_preview_get_controls           (GimpPreview *preview);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBox
                                 +----GimpPreview
                                       +----GimpScrolledPreview

Implemented Interfaces

GimpPreview implements AtkImplementorIface, GtkBuildable and GtkOrientable.

Properties

  "update"                   gboolean              : Read / Write / Construct

Style Properties

  "size"                     gint                  : Read

Signals

  "invalidated"                                    : Run First

Description

A widget providing a GimpPreviewArea plus framework to update the preview.

Details

GimpPreview

typedef struct _GimpPreview GimpPreview;


gimp_preview_get_update ()

gboolean            gimp_preview_get_update             (GimpPreview *preview);

preview :

a GimpPreview widget

Returns :

the state of the "Preview" check button.

Since GIMP 2.2


gimp_preview_set_update ()

void                gimp_preview_set_update             (GimpPreview *preview,
                                                         gboolean update);

Sets the state of the "Preview" check button.

preview :

a GimpPreview widget

update :

TRUE if the preview should invalidate itself when being scrolled or when gimp_preview_invalidate() is being called

Since GIMP 2.2


gimp_preview_set_bounds ()

void                gimp_preview_set_bounds             (GimpPreview *preview,
                                                         gint xmin,
                                                         gint ymin,
                                                         gint xmax,
                                                         gint ymax);

Sets the lower and upper limits for the previewed area. The difference between the upper and lower value is used to set the maximum size of the GimpPreviewArea used in the preview.

preview :

a GimpPreview widget

xmin :

the minimum X value

ymin :

the minimum Y value

xmax :

the maximum X value

ymax :

the maximum Y value

Since GIMP 2.2


gimp_preview_get_size ()

void                gimp_preview_get_size               (GimpPreview *preview,
                                                         gint *width,
                                                         gint *height);

preview :

a GimpPreview widget

width :

return location for the preview area width

height :

return location for the preview area height

Since GIMP 2.2


gimp_preview_get_position ()

void                gimp_preview_get_position           (GimpPreview *preview,
                                                         gint *x,
                                                         gint *y);

preview :

a GimpPreview widget

x :

return location for the horizontal offset

y :

return location for the vertical offset

Since GIMP 2.2


gimp_preview_transform ()

void                gimp_preview_transform              (GimpPreview *preview,
                                                         gint src_x,
                                                         gint src_y,
                                                         gint *dest_x,
                                                         gint *dest_y);

Transforms from image to widget coordinates.

preview :

a GimpPreview widget

src_x :

horizontal position on the previewed image

src_y :

vertical position on the previewed image

dest_x :

returns the transformed horizontal position

dest_y :

returns the transformed vertical position

Since GIMP 2.4


gimp_preview_untransform ()

void                gimp_preview_untransform            (GimpPreview *preview,
                                                         gint src_x,
                                                         gint src_y,
                                                         gint *dest_x,
                                                         gint *dest_y);

Transforms from widget to image coordinates.

preview :

a GimpPreview widget

src_x :

horizontal position relative to the preview area's origin

src_y :

vertical position relative to preview area's origin

dest_x :

returns the untransformed horizontal position

dest_y :

returns the untransformed vertical position

Since GIMP 2.4


gimp_preview_get_area ()

GtkWidget *         gimp_preview_get_area               (GimpPreview *preview);

In most cases, you shouldn't need to access the GimpPreviewArea that is being used in the preview. Sometimes however, you need to. For example if you want to receive mouse events from the area. In such cases, use gimp_preview_get_area().

preview :

a GimpPreview widget

Returns :

a pointer to the GimpPreviewArea used in the preview.

Since GIMP 2.4


gimp_preview_draw ()

void                gimp_preview_draw                   (GimpPreview *preview);

Calls the GimpPreview::draw method. GimpPreview itself doesn't implement a default draw method so the behaviour is determined by the derived class implementing this method.

GimpDrawablePreview implements gimp_preview_draw() by drawing the original, unmodified drawable to the preview.

preview :

a GimpPreview widget

Since GIMP 2.2


gimp_preview_draw_buffer ()

void                gimp_preview_draw_buffer            (GimpPreview *preview,
                                                         const guchar *buffer,
                                                         gint rowstride);

Calls the GimpPreview::draw_buffer method. GimpPreview itself doesn't implement this method so the behaviour is determined by the derived class implementing this method.

preview :

a GimpPreview widget

buffer :

a pixel buffer the size of the preview

rowstride :

the buffer's rowstride

Since GIMP 2.2


gimp_preview_invalidate ()

void                gimp_preview_invalidate             (GimpPreview *preview);

This function starts or renews a short low-priority timeout. When the timeout expires, the GimpPreview::invalidated signal is emitted which will usually cause the preview to be updated.

This function does nothing unless the "Preview" button is checked.

During the emission of the signal a busy cursor is set on the toplevel window containing the preview and on the preview area itself.

preview :

a GimpPreview widget

Since GIMP 2.2


gimp_preview_set_default_cursor ()

void                gimp_preview_set_default_cursor     (GimpPreview *preview,
                                                         GdkCursor *cursor);

Sets the default mouse cursor for the preview. Note that this will be overriden by a GDK_FLEUR if the preview has scrollbars, or by a GDK_WATCH when the preview is invalidated.

preview :

a GimpPreview widget

cursor :

a GdkCursor or NULL

Since GIMP 2.2


gimp_preview_get_controls ()

GtkWidget *         gimp_preview_get_controls           (GimpPreview *preview);

Gives access to the GtkHBox at the bottom of the preview that contains the update toggle. Derived widgets can use this function if they need to add controls to this area.

preview :

a GimpPreview widget

Returns :

the GtkHBox at the bottom of the preview.

Since GIMP 2.4

Property Details

The "update" property

  "update"                   gboolean              : Read / Write / Construct

Default value: TRUE

Style Property Details

The "size" style property

  "size"                     gint                  : Read

Allowed values: [1,1024]

Default value: 200

Signal Details

The "invalidated" signal

void                user_function                      (GimpPreview *gimppreview,
                                                        gpointer     user_data)        : Run First

gimppreview :

the object which received the signal.

user_data :

user data set when the signal handler was connected.