Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
analytic_gradients.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTileMode.h"
#include "include/core/SkTypes.h"
#include "include/effects/SkGradientShader.h"
#include "include/private/base/SkTemplates.h"

Go to the source code of this file.

Classes

class  AnalyticGradientShaderGM
 

Functions

static void shade_rect (SkCanvas *canvas, sk_sp< SkShader > shader, int cellRow, int cellCol)
 

Variables

const int M1_POSITIONS [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }
 
const int M2_POSITIONS [] = { 0, 1,1, 2,2, 3,3, 4,4, 5,5, 6,6, 7,7, 8 }
 
const int M3_POSITIONS [] = { 0, 1, 2,2, 3, 4,4, 5, 6,6, 7, 8 }
 
const int M4_POSITIONS [] = { 0, 1,1, 2, 3,3, 4, 5,5, 6, 7,7, 8 }
 
const int INT1_COLOR_COUNTS [] = { 2, 2, 2, 2 }
 
const int INT2_COLOR_COUNTS [] = { 3, 4, 3, 4 }
 
const int INT3_COLOR_COUNTS [] = { 4, 6, 5, 5 }
 
const int INT4_COLOR_COUNTS [] = { 5, 8, 6, 7 }
 
const int INT5_COLOR_COUNTS [] = { 6, 10, 8, 8 }
 
const int INT6_COLOR_COUNTS [] = { 7, 12, 9, 10 }
 
const int INT7_COLOR_COUNTS [] = { 8, 14, 11, 11 }
 
const int INT8_COLOR_COUNTS [] = { 9, 16, 12, 13 }
 
const SkColor COLORS []
 
const intINTERVAL_COLOR_COUNTS []
 
const int COLOR_COUNT = std::size(COLORS)
 
const intM_POSITIONS []
 
const int WIDTH = 500
 
const int HEIGHT = 500
 
const int NUM_ROWS = 8
 
const int NUM_COLS = 4
 
const int CELL_WIDTH = WIDTH / NUM_COLS
 
const int CELL_HEIGHT = HEIGHT / NUM_ROWS
 
const int PAD_WIDTH = 3
 
const int PAD_HEIGHT = 3
 
const int RECT_WIDTH = CELL_WIDTH - (2 * PAD_WIDTH)
 
const int RECT_HEIGHT = CELL_HEIGHT - (2 * PAD_HEIGHT)
 

Function Documentation

◆ shade_rect()

static void shade_rect ( SkCanvas canvas,
sk_sp< SkShader shader,
int  cellRow,
int  cellCol 
)
static

Definition at line 120 of file analytic_gradients.cpp.

120 {
122 paint.setShader(shader);
123
124 canvas->save();
125 canvas->translate(SkIntToScalar(cellCol * CELL_WIDTH + PAD_WIDTH),
127
129 canvas->drawRect(rect, paint);
130 canvas->restore();
131}
#define SkIntToScalar(x)
Definition SkScalar.h:57
const int RECT_HEIGHT
const int CELL_WIDTH
const int PAD_WIDTH
const int PAD_HEIGHT
const int RECT_WIDTH
const int CELL_HEIGHT
void drawRect(const SkRect &rect, const SkPaint &paint)
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
int save()
Definition SkCanvas.cpp:451
const Paint & paint
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609

Variable Documentation

◆ CELL_HEIGHT

const int CELL_HEIGHT = HEIGHT / NUM_ROWS

Definition at line 112 of file analytic_gradients.cpp.

◆ CELL_WIDTH

const int CELL_WIDTH = WIDTH / NUM_COLS

Definition at line 111 of file analytic_gradients.cpp.

◆ COLOR_COUNT

const int COLOR_COUNT = std::size(COLORS)

Definition at line 96 of file analytic_gradients.cpp.

◆ COLORS

const SkColor COLORS[]
Initial value:
= {
}
constexpr SkColor SK_ColorYELLOW
Definition SkColor.h:139
constexpr SkColor SK_ColorLTGRAY
Definition SkColor.h:118
constexpr SkColor SK_ColorMAGENTA
Definition SkColor.h:147
constexpr SkColor SK_ColorCYAN
Definition SkColor.h:143
constexpr SkColor SK_ColorBLUE
Definition SkColor.h:135
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
constexpr SkColor SK_ColorGREEN
Definition SkColor.h:131
constexpr SkColor SK_ColorDKGRAY
Definition SkColor.h:108

Definition at line 74 of file analytic_gradients.cpp.

◆ HEIGHT

const int HEIGHT = 500

Definition at line 106 of file analytic_gradients.cpp.

◆ INT1_COLOR_COUNTS

const int INT1_COLOR_COUNTS[] = { 2, 2, 2, 2 }

Definition at line 64 of file analytic_gradients.cpp.

64{ 2, 2, 2, 2 };

◆ INT2_COLOR_COUNTS

const int INT2_COLOR_COUNTS[] = { 3, 4, 3, 4 }

Definition at line 65 of file analytic_gradients.cpp.

65{ 3, 4, 3, 4 };

◆ INT3_COLOR_COUNTS

const int INT3_COLOR_COUNTS[] = { 4, 6, 5, 5 }

Definition at line 66 of file analytic_gradients.cpp.

66{ 4, 6, 5, 5 };

◆ INT4_COLOR_COUNTS

const int INT4_COLOR_COUNTS[] = { 5, 8, 6, 7 }

Definition at line 67 of file analytic_gradients.cpp.

67{ 5, 8, 6, 7 };

◆ INT5_COLOR_COUNTS

const int INT5_COLOR_COUNTS[] = { 6, 10, 8, 8 }

Definition at line 68 of file analytic_gradients.cpp.

68{ 6, 10, 8, 8 };

◆ INT6_COLOR_COUNTS

const int INT6_COLOR_COUNTS[] = { 7, 12, 9, 10 }

Definition at line 69 of file analytic_gradients.cpp.

69{ 7, 12, 9, 10 };

◆ INT7_COLOR_COUNTS

const int INT7_COLOR_COUNTS[] = { 8, 14, 11, 11 }

Definition at line 70 of file analytic_gradients.cpp.

70{ 8, 14, 11, 11 };

◆ INT8_COLOR_COUNTS

const int INT8_COLOR_COUNTS[] = { 9, 16, 12, 13 }

Definition at line 71 of file analytic_gradients.cpp.

71{ 9, 16, 12, 13 };

◆ INTERVAL_COLOR_COUNTS

const int* INTERVAL_COLOR_COUNTS[]
Initial value:
= {
}
const int INT4_COLOR_COUNTS[]
const int INT3_COLOR_COUNTS[]
const int INT5_COLOR_COUNTS[]
const int INT7_COLOR_COUNTS[]
const int INT2_COLOR_COUNTS[]
const int INT8_COLOR_COUNTS[]
const int INT6_COLOR_COUNTS[]
const int INT1_COLOR_COUNTS[]

Definition at line 86 of file analytic_gradients.cpp.

◆ M1_POSITIONS

const int M1_POSITIONS[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }

Definition at line 58 of file analytic_gradients.cpp.

58{ 0, 1, 2, 3, 4, 5, 6, 7, 8 };

◆ M2_POSITIONS

const int M2_POSITIONS[] = { 0, 1,1, 2,2, 3,3, 4,4, 5,5, 6,6, 7,7, 8 }

Definition at line 59 of file analytic_gradients.cpp.

59{ 0, 1,1, 2,2, 3,3, 4,4, 5,5, 6,6, 7,7, 8 };

◆ M3_POSITIONS

const int M3_POSITIONS[] = { 0, 1, 2,2, 3, 4,4, 5, 6,6, 7, 8 }

Definition at line 60 of file analytic_gradients.cpp.

60{ 0, 1, 2,2, 3, 4,4, 5, 6,6, 7, 8 };

◆ M4_POSITIONS

const int M4_POSITIONS[] = { 0, 1,1, 2, 3,3, 4, 5,5, 6, 7,7, 8 }

Definition at line 61 of file analytic_gradients.cpp.

61{ 0, 1,1, 2, 3,3, 4, 5,5, 6, 7,7, 8 };

◆ M_POSITIONS

const int* M_POSITIONS[]
Initial value:
= {
}
const int M4_POSITIONS[]
const int M1_POSITIONS[]
const int M2_POSITIONS[]
const int M3_POSITIONS[]

Definition at line 98 of file analytic_gradients.cpp.

98 {
103};

◆ NUM_COLS

const int NUM_COLS = 4

Definition at line 109 of file analytic_gradients.cpp.

◆ NUM_ROWS

const int NUM_ROWS = 8

Definition at line 108 of file analytic_gradients.cpp.

◆ PAD_HEIGHT

const int PAD_HEIGHT = 3

Definition at line 115 of file analytic_gradients.cpp.

◆ PAD_WIDTH

const int PAD_WIDTH = 3

Definition at line 114 of file analytic_gradients.cpp.

◆ RECT_HEIGHT

const int RECT_HEIGHT = CELL_HEIGHT - (2 * PAD_HEIGHT)

Definition at line 118 of file analytic_gradients.cpp.

◆ RECT_WIDTH

const int RECT_WIDTH = CELL_WIDTH - (2 * PAD_WIDTH)

Definition at line 117 of file analytic_gradients.cpp.

◆ WIDTH

const int WIDTH = 500

Definition at line 105 of file analytic_gradients.cpp.