1 /* Refocus plug-in
2  * Copyright (C) 1999-2003 Ernst Lippe
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  * Version $Id: prevman.h,v 1.1.1.1 2003/01/30 21:30:18 ernstl Exp $
19  */
20 
21 #ifndef PREVMAN_H_INCLUDED
22 #define PREVMAN_H_INCLUDED
23 
24 #include <libgimp/gimp.h>
25 
26 G_BEGIN_DECLS
27 
28 typedef enum
29 { TP_PREV, TP_DRAWABLE }
30 PMType;
31 
32 typedef struct
33 {
34   PMType type;
35   gint x;
36   gint y;
37   gint width;
38   gint height;
39   gint bpp;
40   gboolean has_alpha;
41   union
42   {
43     struct
44     {
45       GimpDrawable *drawable;
46       GimpPixelRgn pixel_rgn;
47     }
48     drw;
49     struct
50     {
51       gint *dummy;              /* Just to shut up the compiler */
52     }
53     prv;
54   }
55   un;
56 }
57 TileSource;
58 
59 typedef struct
60 {
61   PMType type;
62   gint x;
63   gint y;
64   gint width;
65   gint height;
66   gint bpp;
67   gboolean has_alpha;
68   union
69   {
70     struct
71     {
72       GimpDrawable *drawable;
73       GimpPixelRgn pixel_rgn;
74     }
75     drw;
76     struct
77     {
78       guchar *data;
79       gint ntile_rows;
80       gint ntile_cols;
81       GimpTile *tiles;
82     }
83     prv;
84   }
85   un;
86 }
87 TileSink;
88 
89 extern void
90 tile_source_init_from_drawable (TileSource * tile_source,
91                                 GimpDrawable * drawable, gint x, gint y,
92                                 gint width, gint height);
93 extern GimpTile *tile_source_get_tile (TileSource * tile_source, const gint x,
94                                        const gint y);
95 
96 extern void
97 tile_source_tile_unref (TileSource * tile_source, GimpTile * tile);
98 
99 extern void
100 tile_sink_init_from_drawable (TileSink * tile_sink, GimpDrawable * drawable,
101                               gint x, gint y, gint width, gint height);
102 extern void
103 tile_sink_init_for_preview (TileSink * tile_sink, GimpDrawable * drawable,
104                             gint x, gint y, gint width, gint height);
105 
106 extern void tile_sink_free_buffers (TileSink * tile_sink);
107 
108 extern GimpTile *tile_sink_get_tile (TileSink * tile_sink, const gint x,
109                                      const gint y);
110 
111 extern void tile_sink_tile_unref (TileSink * tile_sink, GimpTile * tile);
112 
113 extern void
114 tile_sink_get_row (TileSink * tile_sink, guchar * buf, gint x, gint y,
115                    gint width);
116 
117 G_END_DECLS
118 #endif /*  PREVMAN_H_INCLUDED */
119