Fix for bug: cross platform strand render differences with kink/branch.
[blender.git] / source / blender / blenkernel / BKE_brush.h
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. The Blender
10  * Foundation also sells licenses for use in proprietary software under
11  * the Blender License.  See http://www.blender.org/BL/ for information
12  * about this.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  *
23  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24  * All rights reserved.
25  *
26  * The Original Code is: all of this file.
27  *
28  * Contributor(s): none yet.
29  *
30  * ***** END GPL/BL DUAL LICENSE BLOCK *****
31  * General operations for brushes.
32  */
33
34 #ifndef BKE_BRUSH_H
35 #define BKE_BRUSH_H
36
37 struct ID;
38 struct Brush;
39 struct ImBuf;
40
41 /* datablock functions */
42 struct Brush *add_brush(char *name);
43 struct Brush *copy_brush(struct Brush *brush);
44 void make_local_brush(struct Brush *brush);
45 void free_brush(struct Brush *brush);
46
47 /* brush library operations used by different paint panels */
48 int brush_set_nr(struct Brush **current_brush, int nr);
49 int brush_delete(struct Brush **current_brush);
50 void brush_check_exists(struct Brush **brush);
51 void brush_toggle_fake_user(struct Brush *brush);
52 int brush_texture_set_nr(struct Brush *brush, int nr);
53 int brush_texture_delete(struct Brush *brush);
54 int brush_clone_image_set_nr(struct Brush *brush, int nr);
55 int brush_clone_image_delete(struct Brush *brush);
56
57 /* sampling */
58 float brush_sample_falloff(struct Brush *brush, float dist);
59 void brush_sample_tex(struct Brush *brush, float *xy, float *rgba);
60 void brush_imbuf_new(struct Brush *brush, short flt, short texfalloff, int size,
61         struct ImBuf **imbuf);
62
63 /* painting */
64 struct BrushPainter;
65 typedef struct BrushPainter BrushPainter;
66 typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, float *lastpos, float *pos);
67
68 BrushPainter *brush_painter_new(struct Brush *brush);
69 void brush_painter_require_imbuf(BrushPainter *painter, short flt,
70         short texonly, int size);
71 int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos,
72         double time, float pressure, void *user);
73 void brush_painter_break_stroke(BrushPainter *painter);
74 void brush_painter_free(BrushPainter *painter);
75
76 #endif
77