Go to the source code of this file.
◆ sk_apply_lut_if()
template<bool APPLY_LUT>
static U8CPU sk_apply_lut_if |
( |
U8CPU |
component, |
|
|
const uint8_t * |
|
|
) |
| |
|
inlinestatic |
If APPLY_LUT is false, returns component unchanged. If APPLY_LUT is true, returns lut[component].
- Parameters
-
APPLY_LUT | whether or not the look-up table should be applied to component. @component the initial component. @lut a look-up table which transforms the component. |
Definition at line 225 of file SkMaskGamma.h.
225 {
226 return component;
227}
◆ sk_apply_lut_if< true >()
Definition at line 228 of file SkMaskGamma.h.
228 {
229 return lut[component];
230}
◆ sk_t_scale255()
Scales base <= 2^N-1 to 2^8-1
- Parameters
-
N | [1, 8] the number of bits used by base. |
base | the number to be scaled to [0, 255]. |
Definition at line 61 of file SkMaskGamma.h.
61 {
64 for (
unsigned int i =
N;
i < 8;
i +=
N) {
66 }
68}
static float lum(float r, float g, float b)
◆ sk_t_scale255< 1 >()
◆ sk_t_scale255< 2 >()
◆ sk_t_scale255< 4 >()
◆ sk_t_scale255< 8 >()
◆ SkTMaskGamma_build_correcting_lut()
Definition at line 78 of file SkMaskGamma.cpp.
79 {
82 const float src = (
float)srcI / 255.0f;
83 const float linSrc = srcConvert.
toLuma(srcGamma,
src);
84
85
86
87
88 const float dst = 1.0f -
src;
89 const float linDst = dstConvert.
toLuma(dstGamma,
dst);
90
91
92 const float adjustedContrast = contrast * linDst;
93
94
95
96 if (fabs(
src -
dst) < (1.0f / 256.0f)) {
97 float ii = 0.0f;
98 for (
int i = 0;
i < 256; ++
i, ii += 1.0f) {
99 float rawSrca = ii / 255.0f;
102 }
103 } else {
104
105 float ii = 0.0f;
106 for (
int i = 0;
i < 256; ++
i, ii += 1.0f) {
107
108
109
110
111 float rawSrca = ii / 255.0f;
114 float dsta = 1.0f - srca;
115
116
117 float linOut = (linSrc * srca + dsta * linDst);
120
121
124
126 }
127 }
128}
#define sk_float_round2int(x)
static float apply_contrast(float srca, float contrast)
constexpr uint8_t SkToU8(S x)
virtual SkScalar fromLuma(SkScalar gamma, SkScalar luma) const =0
virtual SkScalar toLuma(SkScalar gamma, SkScalar luminance) const =0