[14481] | 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 Library 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 | * Library General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU Library 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-1999. 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_PREVIEW_H__ |
---|
| 28 | #define __GTK_PREVIEW_H__ |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | #include <gtk/gtkwidget.h> |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | #ifdef __cplusplus |
---|
| 35 | extern "C" { |
---|
| 36 | #endif /* __cplusplus */ |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | #define GTK_TYPE_PREVIEW (gtk_preview_get_type ()) |
---|
| 40 | #define GTK_PREVIEW(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_PREVIEW, GtkPreview)) |
---|
| 41 | #define GTK_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_PREVIEW, GtkPreviewClass)) |
---|
| 42 | #define GTK_IS_PREVIEW(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_PREVIEW)) |
---|
| 43 | #define GTK_IS_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PREVIEW)) |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | typedef struct _GtkPreview GtkPreview; |
---|
| 47 | typedef struct _GtkPreviewInfo GtkPreviewInfo; |
---|
| 48 | typedef union _GtkDitherInfo GtkDitherInfo; |
---|
| 49 | typedef struct _GtkPreviewClass GtkPreviewClass; |
---|
| 50 | |
---|
| 51 | struct _GtkPreview |
---|
| 52 | { |
---|
| 53 | GtkWidget widget; |
---|
| 54 | |
---|
| 55 | guchar *buffer; |
---|
| 56 | guint16 buffer_width; |
---|
| 57 | guint16 buffer_height; |
---|
| 58 | |
---|
| 59 | guint16 bpp; |
---|
| 60 | guint16 rowstride; |
---|
| 61 | |
---|
| 62 | GdkRgbDither dither; |
---|
| 63 | |
---|
| 64 | guint type : 1; |
---|
| 65 | guint expand : 1; |
---|
| 66 | }; |
---|
| 67 | |
---|
| 68 | struct _GtkPreviewInfo |
---|
| 69 | { |
---|
| 70 | GdkVisual *visual; |
---|
| 71 | GdkColormap *cmap; |
---|
| 72 | |
---|
| 73 | guchar *lookup; |
---|
| 74 | |
---|
| 75 | gdouble gamma; |
---|
| 76 | }; |
---|
| 77 | |
---|
| 78 | union _GtkDitherInfo |
---|
| 79 | { |
---|
| 80 | gushort s[2]; |
---|
| 81 | guchar c[4]; |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | struct _GtkPreviewClass |
---|
| 85 | { |
---|
| 86 | GtkWidgetClass parent_class; |
---|
| 87 | |
---|
| 88 | GtkPreviewInfo info; |
---|
| 89 | |
---|
| 90 | }; |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | GtkType gtk_preview_get_type (void); |
---|
| 94 | void gtk_preview_uninit (void); |
---|
| 95 | GtkWidget* gtk_preview_new (GtkPreviewType type); |
---|
| 96 | void gtk_preview_size (GtkPreview *preview, |
---|
| 97 | gint width, |
---|
| 98 | gint height); |
---|
| 99 | void gtk_preview_put (GtkPreview *preview, |
---|
| 100 | GdkWindow *window, |
---|
| 101 | GdkGC *gc, |
---|
| 102 | gint srcx, |
---|
| 103 | gint srcy, |
---|
| 104 | gint destx, |
---|
| 105 | gint desty, |
---|
| 106 | gint width, |
---|
| 107 | gint height); |
---|
| 108 | void gtk_preview_draw_row (GtkPreview *preview, |
---|
| 109 | guchar *data, |
---|
| 110 | gint x, |
---|
| 111 | gint y, |
---|
| 112 | gint w); |
---|
| 113 | void gtk_preview_set_expand (GtkPreview *preview, |
---|
| 114 | gboolean expand); |
---|
| 115 | |
---|
| 116 | void gtk_preview_set_gamma (double gamma); |
---|
| 117 | void gtk_preview_set_color_cube (guint nred_shades, |
---|
| 118 | guint ngreen_shades, |
---|
| 119 | guint nblue_shades, |
---|
| 120 | guint ngray_shades); |
---|
| 121 | void gtk_preview_set_install_cmap (gint install_cmap); |
---|
| 122 | void gtk_preview_set_reserved (gint nreserved); |
---|
| 123 | void gtk_preview_set_dither (GtkPreview *preview, |
---|
| 124 | GdkRgbDither dither); |
---|
| 125 | GdkVisual* gtk_preview_get_visual (void); |
---|
| 126 | GdkColormap* gtk_preview_get_cmap (void); |
---|
| 127 | GtkPreviewInfo* gtk_preview_get_info (void); |
---|
| 128 | |
---|
| 129 | /* This function reinitializes the preview colormap and visual from |
---|
| 130 | * the current gamma/color_cube/install_cmap settings. It must only |
---|
| 131 | * be called if there are no previews or users's of the preview |
---|
| 132 | * colormap in existence. |
---|
| 133 | */ |
---|
| 134 | void gtk_preview_reset (void); |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | #ifdef __cplusplus |
---|
| 138 | } |
---|
| 139 | #endif /* __cplusplus */ |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | #endif /* __GTK_PREVIEW_H__ */ |
---|