Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: include/effects/SkGammaColorFilter.h

Issue 2190573002: Add SkGammaColorFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ?? Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/effects.gypi ('k') | src/effects/SkGammaColorFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « gyp/effects.gypi ('k') | src/effects/SkGammaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698