1 /* LIBGIMP - The GIMP Library
2  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
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 3 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, see
16  * <https://www.gnu.org/licenses/>.
17  */
18 
19 #if !defined (__GIMP_WIDGETS_H_INSIDE__) && !defined (GIMP_WIDGETS_COMPILATION)
20 #error "Only <libgimpwidgets/gimpwidgets.h> can be included directly."
21 #endif
22 
23 #ifndef __GIMP_PREVIEW_AREA_H__
24 #define __GIMP_PREVIEW_AREA_H__
25 
26 G_BEGIN_DECLS
27 
28 
29 #define GIMP_TYPE_PREVIEW_AREA            (gimp_preview_area_get_type ())
30 #define GIMP_PREVIEW_AREA(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PREVIEW_AREA, GimpPreviewArea))
31 #define GIMP_PREVIEW_AREA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PREVIEW_AREA, GimpPreviewAreaClass))
32 #define GIMP_IS_PREVIEW_AREA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PREVIEW_AREA))
33 #define GIMP_IS_PREVIEW_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PREVIEW_AREA))
34 #define GIMP_PREVIEW_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PREVIEW_AREA, GimpPreviewArea))
35 
36 
37 typedef struct _GimpPreviewAreaClass  GimpPreviewAreaClass;
38 
39 struct _GimpPreviewArea
40 {
41   GtkDrawingArea   parent_instance;
42 
43   GimpCheckSize    check_size;
44   GimpCheckType    check_type;
45   gint             width;
46   gint             height;
47   gint             rowstride;
48   gint             offset_x;
49   gint             offset_y;
50   gint             max_width;
51   gint             max_height;
52   guchar          *buf;
53   guchar          *colormap;
54 };
55 
56 struct _GimpPreviewAreaClass
57 {
58   GtkDrawingAreaClass  parent_class;
59 
60   /* Padding for future expansion */
61   void (* _gimp_reserved1) (void);
62   void (* _gimp_reserved2) (void);
63   void (* _gimp_reserved3) (void);
64   void (* _gimp_reserved4) (void);
65 };
66 
67 
68 GType       gimp_preview_area_get_type         (void) G_GNUC_CONST;
69 
70 GtkWidget * gimp_preview_area_new              (void);
71 
72 void        gimp_preview_area_draw             (GimpPreviewArea *area,
73                                                 gint             x,
74                                                 gint             y,
75                                                 gint             width,
76                                                 gint             height,
77                                                 GimpImageType    type,
78                                                 const guchar    *buf,
79                                                 gint             rowstride);
80 void        gimp_preview_area_blend            (GimpPreviewArea *area,
81                                                 gint             x,
82                                                 gint             y,
83                                                 gint             width,
84                                                 gint             height,
85                                                 GimpImageType    type,
86                                                 const guchar    *buf1,
87                                                 gint             rowstride1,
88                                                 const guchar    *buf2,
89                                                 gint             rowstride2,
90                                                 guchar           opacity);
91 void        gimp_preview_area_mask             (GimpPreviewArea *area,
92                                                 gint             x,
93                                                 gint             y,
94                                                 gint             width,
95                                                 gint             height,
96                                                 GimpImageType    type,
97                                                 const guchar    *buf1,
98                                                 gint             rowstride1,
99                                                 const guchar    *buf2,
100                                                 gint             rowstride2,
101                                                 const guchar    *mask,
102                                                 gint             rowstride_mask);
103 void        gimp_preview_area_fill             (GimpPreviewArea *area,
104                                                 gint             x,
105                                                 gint             y,
106                                                 gint             width,
107                                                 gint             height,
108                                                 guchar           red,
109                                                 guchar           green,
110                                                 guchar           blue);
111 
112 void        gimp_preview_area_set_offsets      (GimpPreviewArea *area,
113                                                 gint             x,
114                                                 gint             y);
115 
116 void        gimp_preview_area_set_colormap     (GimpPreviewArea *area,
117                                                 const guchar    *colormap,
118                                                 gint             num_colors);
119 
120 void        gimp_preview_area_set_color_config (GimpPreviewArea *area,
121                                                 GimpColorConfig *config);
122 
123 void        gimp_preview_area_set_max_size     (GimpPreviewArea *area,
124                                                 gint             width,
125                                                 gint             height);
126 
127 void        gimp_preview_area_menu_popup       (GimpPreviewArea *area,
128                                                 GdkEventButton  *event);
129 
130 
131 G_END_DECLS
132 
133 #endif /* __GIMP_PREVIEW_AREA_H__ */
134