* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkColorTable_DEFINED
#define SkColorTable_DEFINED
#include "include/core/SkColor.h"
#include "include/core/SkRefCnt.h"
SkColorTable holds an array SkPMColors (premultiplied 32-bit colors) used by
8-bit bitmaps, where the bitmap bytes are interpreted as indices into the colortable.
SkColorTable is thread-safe.
*/
class SkColorTable : public SkRefCnt {
public:
*/
SkColorTable(const SkPMColor colors[], int count);
~SkColorTable() override;
*/
int count() const { return fCount; }
* the index is in range (0 <= index < count).
*/
SkPMColor operator[](int index) const {
SkASSERT(fColors != nullptr && (unsigned)index < (unsigned)fCount);
return fColors[index];
}
const SkPMColor* readColors() const { return fColors; }
private:
SkPMColor* fColors;
int fCount;
typedef SkRefCnt INHERITED;
};
#endif