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