Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Friends | List of all members
SkColorMatrix Class Reference

#include <SkColorMatrix.h>

Public Member Functions

constexpr SkColorMatrix ()
 
constexpr SkColorMatrix (float m00, float m01, float m02, float m03, float m04, float m10, float m11, float m12, float m13, float m14, float m20, float m21, float m22, float m23, float m24, float m30, float m31, float m32, float m33, float m34)
 
void setIdentity ()
 
void setScale (float rScale, float gScale, float bScale, float aScale=1.0f)
 
void postTranslate (float dr, float dg, float db, float da)
 
void setConcat (const SkColorMatrix &a, const SkColorMatrix &b)
 
void preConcat (const SkColorMatrix &mat)
 
void postConcat (const SkColorMatrix &mat)
 
void setSaturation (float sat)
 
void setRowMajor (const float src[20])
 
void getRowMajor (float dst[20]) const
 

Static Public Member Functions

static SkColorMatrix RGBtoYUV (SkYUVColorSpace)
 
static SkColorMatrix YUVtoRGB (SkYUVColorSpace)
 

Friends

class SkColorFilters
 

Detailed Description

Definition at line 18 of file SkColorMatrix.h.

Constructor & Destructor Documentation

◆ SkColorMatrix() [1/2]

constexpr SkColorMatrix::SkColorMatrix ( )
inlineconstexpr

Definition at line 20 of file SkColorMatrix.h.

20 : SkColorMatrix(1, 0, 0, 0, 0,
21 0, 1, 0, 0, 0,
22 0, 0, 1, 0, 0,
23 0, 0, 0, 1, 0) {}
constexpr SkColorMatrix()
Definition: SkColorMatrix.h:20

◆ SkColorMatrix() [2/2]

constexpr SkColorMatrix::SkColorMatrix ( float  m00,
float  m01,
float  m02,
float  m03,
float  m04,
float  m10,
float  m11,
float  m12,
float  m13,
float  m14,
float  m20,
float  m21,
float  m22,
float  m23,
float  m24,
float  m30,
float  m31,
float  m32,
float  m33,
float  m34 
)
inlineconstexpr

Definition at line 25 of file SkColorMatrix.h.

29 : fMat { m00, m01, m02, m03, m04,
30 m10, m11, m12, m13, m14,
31 m20, m21, m22, m23, m24,
32 m30, m31, m32, m33, m34 } {}

Member Function Documentation

◆ getRowMajor()

void SkColorMatrix::getRowMajor ( float  dst[20]) const
inline

Definition at line 49 of file SkColorMatrix.h.

49{ std::copy_n(fMat.begin(), 20, dst); }
dst
Definition: cp.py:12

◆ postConcat()

void SkColorMatrix::postConcat ( const SkColorMatrix mat)
inline

Definition at line 44 of file SkColorMatrix.h.

44{ this->setConcat(mat, *this); }
void setConcat(const SkColorMatrix &a, const SkColorMatrix &b)

◆ postTranslate()

void SkColorMatrix::postTranslate ( float  dr,
float  dg,
float  db,
float  da 
)

Definition at line 80 of file SkColorMatrix.cpp.

80 {
81 fMat[kR_Trans] += dr;
82 fMat[kG_Trans] += dg;
83 fMat[kB_Trans] += db;
84 fMat[kA_Trans] += da;
85}
@ kG_Trans
@ kR_Trans
@ kB_Trans
@ kA_Trans

◆ preConcat()

void SkColorMatrix::preConcat ( const SkColorMatrix mat)
inline

Definition at line 43 of file SkColorMatrix.h.

43{ this->setConcat(*this, mat); }

◆ RGBtoYUV()

SkColorMatrix SkColorMatrix::RGBtoYUV ( SkYUVColorSpace  cs)
static

Definition at line 13 of file SkColorMatrix.cpp.

13 {
15 SkColorMatrix_RGB2YUV(cs, m.fMat.data());
16 return m;
17}
void SkColorMatrix_RGB2YUV(SkYUVColorSpace cs, float m[20])
Definition: SkYUVMath.cpp:389

◆ setConcat()

void SkColorMatrix::setConcat ( const SkColorMatrix a,
const SkColorMatrix b 
)

Definition at line 89 of file SkColorMatrix.cpp.

89 {
90 set_concat(fMat.data(), matA.fMat.data(), matB.fMat.data());
91}
static void set_concat(float result[20], const float outer[20], const float inner[20])

◆ setIdentity()

void SkColorMatrix::setIdentity ( )

Definition at line 67 of file SkColorMatrix.cpp.

67 {
68 fMat.fill(0.0f);
69 fMat[kR_Scale] = fMat[kG_Scale] = fMat[kB_Scale] = fMat[kA_Scale] = 1;
70}
@ kR_Scale
@ kG_Scale
@ kA_Scale
@ kB_Scale

◆ setRowMajor()

void SkColorMatrix::setRowMajor ( const float  src[20])
inline

Definition at line 48 of file SkColorMatrix.h.

48{ std::copy_n(src, 20, fMat.begin()); }

◆ setSaturation()

void SkColorMatrix::setSaturation ( float  sat)

Definition at line 105 of file SkColorMatrix.cpp.

105 {
106 fMat.fill(0.0f);
107
108 const float R = kHueR * (1 - sat);
109 const float G = kHueG * (1 - sat);
110 const float B = kHueB * (1 - sat);
111
112 setrow(fMat.data() + 0, R + sat, G, B);
113 setrow(fMat.data() + 5, R, G + sat, B);
114 setrow(fMat.data() + 10, R, G, B + sat);
115 fMat[kA_Scale] = 1;
116}
static const float kHueR
static const float kHueB
static void setrow(float row[], float r, float g, float b)
static const float kHueG
static float sat(float r, float g, float b)
Definition: hsl.cpp:51
#define R(r)
Definition: SkMD5.cpp:125

◆ setScale()

void SkColorMatrix::setScale ( float  rScale,
float  gScale,
float  bScale,
float  aScale = 1.0f 
)

Definition at line 72 of file SkColorMatrix.cpp.

72 {
73 fMat.fill(0.0f);
74 fMat[kR_Scale] = rScale;
75 fMat[kG_Scale] = gScale;
76 fMat[kB_Scale] = bScale;
77 fMat[kA_Scale] = aScale;
78}

◆ YUVtoRGB()

SkColorMatrix SkColorMatrix::YUVtoRGB ( SkYUVColorSpace  cs)
static

Definition at line 19 of file SkColorMatrix.cpp.

19 {
21 SkColorMatrix_YUV2RGB(cs, m.fMat.data());
22 return m;
23}
void SkColorMatrix_YUV2RGB(SkYUVColorSpace cs, float m[20])
Definition: SkYUVMath.cpp:398

Friends And Related Function Documentation

◆ SkColorFilters

friend class SkColorFilters
friend

Definition at line 54 of file SkColorMatrix.h.


The documentation for this class was generated from the following files: