| [Insert name here] Reference Manual | |||
|---|---|---|---|
| <<< Previous Page | Home | Up | Next Page >>> |
#define PREVIEW_FIXED_SIZE #define PREVIEW_DEFAULT_SIZE struct GimpPreviewEvent; GtkWidget* gimp_preview_new (GimpDrawable *drawable); GtkWidget* gimp_preview_new_with_args (GimpDrawable *drawable, gint preview_size, gdouble scale_amount, gint allow_scale); void gimp_preview_update (GimpPreview *preview); gboolean gimp_preview_draw_row (GimpPreview *preview, const gint event_id, GimpImageType type, const gint row, const guchar *const data); gboolean gimp_preview_draw_unscaled_row (GimpPreview *preview, const gint event_id, GimpImageType type, const gint row, const guchar *const data); void gimp_preview_force_redraw (GimpPreview *preview); gboolean gimp_preview_progress_set_fraction (GimpPreview *preview, const gint event_id, double fraction); |
"preview-changed" void user_function (GimpPreview *gimppreview, gpointer user_data); "update-preview" void user_function (GimpPreview *gimppreview, gpointer arg1, gpointer user_data); |
struct GimpPreviewEvent
{
gint event_id; /* Id of this event */
gdouble scale; /* Scale of preview */
/* Left/Top of requested unscaled data in image coordinates */
gint image_x;
gint image_y;
/* Width/Height of requested unscaled data in image coordinates */
gint image_width;
gint image_height;
/* Left/Top of preview in preview coordinates */
gint preview_x;
gint preview_y;
/* Width/Height of the preview */
gint preview_width;
gint preview_height;
/* Contains scaled image data as RGBA (4 bytes per pixel).
The size of the array is 4 * preview_height * preview_width bytes */
guchar *scaled_data;
}; |
| gint event_id | Id of this event. This is needed for gimp_preview_draw_row, gimp_preview_draw_unscaled_row and gimp_preview_progress_set_fraction. |
| gdouble scale | Current scale of the preview. |
| gint image_x | |
| gint image_y | |
| gint image_width | |
| gint image_height | |
| gint preview_x | |
| gint preview_y | |
| gint preview_width | |
| gint preview_height | |
| guchar *scaled_data |
GtkWidget* gimp_preview_new_with_args (GimpDrawable *drawable,
gint preview_size,
gdouble scale_amount,
gint allow_scale); |
gboolean gimp_preview_draw_row (GimpPreview *preview, const gint event_id, GimpImageType type, const gint row, const guchar *const data); |
Draw one scaled row of data in the preview. This function handles conversion to RGB and checkerboarding of transparent areas.
| preview : | the GimpPreview |
| event_id : | event_id that was sent with the GimpPreviewEvent. |
| type : | the format of the data (e.g. GIMP_RGBA_IMAGE). |
| row : | the relative number of the row within the preview. The top row of the preview is number 0. |
| data : | pixels for the preview. It must have a length of event->preview_width pixels. |
| Returns : | Returns FALSE when the event-id is not current. This means that this request and all subsequent requests with the same event-id will be ignored by the preview. |
gboolean gimp_preview_draw_unscaled_row (GimpPreview *preview, const gint event_id, GimpImageType type, const gint row, const guchar *const data); |
Draw one unscaled row of data in the preview. This function handles scaling, conversion to RGB and checkerboarding of transparent areas. A nice feature is that this function will draw several lines of the preview when scale > 1.
| preview : | the GimpPreview |
| event_id : | event_id that was sent with the GimpPreviewEvent. |
| type : | the format of the data (e.g. GIMP_RGBA_IMAGE). |
| row : | row is the relative position of the row w.r.t. preview_event->image_y. The top row has number 0. |
| data : | pixels for the preview. The first pixel in data has x-coordinate preview_event->image_x in the image. data must have a length of preview_event->image_width pixels. |
| Returns : | Returns FALSE when the event-id is not current. This means that this request and all subsequent requests with the same event-id will be ignored by the preview. |
gboolean gimp_preview_progress_set_fraction
(GimpPreview *preview,
const gint event_id,
double fraction); |
Set the progress bar of the preview to fraction completed.
| preview : | the GimpPreview. |
| event_id : | event_id that was sent with the GimpPreviewEvent. |
| fraction : | the fraction completed. |
| Returns : | Returns FALSE when the event-id is not current. This means that this request and all subsequent requests with the same event-id will be ignored by the preview. |
void user_function (GimpPreview *gimppreview, gpointer arg1, gpointer user_data); |