merge with 2.5 (not trunk, last merge message said that on accident) at r22252
[blender.git] / source / blender / blenkernel / BKE_colortools.h
1 /**
2  * $Id$ 
3  *
4  * ***** BEGIN GPL 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. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2006 Blender Foundation.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL/BL DUAL LICENSE BLOCK *****
28  */
29 #ifndef BKE_COLORTOOLS_H
30 #define BKE_COLORTOOLS_H
31
32 struct CurveMapping;
33 struct CurveMap;
34 struct ImBuf;
35 struct rctf;
36
37 void                            gamma_correct_rec709(float *c, float gamma);
38 void                            gamma_correct(float *c, float gamma);
39 float                           srgb_to_linearrgb(float c);
40 float                           linearrgb_to_srgb(float c);
41 void                            color_manage_linearize(float *col_to, float *col_from);
42
43 void                            floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w);
44 void                            floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w);
45
46 struct CurveMapping     *curvemapping_add(int tot, float minx, float miny, float maxx, float maxy);
47 void                            curvemapping_free(struct CurveMapping *cumap);
48 struct CurveMapping     *curvemapping_copy(struct CurveMapping *cumap);
49 void                            curvemapping_set_black_white(struct CurveMapping *cumap, float *black, float *white);
50
51 void                            curvemap_remove(struct CurveMap *cuma, int flag);
52 void                            curvemap_insert(struct CurveMap *cuma, float x, float y);
53 void                            curvemap_reset(struct CurveMap *cuma, struct rctf *clipr);
54 void                            curvemap_sethandle(struct CurveMap *cuma, int type);
55
56 void                            curvemapping_changed(struct CurveMapping *cumap, int rem_doubles);
57                                         
58                                         /* single curve, no table check */
59 float                           curvemap_evaluateF(struct CurveMap *cuma, float value);
60                                         /* single curve, with table check */
61 float                           curvemapping_evaluateF(struct CurveMapping *cumap, int cur, float value);
62 void                            curvemapping_evaluate3F(struct CurveMapping *cumap, float *vecout, const float *vecin);
63 void                            curvemapping_evaluateRGBF(struct CurveMapping *cumap, float *vecout, const float *vecin);
64 void                            curvemapping_evaluate_premulRGBF(struct CurveMapping *cumap, float *vecout, const float *vecin);
65 void                            curvemapping_do_ibuf(struct CurveMapping *cumap, struct ImBuf *ibuf);
66 void                            curvemapping_premultiply(struct CurveMapping *cumap, int restore);
67 int                                     curvemapping_RGBA_does_something(struct CurveMapping *cumap);
68 void                            curvemapping_initialize(struct CurveMapping *cumap);
69 void                            curvemapping_table_RGBA(struct CurveMapping *cumap, float **array, int *size);
70 void                            colorcorrection_do_ibuf(struct ImBuf *ibuf, const char *profile);
71
72
73 #endif
74