~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/imbuf/IMB_colormanagement.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * ***** BEGIN GPL LICENSE BLOCK *****
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License
 
6
 * as published by the Free Software Foundation; either version 2
 
7
 * of the License, or (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 Foundation,
 
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
 * The Original Code is Copyright (C) 2012 by Blender Foundation.
 
19
 * All rights reserved.
 
20
 *
 
21
 * The Original Code is: all of this file.
 
22
 *
 
23
 * Contributor(s): Xavier Thomas,
 
24
 *                 Lukas Toenne,
 
25
 *                 Sergey Sharybin
 
26
 *
 
27
 * ***** END GPL LICENSE BLOCK *****
 
28
 *
 
29
 */
 
30
 
 
31
#ifndef IMB_COLORMANAGEMENT_H
 
32
#define IMB_COLORMANAGEMENT_H
 
33
 
 
34
#define BCM_CONFIG_FILE "config.ocio"
 
35
 
 
36
struct bContext;
 
37
struct ColorManagedColorspaceSettings;
 
38
struct ColorManagedDisplaySettings;
 
39
struct ColorManagedViewSettings;
 
40
struct ColormanageProcessor;
 
41
struct EnumPropertyItem;
 
42
struct ImBuf;
 
43
struct Main;
 
44
struct rcti;
 
45
struct PartialBufferUpdateContext;
 
46
struct wmWindow;
 
47
struct Scene;
 
48
struct ImageFormatData;
 
49
 
 
50
struct ColorSpace;
 
51
struct ColorManagedDisplay;
 
52
 
 
53
/* ** Generic functions ** */
 
54
 
 
55
void IMB_colormanagement_check_file_config(struct Main *bmain);
 
56
 
 
57
void IMB_colormanagement_validate_settings(struct ColorManagedDisplaySettings *display_settings,
 
58
                                           struct ColorManagedViewSettings *view_settings);
 
59
 
 
60
const char *IMB_colormanagement_role_colorspace_name_get(int role);
 
61
void IMB_colormanagement_check_is_data(struct ImBuf *ibuf, const char *name);
 
62
void IMB_colormanagement_assign_float_colorspace(struct ImBuf *ibuf, const char *name);
 
63
void IMB_colormanagement_assign_rect_colorspace(struct ImBuf *ibuf, const char *name);
 
64
 
 
65
/* ** Color space transformation functions ** */
 
66
void IMB_colormanagement_transform(float *buffer, int width, int height, int channels,
 
67
                                   const char *from_colorspace, const char *to_colorspace, int predivide);
 
68
void IMB_colormanagement_transform_threaded(float *buffer, int width, int height, int channels,
 
69
                                            const char *from_colorspace, const char *to_colorspace, int predivide);
 
70
void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace);
 
71
 
 
72
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], struct ColorSpace *colorspace);
 
73
void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], struct ColorSpace *colorspace);
 
74
 
 
75
void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide);
 
76
 
 
77
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], struct ColorManagedDisplay *display);
 
78
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], struct ColorManagedDisplay *display);
 
79
 
 
80
void IMB_colormanagement_pixel_to_display_space_v4(float result[4], const float pixel[4],  const struct ColorManagedViewSettings *view_settings,
 
81
                                                   const struct ColorManagedDisplaySettings *display_settings);
 
82
 
 
83
void IMB_colormanagement_pixel_to_display_space_v3(float result[3], const float pixel[3],  const struct ColorManagedViewSettings *view_settings,
 
84
                                                   const struct ColorManagedDisplaySettings *display_settings);
 
85
 
 
86
void IMB_colormanagement_imbuf_make_display_space(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings,
 
87
                                                  const struct ColorManagedDisplaySettings *display_settings);
 
88
 
 
89
struct ImBuf *IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf, int save_as_render, int allocate_result,
 
90
                                                  const struct ColorManagedViewSettings *view_settings,
 
91
                                                  const struct ColorManagedDisplaySettings *display_settings,
 
92
                                                  struct ImageFormatData *image_format_data);
 
93
 
 
94
/* ** Public display buffers interfaces ** */
 
95
 
 
96
unsigned char *IMB_display_buffer_acquire(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings,
 
97
                                          const struct ColorManagedDisplaySettings *display_settings, void **cache_handle);
 
98
unsigned char *IMB_display_buffer_acquire_ctx(const struct bContext *C, struct ImBuf *ibuf, void **cache_handle);
 
99
 
 
100
void IMB_display_buffer_transform_apply(unsigned char *display_buffer, float *linear_buffer, int width, int height,
 
101
                                        int channels, const struct ColorManagedViewSettings *view_settings,
 
102
                                        const struct ColorManagedDisplaySettings *display_settings, int predivide);
 
103
 
 
104
void IMB_display_buffer_release(void *cache_handle);
 
105
 
 
106
/* ** Display funcrions ** */
 
107
int IMB_colormanagement_display_get_named_index(const char *name);
 
108
const char *IMB_colormanagement_display_get_indexed_name(int index);
 
109
const char *IMB_colormanagement_display_get_default_name(void);
 
110
struct ColorManagedDisplay *IMB_colormanagement_display_get_named(const char *name);
 
111
const char *IMB_colormanagement_display_get_none_name(void);
 
112
 
 
113
/* ** View funcrions ** */
 
114
int IMB_colormanagement_view_get_named_index(const char *name);
 
115
const char *IMB_colormanagement_view_get_indexed_name(int index);
 
116
 
 
117
/* ** Color space functions ** */
 
118
int IMB_colormanagement_colorspace_get_named_index(const char *name);
 
119
const char *IMB_colormanagement_colorspace_get_indexed_name(int index);
 
120
const char *IMB_colormanagement_view_get_default_name(const char *display_name);
 
121
 
 
122
void IMB_colormanagment_colorspace_from_ibuf_ftype(struct ColorManagedColorspaceSettings *colorspace_settings, struct ImBuf *ibuf);
 
123
 
 
124
/* ** RNA helper functions ** */
 
125
void IMB_colormanagement_display_items_add(struct EnumPropertyItem **items, int *totitem);
 
126
void IMB_colormanagement_view_items_add(struct EnumPropertyItem **items, int *totitem, const char *display_name);
 
127
void IMB_colormanagement_colorspace_items_add(struct EnumPropertyItem **items, int *totitem);
 
128
 
 
129
/* ** Tile-based buffer management ** */
 
130
void IMB_partial_display_buffer_update(struct ImBuf *ibuf, const float *linear_buffer, const unsigned char *buffer_byte,
 
131
                                       int stride, int offset_x, int offset_y, const struct ColorManagedViewSettings *view_settings,
 
132
                                       const struct ColorManagedDisplaySettings *display_settings,
 
133
                                       int xmin, int ymin, int xmax, int ymax,
 
134
                                       int update_orig_byte_buffer);
 
135
 
 
136
void IMB_partial_display_buffer_update_delayed(struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax);
 
137
 
 
138
/* ** Pixel processor functions ** */
 
139
struct ColormanageProcessor *IMB_colormanagement_display_processor_new(const struct ColorManagedViewSettings *view_settings,
 
140
                                                                       const struct ColorManagedDisplaySettings *display_settings);
 
141
struct ColormanageProcessor *IMB_colormanagement_colorspace_processor_new(const char *from_colorspace, const char *to_colorspace);
 
142
void IMB_colormanagement_processor_apply_v4(struct ColormanageProcessor *cm_processor, float pixel[4]);
 
143
void IMB_colormanagement_processor_apply_v4_predivide(struct ColormanageProcessor *cm_processor, float pixel[4]);
 
144
void IMB_colormanagement_processor_apply_v3(struct ColormanageProcessor *cm_processor, float pixel[3]);
 
145
void IMB_colormanagement_processor_apply(struct ColormanageProcessor *cm_processor, float *buffer, int width, int height,
 
146
                                         int channels, int predivide);
 
147
void IMB_colormanagement_processor_free(struct ColormanageProcessor *cm_processor);
 
148
 
 
149
/* Roles */
 
150
enum {
 
151
        COLOR_ROLE_SCENE_LINEAR = 0,
 
152
        COLOR_ROLE_COLOR_PICKING,
 
153
        COLOR_ROLE_TEXTURE_PAINTING,
 
154
        COLOR_ROLE_DEFAULT_SEQUENCER,
 
155
        COLOR_ROLE_DEFAULT_BYTE,
 
156
        COLOR_ROLE_DEFAULT_FLOAT,
 
157
};
 
158
 
 
159
#endif  /* IMB_COLORMANAGEMENT_H */