blob: 3989b5ac2d994016abb6d96c7a3eaf25137e542a [file] [log] [blame]
jvanverthcfc18862015-04-28 08:48:20 -07001/*
2* Copyright 2015 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*/
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +00007
8#ifndef SkTableColorFilter_DEFINED
9#define SkTableColorFilter_DEFINED
10
11#include "SkColorFilter.h"
12
vandebo@chromium.orgf724c4d2012-02-08 17:01:54 +000013class SK_API SkTableColorFilter {
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +000014public:
15 /**
16 * Create a table colorfilter, copying the table into the filter, and
17 * applying it to all 4 components.
18 * a' = table[a];
19 * r' = table[r];
20 * g' = table[g];
21 * b' = table[b];
22 * Compoents are operated on in unpremultiplied space. If the incomming
23 * colors are premultiplied, they are temporarily unpremultiplied, then
24 * the table is applied, and then the result is remultiplied.
25 */
reedd053ce92016-03-22 10:17:23 -070026 static sk_sp<SkColorFilter> Make(const uint8_t table[256]);
rmistry@google.comfbfcd562012-08-23 18:09:54 +000027
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +000028 /**
29 * Create a table colorfilter, with a different table for each
30 * component [A, R, G, B]. If a given table is NULL, then it is
31 * treated as identity, with the component left unchanged. If a table
32 * is not null, then its contents are copied into the filter.
33 */
reedd053ce92016-03-22 10:17:23 -070034 static sk_sp<SkColorFilter> MakeARGB(const uint8_t tableA[256],
35 const uint8_t tableR[256],
36 const uint8_t tableG[256],
37 const uint8_t tableB[256]);
38
Cary Clark4dc5a452018-05-21 11:56:57 -040039 static void InitializeFlattenables();
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +000040};
41
42#endif