180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkTableColorFilter_DEFINED
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkTableColorFilter_DEFINED
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkColorFilter.h"
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SK_API SkTableColorFilter {
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    /**
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  Create a table colorfilter, copying the table into the filter, and
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  applying it to all 4 components.
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *      a' = table[a];
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *      r' = table[r];
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *      g' = table[g];
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *      b' = table[b];
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  Compoents are operated on in unpremultiplied space. If the incomming
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  colors are premultiplied, they are temporarily unpremultiplied, then
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  the table is applied, and then the result is remultiplied.
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     */
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static SkColorFilter* Create(const uint8_t table[256]);
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    /**
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  Create a table colorfilter, with a different table for each
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  component [A, R, G, B]. If a given table is NULL, then it is
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  treated as identity, with the component left unchanged. If a table
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     *  is not null, then its contents are copied into the filter.
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru     */
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    static SkColorFilter* CreateARGB(const uint8_t tableA[256],
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                                     const uint8_t tableR[256],
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                                     const uint8_t tableG[256],
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru                                     const uint8_t tableB[256]);
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
37