]> Pileus Git - ~andy/gtk/blob - gtk/gtkpreview.h
Initial revision
[~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 Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 #ifndef __GTK_PREVIEW_H__
19 #define __GTK_PREVIEW_H__
20
21
22 #include <gtk/gtkwidget.h>
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29
30 #define GTK_PREVIEW(obj)          GTK_CHECK_CAST (obj, gtk_preview_get_type (), GtkPreview)
31 #define GTK_PREVIEW_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_preview_get_type (), GtkPreviewClass)
32 #define GTK_IS_PREVIEW(obj)       GTK_CHECK_TYPE (obj, gtk_preview_get_type ())
33
34
35 typedef struct _GtkPreview       GtkPreview;
36 typedef struct _GtkPreviewInfo   GtkPreviewInfo;
37 typedef union  _GtkDitherInfo    GtkDitherInfo;
38 typedef struct _GtkPreviewClass  GtkPreviewClass;
39
40 struct _GtkPreview
41 {
42   GtkWidget widget;
43
44   guchar *buffer;
45   guint16 buffer_width;
46   guint16 buffer_height;
47
48   guint type : 1;
49   guint expand : 1;
50 };
51
52 struct _GtkPreviewInfo
53 {
54   GdkVisual *visual;
55   GdkColormap *cmap;
56
57   gulong *color_pixels;
58   gulong *gray_pixels;
59   gulong *reserved_pixels;
60
61   gulong *lookup_red;
62   gulong *lookup_green;
63   gulong *lookup_blue;
64
65   GtkDitherInfo *dither_red;
66   GtkDitherInfo *dither_green;
67   GtkDitherInfo *dither_blue;
68   GtkDitherInfo *dither_gray;
69   guchar ***dither_matrix;
70
71   guint nred_shades;
72   guint ngreen_shades;
73   guint nblue_shades;
74   guint ngray_shades;
75   guint nreserved;
76
77   guint bpp;
78   gint cmap_alloced;
79   gdouble gamma;
80 };
81
82 union _GtkDitherInfo
83 {
84   gushort s[2];
85   guchar c[4];
86 };
87
88 struct _GtkPreviewClass
89 {
90   GtkWidgetClass parent_class;
91
92   GtkPreviewInfo info;
93
94   GdkImage *image;
95 };
96
97
98 guint           gtk_preview_get_type           (void);
99 void            gtk_preview_uninit             (void);
100 GtkWidget*      gtk_preview_new                (GtkPreviewType   type);
101 void            gtk_preview_size               (GtkPreview      *preview,
102                                                 gint             width,
103                                                 gint             height);
104 void            gtk_preview_put                (GtkPreview      *preview,
105                                                 GdkWindow       *window,
106                                                 GdkGC           *gc,
107                                                 gint             srcx,
108                                                 gint             srcy,
109                                                 gint             destx,
110                                                 gint             desty,
111                                                 gint             width,
112                                                 gint             height);
113 void            gtk_preview_put_row            (GtkPreview      *preview,
114                                                 guchar          *src,
115                                                 guchar          *dest,
116                                                 gint             x,
117                                                 gint             y,
118                                                 gint             w);
119 void            gtk_preview_draw_row           (GtkPreview      *preview,
120                                                 guchar          *data,
121                                                 gint             x,
122                                                 gint             y,
123                                                 gint             w);
124 void            gtk_preview_set_expand         (GtkPreview      *preview,
125                                                 gint             expand);
126
127 void            gtk_preview_set_gamma          (double           gamma);
128 void            gtk_preview_set_color_cube     (guint            nred_shades,
129                                                 guint            ngreen_shades,
130                                                 guint            nblue_shades,
131                                                 guint            ngray_shades);
132 void            gtk_preview_set_install_cmap   (gint             install_cmap);
133 void            gtk_preview_set_reserved       (gint             nreserved);
134 GdkVisual*      gtk_preview_get_visual         (void);
135 GdkColormap*    gtk_preview_get_cmap           (void);
136 GtkPreviewInfo* gtk_preview_get_info           (void);
137
138
139 #ifdef __cplusplus
140 }
141 #endif /* __cplusplus */
142
143
144 #endif /* __GTK_PREVIEW_H__ */