1/* 2* Copyright 2015 Google Inc. 3* 4* Use of this source code is governed by a BSD-style license that can be 5* found in the LICENSE file. 6*/ 7 8#ifndef SkTableColorFilter_DEFINED 9#define SkTableColorFilter_DEFINED 10 11#include "SkColorFilter.h" 12 13class SK_API SkTableColorFilter { 14public: 15 /** 16 * Create a table colorfilter, copying the table into the filter, and 17 * applying it to all 4 components. 18 * a' = table[a]; 19 * r' = table[r]; 20 * g' = table[g]; 21 * b' = table[b]; 22 * Compoents are operated on in unpremultiplied space. If the incomming 23 * colors are premultiplied, they are temporarily unpremultiplied, then 24 * the table is applied, and then the result is remultiplied. 25 */ 26 static SkColorFilter* Create(const uint8_t table[256]); 27 28 /** 29 * Create a table colorfilter, with a different table for each 30 * component [A, R, G, B]. If a given table is NULL, then it is 31 * treated as identity, with the component left unchanged. If a table 32 * is not null, then its contents are copied into the filter. 33 */ 34 static SkColorFilter* CreateARGB(const uint8_t tableA[256], 35 const uint8_t tableR[256], 36 const uint8_t tableG[256], 37 const uint8_t tableB[256]); 38 39 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 40}; 41 42#endif 43