1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 2013 Daniel Sabo
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 3 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, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __GIMP_PAINT_CORE_LOOPS_H__
19 #define __GIMP_PAINT_CORE_LOOPS_H__
20 
21 
22 typedef enum
23 {
24   GIMP_PAINT_CORE_LOOPS_ALGORITHM_NONE                                = 0,
25 
26   GIMP_PAINT_CORE_LOOPS_ALGORITHM_COMBINE_PAINT_MASK_TO_CANVAS_BUFFER = 1 << 0,
27   GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_PAINT_BUF_ALPHA    = 1 << 1,
28   GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_PAINT_BUF_ALPHA       = 1 << 2,
29   GIMP_PAINT_CORE_LOOPS_ALGORITHM_CANVAS_BUFFER_TO_COMP_MASK          = 1 << 3,
30   GIMP_PAINT_CORE_LOOPS_ALGORITHM_PAINT_MASK_TO_COMP_MASK             = 1 << 4,
31   GIMP_PAINT_CORE_LOOPS_ALGORITHM_DO_LAYER_BLEND                      = 1 << 5,
32   GIMP_PAINT_CORE_LOOPS_ALGORITHM_MASK_COMPONENTS                     = 1 << 6
33 } GimpPaintCoreLoopsAlgorithm;
34 
35 
36 typedef struct
37 {
38   GeglBuffer        *canvas_buffer;
39 
40   GimpTempBuf       *paint_buf;
41   gint               paint_buf_offset_x;
42   gint               paint_buf_offset_y;
43 
44   const GimpTempBuf *paint_mask;
45   gint               paint_mask_offset_x;
46   gint               paint_mask_offset_y;
47 
48   gboolean           stipple;
49 
50   GeglBuffer        *src_buffer;
51   GeglBuffer        *dest_buffer;
52 
53   GeglBuffer        *mask_buffer;
54   gint               mask_offset_x;
55   gint               mask_offset_y;
56 
57   gdouble            paint_opacity;
58   gdouble            image_opacity;
59 
60   GimpLayerMode      paint_mode;
61 
62   GimpComponentMask  affect;
63 } GimpPaintCoreLoopsParams;
64 
65 
66 void   gimp_paint_core_loops_process (const GimpPaintCoreLoopsParams *params,
67                                       GimpPaintCoreLoopsAlgorithm     algorithms);
68 
69 
70 #endif /* __GIMP_PAINT_CORE_LOOPS_H__ */
71