mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 1 | |
| 2 | #ifndef SkTableColorFilter_DEFINED |
| 3 | #define SkTableColorFilter_DEFINED |
| 4 | |
| 5 | #include "SkColorFilter.h" |
| 6 | |
vandebo@chromium.org | f724c4d | 2012-02-08 17:01:54 +0000 | [diff] [blame] | 7 | class SK_API SkTableColorFilter { |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 8 | public: |
| 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.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 21 | |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 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 | */ |
thakis@chromium.org | 2857a78 | 2012-02-10 22:49:31 +0000 | [diff] [blame] | 28 | 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.com | a2ca41e | 2012-03-23 19:00:34 +0000 | [diff] [blame] | 32 | |
| 33 | SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
mike@reedtribe.org | a69b48c | 2011-12-28 20:31:00 +0000 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | #endif |