• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2007 The Android Open Source Project
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 
10 #ifndef SkColorMatrix_DEFINED
11 #define SkColorMatrix_DEFINED
12 
13 #include "SkScalar.h"
14 
15 class SkColorMatrix {
16 public:
17     SkScalar    fMat[20];
18 
19     void setIdentity();
20     void setScale(SkScalar rScale, SkScalar gScale, SkScalar bScale,
21                   SkScalar aScale = SK_Scalar1);
22     void preScale(SkScalar rScale, SkScalar gScale, SkScalar bScale,
23                   SkScalar aScale = SK_Scalar1);
24     void postScale(SkScalar rScale, SkScalar gScale, SkScalar bScale,
25                    SkScalar aScale = SK_Scalar1);
26 
27     enum Axis {
28         kR_Axis = 0,
29         kG_Axis = 1,
30         kB_Axis = 2
31     };
32     void setRotate(Axis, SkScalar degrees);
33     void setSinCos(Axis, SkScalar sine, SkScalar cosine);
34     void preRotate(Axis, SkScalar degrees);
35     void postRotate(Axis, SkScalar degrees);
36 
37     void setConcat(const SkColorMatrix& a, const SkColorMatrix& b);
preConcat(const SkColorMatrix & mat)38     void preConcat(const SkColorMatrix& mat) { this->setConcat(*this, mat); }
postConcat(const SkColorMatrix & mat)39     void postConcat(const SkColorMatrix& mat) { this->setConcat(mat, *this); }
40 
41     void setSaturation(SkScalar sat);
42     void setRGB2YUV();
43     void setYUV2RGB();
44 };
45 
46 #endif
47