|
Blender
V2.59
|
00001 /* 00002 * $Id: BKE_brush.h 37276 2011-06-06 22:10:05Z psy-fi $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 * General operations for brushes. 00029 */ 00030 00031 #ifndef BKE_BRUSH_H 00032 #define BKE_BRUSH_H 00033 00038 struct ID; 00039 struct Brush; 00040 struct ImBuf; 00041 struct Scene; 00042 struct wmOperator; 00043 // enum CurveMappingPreset; 00044 00045 /* datablock functions */ 00046 struct Brush *add_brush(const char *name); 00047 struct Brush *copy_brush(struct Brush *brush); 00048 void make_local_brush(struct Brush *brush); 00049 void free_brush(struct Brush *brush); 00050 00051 void brush_reset_sculpt(struct Brush *brush); 00052 00053 /* image icon function */ 00054 struct ImBuf *get_brush_icon(struct Brush *brush); 00055 00056 /* brush library operations used by different paint panels */ 00057 int brush_delete(struct Brush **current_brush); 00058 int brush_texture_set_nr(struct Brush *brush, int nr); 00059 int brush_texture_delete(struct Brush *brush); 00060 int brush_clone_image_set_nr(struct Brush *brush, int nr); 00061 int brush_clone_image_delete(struct Brush *brush); 00062 00063 /* jitter */ 00064 void brush_jitter_pos(struct Brush *brush, float *pos, float *jitterpos); 00065 00066 /* brush curve */ 00067 void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset); 00068 float brush_curve_strength_clamp(struct Brush *br, float p, const float len); 00069 float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */ 00070 00071 /* sampling */ 00072 void brush_sample_tex(struct Brush *brush, float *xy, float *rgba, const int thread); 00073 void brush_imbuf_new(struct Brush *brush, short flt, short texfalloff, int size, 00074 struct ImBuf **imbuf, int use_color_correction); 00075 00076 /* painting */ 00077 struct BrushPainter; 00078 typedef struct BrushPainter BrushPainter; 00079 typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, float *lastpos, float *pos); 00080 00081 BrushPainter *brush_painter_new(struct Brush *brush); 00082 void brush_painter_require_imbuf(BrushPainter *painter, short flt, 00083 short texonly, int size); 00084 int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, 00085 double time, float pressure, void *user, int use_color_correction); 00086 void brush_painter_break_stroke(BrushPainter *painter); 00087 void brush_painter_free(BrushPainter *painter); 00088 00089 /* texture */ 00090 unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side); 00091 00092 /* radial control */ 00093 struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br); 00094 00095 /* unified strength and size */ 00096 00097 int brush_size(struct Brush *brush); 00098 void brush_set_size(struct Brush *brush, int value); 00099 00100 int brush_use_locked_size(struct Brush *brush); 00101 void brush_set_use_locked_size(struct Brush *brush, int value); 00102 00103 int brush_use_alpha_pressure(struct Brush *brush); 00104 void brush_set_use_alpha_pressure(struct Brush *brush, int value); 00105 00106 int brush_use_size_pressure(struct Brush *brush); 00107 void brush_set_use_size_pressure(struct Brush *brush, int value); 00108 00109 float brush_unprojected_radius(struct Brush *brush); 00110 void brush_set_unprojected_radius(struct Brush *brush, float value); 00111 00112 float brush_alpha(struct Brush *brush); 00113 void brush_set_alpha(struct Brush *brush, float value); 00114 00115 /* debugging only */ 00116 void brush_debug_print_state(struct Brush *br); 00117 00118 #endif 00119