68eb8c2763
Change-Id: Id2bdf73b5111c34f0ed1f36da85548a942568dcb Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211595 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com> Auto-Submit: Mike Reed <reed@google.com>
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
/*
|
|
* Copyright 2007 The Android Open Source Project
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkColorMatrix_DEFINED
|
|
#define SkColorMatrix_DEFINED
|
|
|
|
#include "include/core/SkTypes.h"
|
|
#include <memory.h>
|
|
|
|
class SK_API SkColorMatrix {
|
|
public:
|
|
void setIdentity();
|
|
void setScale(float rScale, float gScale, float bScale, float aScale = 1.0f);
|
|
|
|
enum Axis {
|
|
kR_Axis = 0,
|
|
kG_Axis = 1,
|
|
kB_Axis = 2
|
|
};
|
|
void setRotate(Axis, float degrees);
|
|
void setSinCos(Axis, float sine, float cosine);
|
|
void preRotate(Axis, float degrees);
|
|
void postRotate(Axis, float degrees);
|
|
void postTranslate(float dr, float dg, float db, float da);
|
|
|
|
void setConcat(const SkColorMatrix& a, const SkColorMatrix& b);
|
|
void preConcat(const SkColorMatrix& mat) { this->setConcat(*this, mat); }
|
|
void postConcat(const SkColorMatrix& mat) { this->setConcat(mat, *this); }
|
|
|
|
void setSaturation(float sat);
|
|
void setRGB2YUV();
|
|
void setYUV2RGB();
|
|
|
|
bool operator==(const SkColorMatrix& other) const {
|
|
return 0 == memcmp(fMat, other.fMat, sizeof(fMat));
|
|
}
|
|
|
|
bool operator!=(const SkColorMatrix& other) const { return !((*this) == other); }
|
|
|
|
private:
|
|
float fMat[20];
|
|
|
|
friend class SkColorFilters;
|
|
};
|
|
|
|
#endif
|