blob: 5714d072f268c99d7ad1a602ba9a911f51769358 [file] [log] [blame]
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +00001
2#ifndef SkTableColorFilter_DEFINED
3#define SkTableColorFilter_DEFINED
4
5#include "SkColorFilter.h"
6
vandebo@chromium.orgf724c4d2012-02-08 17:01:54 +00007class SK_API SkTableColorFilter {
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +00008public:
9 /**
10 * Create a table colorfilter, copying the table into the filter, and
11 * applying it to all 4 components.
12 * a' = table[a];
13 * r' = table[r];
14 * g' = table[g];
15 * b' = table[b];
16 * Compoents are operated on in unpremultiplied space. If the incomming
17 * colors are premultiplied, they are temporarily unpremultiplied, then
18 * the table is applied, and then the result is remultiplied.
19 */
20 static SkColorFilter* Create(const uint8_t table[256]);
rmistry@google.comfbfcd562012-08-23 18:09:54 +000021
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +000022 /**
23 * Create a table colorfilter, with a different table for each
24 * component [A, R, G, B]. If a given table is NULL, then it is
25 * treated as identity, with the component left unchanged. If a table
26 * is not null, then its contents are copied into the filter.
27 */
thakis@chromium.org2857a782012-02-10 22:49:31 +000028 static SkColorFilter* CreateARGB(const uint8_t tableA[256],
29 const uint8_t tableR[256],
30 const uint8_t tableG[256],
31 const uint8_t tableB[256]);
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000032
33 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
mike@reedtribe.orga69b48c2011-12-28 20:31:00 +000034};
35
36#endif