1a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org
2a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org#ifndef SkTableColorFilter_DEFINED
3a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org#define SkTableColorFilter_DEFINED
4a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org
5a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org#include "SkColorFilter.h"
6a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org
7f724c4df1cd6b4fb476e15f397ee6d656a4a7bebvandebo@chromium.orgclass SK_API SkTableColorFilter {
8a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.orgpublic:
9a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org    /**
10a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  Create a table colorfilter, copying the table into the filter, and
11a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  applying it to all 4 components.
12a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *      a' = table[a];
13a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *      r' = table[r];
14a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *      g' = table[g];
15a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *      b' = table[b];
16a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  Compoents are operated on in unpremultiplied space. If the incomming
17a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  colors are premultiplied, they are temporarily unpremultiplied, then
18a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  the table is applied, and then the result is remultiplied.
19a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     */
20a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org    static SkColorFilter* Create(const uint8_t table[256]);
21fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com
22a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org    /**
23a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  Create a table colorfilter, with a different table for each
24a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  component [A, R, G, B]. If a given table is NULL, then it is
25a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  treated as identity, with the component left unchanged. If a table
26a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     *  is not null, then its contents are copied into the filter.
27a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org     */
282857a784f7852c6171ee264a938be0816ba3e6dbthakis@chromium.org    static SkColorFilter* CreateARGB(const uint8_t tableA[256],
292857a784f7852c6171ee264a938be0816ba3e6dbthakis@chromium.org                                     const uint8_t tableR[256],
302857a784f7852c6171ee264a938be0816ba3e6dbthakis@chromium.org                                     const uint8_t tableG[256],
312857a784f7852c6171ee264a938be0816ba3e6dbthakis@chromium.org                                     const uint8_t tableB[256]);
32a2ca41e3afdd8fad5e0e924dec029f33918e0a67djsollen@google.com
33a2ca41e3afdd8fad5e0e924dec029f33918e0a67djsollen@google.com    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
34a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org};
35a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org
36a69b48c29dff7338c3dbc2f2262ef28719483be1mike@reedtribe.org#endif
37