Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::GlyphProperties Struct Reference

#include <font_glyph_pair.h>

Classes

struct  Equal
 

Public Types

enum class  Tone {
  kDark ,
  kLight
}
 
using ToneOrColor = std::variant< Tone, Color >
 

Static Public Member Functions

static Tone ComputeTone (const Color &c)
 

Public Attributes

ToneOrColor tone_or_color
 
std::optional< StrokeParametersstroke
 

Static Public Attributes

static constexpr ToneOrColor kDarkTone {Tone::kDark}
 
static constexpr ToneOrColor kLightTone {Tone::kLight}
 

Detailed Description

Definition at line 20 of file font_glyph_pair.h.

Member Typedef Documentation

◆ ToneOrColor

Definition at line 26 of file font_glyph_pair.h.

Member Enumeration Documentation

◆ Tone

Enumerator
kDark 
kLight 

Definition at line 21 of file font_glyph_pair.h.

Member Function Documentation

◆ ComputeTone()

static Tone impeller::GlyphProperties::ComputeTone ( const Color c)
inlinestatic

Definition at line 45 of file font_glyph_pair.h.

45 {
46#if FML_OS_MACOSX && !FML_OS_IOS
47 // Uses BT.709 luma coefficients
48 // (https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients) to determine
49 // whether a color is light or dark.
50 Scalar luma = c.red * 0.2126f + c.green * 0.7152f + c.blue * 0.0722f;
51 return (luma > 0.5f) ? Tone::kLight : Tone::kDark;
52#else
53 return Tone::kDark;
54#endif
55 }
float Scalar
Definition scalar.h:19

References c, kDark, and kLight.

Referenced by impeller::FirstPassDispatcher::drawText(), impeller::TextContents::SetTextProperties(), and impeller::testing::TEST_P().

Member Data Documentation

◆ kDarkTone

constexpr ToneOrColor impeller::GlyphProperties::kDarkTone {Tone::kDark}
staticconstexpr

Definition at line 27 of file font_glyph_pair.h.

Referenced by impeller::DrawGlyph().

◆ kLightTone

constexpr ToneOrColor impeller::GlyphProperties::kLightTone {Tone::kLight}
staticconstexpr

Definition at line 28 of file font_glyph_pair.h.

Referenced by impeller::DrawGlyph(), and impeller::UpdateAtlasBitmap().

◆ stroke

◆ tone_or_color


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