| 1 | /* GTK - The GIMP Toolkit |
| 2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the |
| 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 17 | * Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | /* |
| 21 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 22 | * file for a list of people on the GTK+ Team. See the ChangeLog |
| 23 | * files for a list of changes. These files are distributed with |
| 24 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
| 25 | */ |
| 26 | |
| 27 | #ifndef GTK_DISABLE_DEPRECATED |
| 28 | |
| 29 | #ifndef __GTK_PREVIEW_H__ |
| 30 | #define __GTK_PREVIEW_H__ |
| 31 | |
| 32 | #include <gtk/gtk.h> |
| 33 | |
| 34 | |
| 35 | G_BEGIN_DECLS |
| 36 | |
| 37 | #define GTK_TYPE_PREVIEW (gtk_preview_get_type ()) |
| 38 | #define GTK_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PREVIEW, GtkPreview)) |
| 39 | #define GTK_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PREVIEW, GtkPreviewClass)) |
| 40 | #define GTK_IS_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PREVIEW)) |
| 41 | #define GTK_IS_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PREVIEW)) |
| 42 | #define GTK_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PREVIEW, GtkPreviewClass)) |
| 43 | |
| 44 | |
| 45 | typedef struct _GtkPreview GtkPreview; |
| 46 | typedef struct _GtkPreviewInfo GtkPreviewInfo; |
| 47 | typedef union _GtkDitherInfo GtkDitherInfo; |
| 48 | typedef struct _GtkPreviewClass GtkPreviewClass; |
| 49 | |
| 50 | struct _GtkPreview |
| 51 | { |
| 52 | GtkWidget widget; |
| 53 | |
| 54 | guchar *buffer; |
| 55 | guint16 buffer_width; |
| 56 | guint16 buffer_height; |
| 57 | |
| 58 | guint16 bpp; |
| 59 | guint16 rowstride; |
| 60 | |
| 61 | GdkRgbDither dither; |
| 62 | |
| 63 | guint type : 1; |
| 64 | guint expand : 1; |
| 65 | }; |
| 66 | |
| 67 | struct _GtkPreviewInfo |
| 68 | { |
| 69 | guchar *lookup; |
| 70 | |
| 71 | gdouble gamma; |
| 72 | }; |
| 73 | |
| 74 | union _GtkDitherInfo |
| 75 | { |
| 76 | gushort s[2]; |
| 77 | guchar c[4]; |
| 78 | }; |
| 79 | |
| 80 | struct _GtkPreviewClass |
| 81 | { |
| 82 | GtkWidgetClass parent_class; |
| 83 | |
| 84 | GtkPreviewInfo info; |
| 85 | |
| 86 | }; |
| 87 | |
| 88 | |
| 89 | GType gtk_preview_get_type (void) G_GNUC_CONST; |
| 90 | void gtk_preview_uninit (void); |
| 91 | GtkWidget* gtk_preview_new (GtkPreviewType type); |
| 92 | void gtk_preview_size (GtkPreview *preview, |
| 93 | gint width, |
| 94 | gint height); |
| 95 | void gtk_preview_put (GtkPreview *preview, |
| 96 | GdkWindow *window, |
| 97 | GdkGC *gc, |
| 98 | gint srcx, |
| 99 | gint srcy, |
| 100 | gint destx, |
| 101 | gint desty, |
| 102 | gint width, |
| 103 | gint height); |
| 104 | void gtk_preview_draw_row (GtkPreview *preview, |
| 105 | guchar *data, |
| 106 | gint x, |
| 107 | gint y, |
| 108 | gint w); |
| 109 | void gtk_preview_set_expand (GtkPreview *preview, |
| 110 | gboolean expand); |
| 111 | |
| 112 | void gtk_preview_set_gamma (double gamma_); |
| 113 | void gtk_preview_set_color_cube (guint nred_shades, |
| 114 | guint ngreen_shades, |
| 115 | guint nblue_shades, |
| 116 | guint ngray_shades); |
| 117 | void gtk_preview_set_install_cmap (gint install_cmap); |
| 118 | void gtk_preview_set_reserved (gint nreserved); |
| 119 | void gtk_preview_set_dither (GtkPreview *preview, |
| 120 | GdkRgbDither dither); |
| 121 | GdkVisual* gtk_preview_get_visual (void); |
| 122 | GdkColormap* gtk_preview_get_cmap (void); |
| 123 | GtkPreviewInfo* gtk_preview_get_info (void); |
| 124 | |
| 125 | /* This function reinitializes the preview colormap and visual from |
| 126 | * the current gamma/color_cube/install_cmap settings. It must only |
| 127 | * be called if there are no previews or users's of the preview |
| 128 | * colormap in existence. |
| 129 | */ |
| 130 | void gtk_preview_reset (void); |
| 131 | |
| 132 | |
| 133 | G_END_DECLS |
| 134 | |
| 135 | #endif /* __GTK_PREVIEW_H__ */ |
| 136 | |
| 137 | #endif /* GTK_DISABLE_DEPRECATED */ |
| 138 | |