1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2006 Blender Foundation. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup DNA 22 */ 23 24 #pragma once 25 26 #include "DNA_defs.h" 27 #include "DNA_vec_types.h" 28 29 /* general defines for kernel functions */ 30 #define CM_RESOL 32 31 #define CM_TABLE 256 32 #define CM_TABLEDIV (1.0f / 256.0f) 33 34 #define CM_TOT 4 35 36 typedef struct CurveMapPoint { 37 float x, y; 38 /** Shorty for result lookup. */ 39 short flag, shorty; 40 } CurveMapPoint; 41 42 /* curvepoint->flag */ 43 enum { 44 CUMA_SELECT = (1 << 0), 45 CUMA_HANDLE_VECTOR = (1 << 1), 46 CUMA_HANDLE_AUTO_ANIM = (1 << 2), 47 }; 48 49 typedef struct CurveMap { 50 short totpoint; 51 short flag DNA_DEPRECATED; 52 53 /** Quick multiply value for reading table. */ 54 float range; 55 /** The x-axis range for the table. */ 56 float mintable, maxtable; 57 /** For extrapolated curves, the direction vector. */ 58 float ext_in[2], ext_out[2]; 59 /** Actual curve. */ 60 CurveMapPoint *curve; 61 /** Display and evaluate table. */ 62 CurveMapPoint *table; 63 64 /** For RGB curves, premulled table. */ 65 CurveMapPoint *premultable; 66 /** For RGB curves, premulled extrapolation vector. */ 67 float premul_ext_in[2]; 68 float premul_ext_out[2]; 69 } CurveMap; 70 71 typedef struct CurveMapping { 72 /** Cur; for buttons, to show active curve. */ 73 int flag, cur; 74 int preset; 75 int changed_timestamp; 76 77 /** Current rect, clip rect (is default rect too). */ 78 rctf curr, clipr; 79 80 /** Max 4 builtin curves per mapping struct now. */ 81 CurveMap cm[4]; 82 /** Black/white point (black[0] abused for current frame). */ 83 float black[3], white[3]; 84 /** Black/white point multiply value, for speed. */ 85 float bwmul[3]; 86 87 /** Sample values, if flag set it draws line and intersection. */ 88 float sample[3]; 89 90 short tone; 91 char _pad[6]; 92 } CurveMapping; 93 94 /* CurveMapping.flag */ 95 typedef enum eCurveMappingFlags { 96 CUMA_DO_CLIP = (1 << 0), 97 CUMA_PREMULLED = (1 << 1), 98 CUMA_DRAW_CFRA = (1 << 2), 99 CUMA_DRAW_SAMPLE = (1 << 3), 100 101 /* The curve is extended by extrapolation. When not set the curve is extended 102 * Horizontally */ 103 CUMA_EXTEND_EXTRAPOLATE = (1 << 4), 104 } eCurveMappingFlags; 105 106 /* cumapping->preset */ 107 typedef enum eCurveMappingPreset { 108 CURVE_PRESET_LINE = 0, 109 CURVE_PRESET_SHARP = 1, 110 CURVE_PRESET_SMOOTH = 2, 111 CURVE_PRESET_MAX = 3, 112 CURVE_PRESET_MID9 = 4, 113 CURVE_PRESET_ROUND = 5, 114 CURVE_PRESET_ROOT = 6, 115 CURVE_PRESET_GAUSS = 7, 116 CURVE_PRESET_BELL = 8, 117 } eCurveMappingPreset; 118 119 /* CurveMapping->tone */ 120 typedef enum eCurveMappingTone { 121 CURVE_TONE_STANDARD = 0, 122 CURVE_TONE_FILMLIKE = 2, 123 } eCurveMappingTone; 124 125 /* histogram->mode */ 126 enum { 127 HISTO_MODE_LUMA = 0, 128 HISTO_MODE_RGB = 1, 129 HISTO_MODE_R = 2, 130 HISTO_MODE_G = 3, 131 HISTO_MODE_B = 4, 132 HISTO_MODE_ALPHA = 5, 133 }; 134 135 enum { 136 HISTO_FLAG_LINE = (1 << 0), 137 HISTO_FLAG_SAMPLELINE = (1 << 1), 138 }; 139 140 typedef struct Histogram { 141 int channels; 142 int x_resolution; 143 float data_luma[256]; 144 float data_r[256]; 145 float data_g[256]; 146 float data_b[256]; 147 float data_a[256]; 148 float xmax, ymax; 149 short mode; 150 short flag; 151 int height; 152 153 /* sample line only */ 154 /* image coords src -> dst */ 155 float co[2][2]; 156 } Histogram; 157 158 typedef struct Scopes { 159 int ok; 160 int sample_full; 161 int sample_lines; 162 float accuracy; 163 int wavefrm_mode; 164 float wavefrm_alpha; 165 float wavefrm_yfac; 166 int wavefrm_height; 167 float vecscope_alpha; 168 int vecscope_height; 169 float minmax[3][2]; 170 struct Histogram hist; 171 float *waveform_1; 172 float *waveform_2; 173 float *waveform_3; 174 float *vecscope; 175 int waveform_tot; 176 char _pad[4]; 177 } Scopes; 178 179 /* scopes->wavefrm_mode */ 180 #define SCOPES_WAVEFRM_LUMA 0 181 #define SCOPES_WAVEFRM_RGB_PARADE 1 182 #define SCOPES_WAVEFRM_YCC_601 2 183 #define SCOPES_WAVEFRM_YCC_709 3 184 #define SCOPES_WAVEFRM_YCC_JPEG 4 185 #define SCOPES_WAVEFRM_RGB 5 186 187 typedef struct ColorManagedViewSettings { 188 int flag; 189 char _pad[4]; 190 /** Look which is being applied when displaying buffer on the screen 191 * (prior to view transform). */ 192 char look[64]; 193 /** View transform which is being applied when displaying buffer on the screen. */ 194 char view_transform[64]; 195 /** Fstop exposure. */ 196 float exposure; 197 /** Post-display gamma transform. */ 198 float gamma; 199 /** Pre-display RGB curves transform. */ 200 struct CurveMapping *curve_mapping; 201 void *_pad2; 202 } ColorManagedViewSettings; 203 204 typedef struct ColorManagedDisplaySettings { 205 char display_device[64]; 206 } ColorManagedDisplaySettings; 207 208 typedef struct ColorManagedColorspaceSettings { 209 /** MAX_COLORSPACE_NAME. */ 210 char name[64]; 211 } ColorManagedColorspaceSettings; 212 213 /* ColorManagedViewSettings->flag */ 214 enum { 215 COLORMANAGE_VIEW_USE_CURVES = (1 << 0), 216 }; 217