GtkPreview

GtkPreview — A widget to display RGB or grayscale data

Synopsis

#include <gtk/gtk.h>

struct              GtkPreview;
struct              GtkPreviewInfo;
union               GtkDitherInfo;
void                gtk_preview_uninit                  (void);
GtkWidget *         gtk_preview_new                     (GtkPreviewType type);
void                gtk_preview_size                    (GtkPreview *preview,
                                                         gint width,
                                                         gint height);
void                gtk_preview_put                     (GtkPreview *preview,
                                                         GdkWindow *window,
                                                         GdkGC *gc,
                                                         gint srcx,
                                                         gint srcy,
                                                         gint destx,
                                                         gint desty,
                                                         gint width,
                                                         gint height);
void                gtk_preview_draw_row                (GtkPreview *preview,
                                                         guchar *data,
                                                         gint x,
                                                         gint y,
                                                         gint w);
void                gtk_preview_set_expand              (GtkPreview *preview,
                                                         gboolean expand);
void                gtk_preview_set_gamma               (double gamma_);
void                gtk_preview_set_color_cube          (guint nred_shades,
                                                         guint ngreen_shades,
                                                         guint nblue_shades,
                                                         guint ngray_shades);
void                gtk_preview_set_install_cmap        (gint install_cmap);
void                gtk_preview_set_reserved            (gint nreserved);
void                gtk_preview_set_dither              (GtkPreview *preview,
                                                         GdkRgbDither dither);
GdkVisual *         gtk_preview_get_visual              (void);
GdkColormap *       gtk_preview_get_cmap                (void);
GtkPreviewInfo *    gtk_preview_get_info                (void);
void                gtk_preview_reset                   (void);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkPreview

Implemented Interfaces

GtkPreview implements AtkImplementorIface and GtkBuildable.

Properties

  "expand"                   gboolean              : Read / Write

Description

The GtkPreview widget provides a simple interface used to display images as RGB or grayscale data. It's deprecated; just use a GdkPixbuf displayed by a GtkImage, or perhaps a GtkDrawingArea. GtkPreview has no advantage over those approaches.

Details

struct GtkPreview

struct GtkPreview;

Warning

GtkPreview is deprecated and should not be used in newly-written code.

The GtkPreview struct contains private data only, and should be accessed using the functions below.


struct GtkPreviewInfo

struct GtkPreviewInfo {
  guchar *lookup;

  gdouble gamma;
};

Warning

GtkPreviewInfo is deprecated and should not be used in newly-written code.

Contains information about global properties of preview widgets. The GtkPreviewInfo struct contains the following fields. (These fields should be considered read-only. They should never be set by an application.)

GdkVisual *visual; the visual used by all previews.
GdkColormap *cmap; the colormap used by all previews.
gdouble gamma; the gamma correction value used by all previews (See gtk_preview_set_gamma()).


union GtkDitherInfo

union _GtkDitherInfo
{
  gushort s[2];
  guchar c[4];
};

Warning

GtkDitherInfo is deprecated and should not be used in newly-written code.

This union not used in GTK+.


gtk_preview_uninit ()

void                gtk_preview_uninit                  (void);

Warning

gtk_preview_uninit is deprecated and should not be used in newly-written code.

This function is deprecated and does nothing.


gtk_preview_new ()

GtkWidget *         gtk_preview_new                     (GtkPreviewType type);

Warning

gtk_preview_new is deprecated and should not be used in newly-written code.

Create a new preview widget.

type :

the type data contained by the widget. (Grayscale or RGB)

Returns :

a new GtkPreview

gtk_preview_size ()

void                gtk_preview_size                    (GtkPreview *preview,
                                                         gint width,
                                                         gint height);

Warning

gtk_preview_size is deprecated and should not be used in newly-written code.

Set the size that the preview widget will request in response to a "size_request" signal. The drawing area may actually be allocated a size larger than this depending on how it is packed within the enclosing containers. The effect of this is determined by whether the preview is set to expand or not (see gtk_preview_expand())

preview :

a GtkPreview.

width :

the new width.

height :

the new height.

gtk_preview_put ()

void                gtk_preview_put                     (GtkPreview *preview,
                                                         GdkWindow *window,
                                                         GdkGC *gc,
                                                         gint srcx,
                                                         gint srcy,
                                                         gint destx,
                                                         gint desty,
                                                         gint width,
                                                         gint height);

Warning

gtk_preview_put is deprecated and should not be used in newly-written code.

Takes a portion of the contents of a preview widget and draws it onto the given drawable, window.

preview :

a GtkPreview.

window :

a window or pixmap.

gc :

The graphics context for the operation. Only the clip mask for this GC matters.

srcx :

the x coordinate of the upper left corner in the source image.

srcy :

the y coordinate of the upper left corner in the source image.

destx :

the x coordinate of the upper left corner in the destination image.

desty :

the y coordinate of the upper left corner in the destination image.

width :

the width of the rectangular portion to draw.

height :

the height of the rectangular portion to draw.

gtk_preview_draw_row ()

void                gtk_preview_draw_row                (GtkPreview *preview,
                                                         guchar *data,
                                                         gint x,
                                                         gint y,
                                                         gint w);

Warning

gtk_preview_draw_row is deprecated and should not be used in newly-written code.

Sets the data for a portion of a row.

preview :

a GtkPreview.

data :

the new data for the portion. It should contain w bytes of data if the preview is of type GTK_TYPE_GRAYSCALE, and 3*w bytes of data if the preview is of type GTK_TYPE_COLOR.

x :

the starting value on the row to set.

y :

the row to change.

w :

the number of pixels in the row to change.

gtk_preview_set_expand ()

void                gtk_preview_set_expand              (GtkPreview *preview,
                                                         gboolean expand);

Warning

gtk_preview_set_expand is deprecated and should not be used in newly-written code.

Determines the way that the the preview widget behaves when the size it is allocated is larger than the requested size. If expand is FALSE, then the preview's window and buffer will be no larger than the size set with gtk_preview_size(), and the data set will be centered in the allocation if it is larger. If expand is TRUE then the window and buffer will expand with the allocation; the application is responsible for catching the "size_allocate" signal and providing the data appropriate for this size.

preview :

a GtkPreview.

expand :

whether the preview's window should expand or not.

gtk_preview_set_gamma ()

void                gtk_preview_set_gamma               (double gamma_);

Warning

gtk_preview_set_gamma is deprecated and should not be used in newly-written code.

Set the gamma-correction value for all preview widgets. (This function will eventually be replaced with a function that sets a per-preview-widget gamma value). The resulting intensity is given by: destination_value * pow (source_value/255, 1/gamma). The gamma value is applied when the data is set with gtk_preview_draw_row() so changing this value will not affect existing data in preview widgets.

gamma_ :

the new gamma value.

gtk_preview_set_color_cube ()

void                gtk_preview_set_color_cube          (guint nred_shades,
                                                         guint ngreen_shades,
                                                         guint nblue_shades,
                                                         guint ngray_shades);

Warning

gtk_preview_set_color_cube is deprecated and should not be used in newly-written code.

This function is deprecated and does nothing. GdkRGB automatically picks an optimium color cube for the display.

nred_shades :

ignored

ngreen_shades :

ignored

nblue_shades :

ignored

ngray_shades :

ignored

gtk_preview_set_install_cmap ()

void                gtk_preview_set_install_cmap        (gint install_cmap);

Warning

gtk_preview_set_install_cmap is deprecated and should not be used in newly-written code.

This function is deprecated and does nothing. GdkRGB will automatically pick a private colormap if it cannot allocate sufficient colors.

install_cmap :

ignored.

gtk_preview_set_reserved ()

void                gtk_preview_set_reserved            (gint nreserved);

Warning

gtk_preview_set_reserved is deprecated and should not be used in newly-written code.

This function is deprecated and does nothing.

nreserved :

ignored.

gtk_preview_set_dither ()

void                gtk_preview_set_dither              (GtkPreview *preview,
                                                         GdkRgbDither dither);

Warning

gtk_preview_set_dither is deprecated and should not be used in newly-written code.

Set the dithering mode for the display.

preview :

a GtkPreview.

dither :

the dithering mode.

gtk_preview_get_visual ()

GdkVisual *         gtk_preview_get_visual              (void);

Warning

gtk_preview_get_visual is deprecated and should not be used in newly-written code.

Returns the visual used by preview widgets. This function is deprecated, and you should use gdk_rgb_get_visual() instead.

Returns :

the visual for previews.

gtk_preview_get_cmap ()

GdkColormap *       gtk_preview_get_cmap                (void);

Warning

gtk_preview_get_cmap is deprecated and should not be used in newly-written code.

Returns the colormap used by preview widgets. This function is deprecated, and you should use gdk_rgb_get_cmap() instead.

Returns :

the colormap for previews.

gtk_preview_get_info ()

GtkPreviewInfo *    gtk_preview_get_info                (void);

Warning

gtk_preview_get_info is deprecated and should not be used in newly-written code.

Return a GtkPreviewInfo structure containing global information about preview widgets.

Returns :

a GtkPreviewInfo structure. The return value belongs to GTK+ and must not be modified or freed.

gtk_preview_reset ()

void                gtk_preview_reset                   (void);

Warning

gtk_preview_reset is deprecated and should not be used in newly-written code.

This function is deprecated and does nothing. It was once used for changing the colormap and visual on the fly.

Property Details

The "expand" property

  "expand"                   gboolean              : Read / Write

Whether the preview widget should take up the entire space it is allocated.

Default value: FALSE

See Also

GdkRGB

the backend used by GtkPreview.