SkTableColorFilter.h revision 368b4192001ccb3c14fd54f96fffe52fde545cb9
1
2#ifndef SkTableColorFilter_DEFINED
3#define SkTableColorFilter_DEFINED
4
5#include "SkColorFilter.h"
6
7class SK_API SkTableColorFilter {
8public:
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]);
21
22    /**
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     */
28    SK_API 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]);
32};
33
34#endif
35