Flutter Engine
The Flutter Engine
Classes | Enumerations | Functions | Variables
xfermodes.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFont.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.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/SkTypeface.h"
#include "include/core/SkTypes.h"
#include "include/utils/SkTextUtils.h"
#include "tools/ToolUtils.h"
#include "tools/fonts/FontToolUtils.h"

Go to the source code of this file.

Classes

class  XfermodesGM
 

Enumerations

enum  SrcType {
  kRectangleImage_SrcType = 0x01 , kRectangleImageWithAlpha_SrcType = 0x02 , kSmallRectangleImageWithAlpha_SrcType = 0x04 , kRectangle_SrcType = 0x08 ,
  kQuarterClear_SrcType = 0x10 , kQuarterClearInLayer_SrcType = 0x20 , kSmallTransparentImage_SrcType = 0x40 , kRectangleWithMask_SrcType = 0x80 ,
  kAll_SrcType = 0xFF , kBasic_SrcType = 0x03
}
 

Functions

static void make_bitmaps (int w, int h, SkBitmap *src, SkBitmap *dst, SkBitmap *transparent)
 

Variables

struct {
   SkBlendMode   fMode
 
   int   fSourceTypeMask
 
gModes []
 
static uint16_t gData [] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }
 

Enumeration Type Documentation

◆ SrcType

enum SrcType
Enumerator
kRectangleImage_SrcType 

A WxH image with a rectangle in the lower right.

kRectangleImageWithAlpha_SrcType 

kRectangleImage_SrcType with an alpha of 34.5%.

kSmallRectangleImageWithAlpha_SrcType 

kRectnagleImageWithAlpha_SrcType scaled down by half.

kRectangle_SrcType 

kRectangleImage_SrcType drawn directly instead in an image.

kQuarterClear_SrcType 

Two rectangles, first on the right half, second on the bottom half.

kQuarterClearInLayer_SrcType 

kQuarterClear_SrcType in a layer.

kSmallTransparentImage_SrcType 

A W/2xH/2 transparent image.

kRectangleWithMask_SrcType 

kRectangleImage_SrcType drawn directly with a mask.

kAll_SrcType 

All the source types.

kBasic_SrcType 

Just basic source types.

Definition at line 29 of file xfermodes.cpp.

29 {
30 //! A WxH image with a rectangle in the lower right.
32 //! kRectangleImage_SrcType with an alpha of 34.5%.
34 //! kRectnagleImageWithAlpha_SrcType scaled down by half.
36 //! kRectangleImage_SrcType drawn directly instead in an image.
37 kRectangle_SrcType = 0x08,
38 //! Two rectangles, first on the right half, second on the bottom half.
40 //! kQuarterClear_SrcType in a layer.
42 //! A W/2xH/2 transparent image.
44 //! kRectangleImage_SrcType drawn directly with a mask.
46
47 kAll_SrcType = 0xFF, //!< All the source types.
48 kBasic_SrcType = 0x03, //!< Just basic source types.
49};
@ kBasic_SrcType
Just basic source types.
Definition: xfermodes.cpp:48
@ kRectangleImageWithAlpha_SrcType
kRectangleImage_SrcType with an alpha of 34.5%.
Definition: xfermodes.cpp:33
@ kRectangleImage_SrcType
A WxH image with a rectangle in the lower right.
Definition: xfermodes.cpp:31
@ kSmallRectangleImageWithAlpha_SrcType
kRectnagleImageWithAlpha_SrcType scaled down by half.
Definition: xfermodes.cpp:35
@ kAll_SrcType
All the source types.
Definition: xfermodes.cpp:47
@ kSmallTransparentImage_SrcType
A W/2xH/2 transparent image.
Definition: xfermodes.cpp:43
@ kQuarterClear_SrcType
Two rectangles, first on the right half, second on the bottom half.
Definition: xfermodes.cpp:39
@ kRectangle_SrcType
kRectangleImage_SrcType drawn directly instead in an image.
Definition: xfermodes.cpp:37
@ kRectangleWithMask_SrcType
kRectangleImage_SrcType drawn directly with a mask.
Definition: xfermodes.cpp:45
@ kQuarterClearInLayer_SrcType
kQuarterClear_SrcType in a layer.
Definition: xfermodes.cpp:41

Function Documentation

◆ make_bitmaps()

static void make_bitmaps ( int  w,
int  h,
SkBitmap src,
SkBitmap dst,
SkBitmap transparent 
)
static

Definition at line 92 of file xfermodes.cpp.

93 {
94 src->allocN32Pixels(w, h);
95 src->eraseColor(SK_ColorTRANSPARENT);
96
97 SkPaint p;
98 p.setAntiAlias(true);
99
100 SkRect r;
103
104 {
105 SkCanvas c(*src);
106 p.setColor(ToolUtils::color_to_565(0xFFFFCC44));
107 r.setWH(ww*3/4, hh*3/4);
108 c.drawOval(r, p);
109 }
110
111 dst->allocN32Pixels(w, h);
112 dst->eraseColor(SK_ColorTRANSPARENT);
113
114 {
115 SkCanvas c(*dst);
116 p.setColor(ToolUtils::color_to_565(0xFF66AAFF));
117 r.setLTRB(ww/3, hh/3, ww*19/20, hh*19/20);
118 c.drawRect(r, p);
119 }
120
121 transparent->allocN32Pixels(w, h);
122 transparent->eraseColor(SK_ColorTRANSPARENT);
123}
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232
void eraseColor(SkColor4f) const
Definition: SkBitmap.cpp:442
float SkScalar
Definition: extension.cpp:12
SkColor color_to_565(SkColor color)
Definition: ToolUtils.cpp:139
dst
Definition: cp.py:12
SkScalar w
SkScalar h
void setWH(float width, float height)
Definition: SkRect.h:944
void setLTRB(float left, float top, float right, float bottom)
Definition: SkRect.h:865

Variable Documentation

◆ fMode

SkBlendMode fMode

Definition at line 52 of file xfermodes.cpp.

◆ fSourceTypeMask

int fSourceTypeMask

Definition at line 53 of file xfermodes.cpp.

◆ gData

uint16_t gData[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }
static

Definition at line 125 of file xfermodes.cpp.

◆ 

const struct { ... } gModes[]