OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef SkGammaColorFilter_DEFINED |
| 9 #define SkGammaColorFilter_DEFINED |
| 10 |
| 11 #include "SkColorFilter.h" |
| 12 #include "SkRefCnt.h" |
| 13 |
| 14 // This colorfilter can be used to perform pixel-by-pixel conversion between lin
ear and |
| 15 // power-law color spaces. A gamma of 2.2 is interpreted to mean convert from sR
GB to linear |
| 16 // while a gamma of 1/2.2 is interpreted to mean convert from linear to sRGB. An
y other |
| 17 // values are just directly applied (i.e., out = in^gamma) |
| 18 // |
| 19 // More complicated color space mapping (i.e., ICC profiles) should be handled v
ia the |
| 20 // SkColorSpace object. |
| 21 class SK_API SkGammaColorFilter : public SkColorFilter { |
| 22 public: |
| 23 static sk_sp<SkColorFilter> Make(SkScalar gamma); |
| 24 |
| 25 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR |
| 26 static SkColorFilter* Create(SkScalar gamma) { return Make(gamma).release();
} |
| 27 #endif |
| 28 |
| 29 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid
e; |
| 30 |
| 31 #if SK_SUPPORT_GPU |
| 32 sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*) const override; |
| 33 #endif |
| 34 |
| 35 SK_TO_STRING_OVERRIDE() |
| 36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter) |
| 37 |
| 38 protected: |
| 39 void flatten(SkWriteBuffer&) const override; |
| 40 |
| 41 private: |
| 42 SkGammaColorFilter(SkScalar gamma); |
| 43 |
| 44 SkScalar fGamma; |
| 45 typedef SkColorFilter INHERITED; |
| 46 }; |
| 47 |
| 48 #endif |
OLD | NEW |