Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
ModeButton Struct Reference

Public Member Functions

void init (const char label[], const SkRect &rect)
 
void draw (SkCanvas *canvas)
 
bool hitTest (SkScalar x, SkScalar y)
 

Public Attributes

SkString fLabel
 
SkColor fColor
 
SkRect fRect
 

Detailed Description

Definition at line 38 of file XferSlide.cpp.

Member Function Documentation

◆ draw()

void ModeButton::draw ( SkCanvas canvas)
inline

Definition at line 50 of file XferSlide.cpp.

50 {
52 paint.setAntiAlias(true);
53 paint.setColor(fColor);
54 canvas->drawRoundRect(fRect, 8, 8, paint);
55
56 paint.setColor(0xFFFFFFFF);
58 font.setSize(16);
62 }
void drawRoundRect(const SkRect &rect, SkScalar rx, SkScalar ry, const SkPaint &paint)
Definition: SkCanvas.cpp:2717
Definition: SkFont.h:35
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
const char * c_str() const
Definition: SkString.h:133
static void DrawString(SkCanvas *canvas, const char text[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint, Align align=kLeft_Align)
Definition: SkTextUtils.h:34
const Paint & paint
Definition: color_source.cc:38
SkFont DefaultFont()
font
Font Metadata and Metrics.
SkColor fColor
Definition: XferSlide.cpp:40
SkRect fRect
Definition: XferSlide.cpp:41
SkString fLabel
Definition: XferSlide.cpp:39
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float height() const
Definition: SkRect.h:769
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

◆ hitTest()

bool ModeButton::hitTest ( SkScalar  x,
SkScalar  y 
)
inline

Definition at line 64 of file XferSlide.cpp.

64 {
65 return fRect.intersects({x - 1, y - 1, x + 1, y + 1});
66 }
double y
double x
bool intersects(const SkRect &r) const
Definition: SkRect.h:1121

◆ init()

void ModeButton::init ( const char  label[],
const SkRect rect 
)
inline

Definition at line 44 of file XferSlide.cpp.

44 {
45 fLabel = label;
46 fRect = rect;
47 fColor = (gRand.nextU() & 0x7F7F7F7F) | SkColorSetARGB(0xFF, 0, 0, 0x80);
48 }
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition: SkColor.h:49
static SkRandom gRand
Definition: XferSlide.cpp:36
uint32_t nextU()
Definition: SkRandom.h:42
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

Member Data Documentation

◆ fColor

SkColor ModeButton::fColor

Definition at line 40 of file XferSlide.cpp.

◆ fLabel

SkString ModeButton::fLabel

Definition at line 39 of file XferSlide.cpp.

◆ fRect

SkRect ModeButton::fRect

Definition at line 41 of file XferSlide.cpp.


The documentation for this struct was generated from the following file: