Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
sk_fontations::ColorPainter Class Reference

#include <SkTypeface_fontations_priv.h>

Inheritance diagram for sk_fontations::ColorPainter:
fontations_ffi::ColorPainterWrapper

Public Member Functions

 ColorPainter ()=delete
 
 ColorPainter (SkFontationsScalerContext &scaler_context, SkCanvas &canvas, SkSpan< const SkColor > palette, SkColor foregroundColor, bool antialias, uint16_t upem)
 
virtual void push_transform (const fontations_ffi::Transform &transform) override
 
virtual void pop_transform () override
 
virtual void push_clip_glyph (uint16_t glyph_id) override
 
virtual void push_clip_rectangle (float x_min, float y_min, float x_max, float y_max) override
 
virtual void pop_clip () override
 
virtual void fill_solid (uint16_t palette_index, float alpha) override
 
virtual void fill_radial (const fontations_ffi::FillRadialParams &fill_radial_params, fontations_ffi::BridgeColorStops &, uint8_t extend_mode) override
 
virtual void fill_linear (const fontations_ffi::FillLinearParams &fill_linear_params, fontations_ffi::BridgeColorStops &, uint8_t extend_mode) override
 
virtual void fill_sweep (const fontations_ffi::FillSweepParams &fill_sweep_params, fontations_ffi::BridgeColorStops &, uint8_t extend_mode) override
 
virtual void fill_glyph_solid (uint16_t glyph_id, uint16_t palette_index, float alpha) override
 
virtual void fill_glyph_radial (uint16_t glyph_id, const fontations_ffi::Transform &transform, const fontations_ffi::FillRadialParams &fill_radial_params, fontations_ffi::BridgeColorStops &stops, uint8_t) override
 
virtual void fill_glyph_linear (uint16_t glyph_id, const fontations_ffi::Transform &transform, const fontations_ffi::FillLinearParams &fill_linear_params, fontations_ffi::BridgeColorStops &stops, uint8_t) override
 
virtual void fill_glyph_sweep (uint16_t glyph_id, const fontations_ffi::Transform &transform, const fontations_ffi::FillSweepParams &fill_sweep_params, fontations_ffi::BridgeColorStops &stops, uint8_t) override
 
virtual void push_layer (uint8_t compositeMode) override
 
virtual void pop_layer () override
 
- Public Member Functions inherited from fontations_ffi::ColorPainterWrapper
virtual ~ColorPainterWrapper ()=default
 
virtual void push_transform (const Transform &transform)=0
 
virtual void pop_transform ()=0
 
virtual void push_clip_glyph (uint16_t glyph_id)=0
 
virtual void push_clip_rectangle (float x_min, float y_min, float x_max, float y_max)=0
 
virtual void pop_clip ()=0
 
virtual void fill_solid (uint16_t palette_index, float alpha)=0
 
virtual void fill_linear (const FillLinearParams &fill_linear_params, BridgeColorStops &stops, uint8_t extend_mode)=0
 
virtual void fill_radial (const FillRadialParams &fill_radial_params, BridgeColorStops &stops, uint8_t extend_mode)=0
 
virtual void fill_sweep (const FillSweepParams &, BridgeColorStops &stops, uint8_t extend_mode)=0
 
virtual void fill_glyph_solid (uint16_t glyph_id, uint16_t palette_index, float alpha)=0
 
virtual void fill_glyph_radial (uint16_t glyph_id, const fontations_ffi::Transform &transform, const fontations_ffi::FillRadialParams &fill_radial_params, fontations_ffi::BridgeColorStops &stops, uint8_t)=0
 
virtual void fill_glyph_linear (uint16_t glyph_id, const fontations_ffi::Transform &transform, const fontations_ffi::FillLinearParams &fill_linear_params, fontations_ffi::BridgeColorStops &stops, uint8_t)=0
 
virtual void fill_glyph_sweep (uint16_t glyph_id, const fontations_ffi::Transform &transform, const fontations_ffi::FillSweepParams &fill_sweep_params, fontations_ffi::BridgeColorStops &stops, uint8_t)=0
 
virtual void push_layer (uint8_t colrV1CompositeMode)=0
 
virtual void pop_layer ()=0
 

Detailed Description

Definition at line 66 of file SkTypeface_fontations_priv.h.

Constructor & Destructor Documentation

◆ ColorPainter() [1/2]

sk_fontations::ColorPainter::ColorPainter ( )
delete

◆ ColorPainter() [2/2]

sk_fontations::ColorPainter::ColorPainter ( SkFontationsScalerContext scaler_context,
SkCanvas canvas,
SkSpan< const SkColor palette,
SkColor  foregroundColor,
bool  antialias,
uint16_t  upem 
)

Definition at line 1189 of file SkTypeface_fontations.cpp.

1195 : fScalerContext(scaler_context)
1196 , fCanvas(canvas)
1197 , fPalette(palette)
1198 , fForegroundColor(foregroundColor)
1199 , fAntialias(antialias)
1200 , fUpem(upem) {}

Member Function Documentation

◆ fill_glyph_linear()

void sk_fontations::ColorPainter::fill_glyph_linear ( uint16_t  glyph_id,
const fontations_ffi::Transform &  transform,
const fontations_ffi::FillLinearParams &  fill_linear_params,
fontations_ffi::BridgeColorStops &  stops,
uint8_t  extend_mode 
)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1302 of file SkTypeface_fontations.cpp.

1306 {
1307 SkPath path;
1308 fScalerContext.generateYScalePathForGlyphId(glyph_id, &path, fUpem, *fontations_ffi::no_hinting_instance());
1309
1310 SkPaint paint;
1311 SkMatrix paintTransform = SkMatrixFromFontationsTransform(transform);
1312 configure_linear_paint(linear_params, bridge_stops, extend_mode, paint, &paintTransform);
1313 fCanvas.drawPath(path, paint);
1314}
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
bool generateYScalePathForGlyphId(uint16_t glyphId, SkPath *path, float yScale, const fontations_ffi::BridgeHintingInstance &hintingInstance)
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
const uint32_t extend_mode[]
Definition: colrv1.cpp:203
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47

◆ fill_glyph_radial()

void sk_fontations::ColorPainter::fill_glyph_radial ( uint16_t  glyph_id,
const fontations_ffi::Transform &  transform,
const fontations_ffi::FillRadialParams &  fill_radial_params,
fontations_ffi::BridgeColorStops &  stops,
uint8_t  extend_mode 
)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1459 of file SkTypeface_fontations.cpp.

1463 {
1464 SkPath path;
1465 fScalerContext.generateYScalePathForGlyphId(glyph_id, &path, fUpem, *fontations_ffi::no_hinting_instance());
1466
1467 SkPaint paint;
1468 SkMatrix paintTransform = SkMatrixFromFontationsTransform(transform);
1469 configure_radial_paint(fill_radial_params, bridge_stops, extend_mode, paint, &paintTransform);
1470 fCanvas.drawPath(path, paint);
1471}

◆ fill_glyph_solid()

void sk_fontations::ColorPainter::fill_glyph_solid ( uint16_t  glyph_id,
uint16_t  palette_index,
float  alpha 
)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1243 of file SkTypeface_fontations.cpp.

1243 {
1244 SkPath path;
1245 fScalerContext.generateYScalePathForGlyphId(glyph_id, &path, fUpem, *fontations_ffi::no_hinting_instance());
1246
1247 SkPaint paint;
1248 configure_solid_paint(palette_index, alpha, paint);
1249 fCanvas.drawPath(path, paint);
1250}

◆ fill_glyph_sweep()

void sk_fontations::ColorPainter::fill_glyph_sweep ( uint16_t  glyph_id,
const fontations_ffi::Transform &  transform,
const fontations_ffi::FillSweepParams &  fill_sweep_params,
fontations_ffi::BridgeColorStops &  stops,
uint8_t  extend_mode 
)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1524 of file SkTypeface_fontations.cpp.

1528 {
1529 SkPath path;
1530 fScalerContext.generateYScalePathForGlyphId(glyph_id, &path, fUpem, *fontations_ffi::no_hinting_instance());
1531
1532 SkPaint paint;
1533 SkMatrix paintTransform = SkMatrixFromFontationsTransform(transform);
1534 configure_sweep_paint(sweep_params, bridge_stops, extend_mode, paint, &paintTransform);
1535 fCanvas.drawPath(path, paint);
1536}

◆ fill_linear()

void sk_fontations::ColorPainter::fill_linear ( const fontations_ffi::FillLinearParams &  fill_linear_params,
fontations_ffi::BridgeColorStops &  bridge_stops,
uint8_t  extend_mode 
)
overridevirtual

Definition at line 1292 of file SkTypeface_fontations.cpp.

1294 {
1295 SkPaint paint;
1296
1297 configure_linear_paint(linear_params, bridge_stops, extend_mode, paint);
1298
1299 fCanvas.drawPaint(paint);
1300}
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668

◆ fill_radial()

void sk_fontations::ColorPainter::fill_radial ( const fontations_ffi::FillRadialParams &  fill_radial_params,
fontations_ffi::BridgeColorStops &  bridge_stops,
uint8_t  extend_mode 
)
overridevirtual

Definition at line 1449 of file SkTypeface_fontations.cpp.

1451 {
1452 SkPaint paint;
1453
1454 configure_radial_paint(fill_radial_params, bridge_stops, extend_mode, paint);
1455
1456 fCanvas.drawPaint(paint);
1457}

◆ fill_solid()

void sk_fontations::ColorPainter::fill_solid ( uint16_t  palette_index,
float  alpha 
)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1237 of file SkTypeface_fontations.cpp.

1237 {
1238 SkPaint paint;
1239 configure_solid_paint(palette_index, alpha, paint);
1240 fCanvas.drawPaint(paint);
1241}

◆ fill_sweep()

void sk_fontations::ColorPainter::fill_sweep ( const fontations_ffi::FillSweepParams &  fill_sweep_params,
fontations_ffi::BridgeColorStops &  bridge_stops,
uint8_t  extend_mode 
)
overridevirtual

Definition at line 1514 of file SkTypeface_fontations.cpp.

1516 {
1517 SkPaint paint;
1518
1519 configure_sweep_paint(sweep_params, bridge_stops, extend_mode, paint);
1520
1521 fCanvas.drawPaint(paint);
1522}

◆ pop_clip()

void sk_fontations::ColorPainter::pop_clip ( )
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1222 of file SkTypeface_fontations.cpp.

1222{ fCanvas.restore(); }
void restore()
Definition: SkCanvas.cpp:461

◆ pop_layer()

void sk_fontations::ColorPainter::pop_layer ( )
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1544 of file SkTypeface_fontations.cpp.

1544{ fCanvas.restore(); }

◆ pop_transform()

void sk_fontations::ColorPainter::pop_transform ( )
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1207 of file SkTypeface_fontations.cpp.

1207{ fCanvas.restore(); }

◆ push_clip_glyph()

void sk_fontations::ColorPainter::push_clip_glyph ( uint16_t  glyph_id)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1209 of file SkTypeface_fontations.cpp.

1209 {
1210 fCanvas.save();
1211 SkPath path;
1212 fScalerContext.generateYScalePathForGlyphId(glyph_id, &path, fUpem, *fontations_ffi::no_hinting_instance());
1213 fCanvas.clipPath(path, fAntialias);
1214}
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1456
int save()
Definition: SkCanvas.cpp:447

◆ push_clip_rectangle()

void sk_fontations::ColorPainter::push_clip_rectangle ( float  x_min,
float  y_min,
float  x_max,
float  y_max 
)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1216 of file SkTypeface_fontations.cpp.

1216 {
1217 fCanvas.save();
1218 SkRect clipRect = SkRect::MakeLTRB(x_min, -y_min, x_max, -y_max);
1219 fCanvas.clipRect(clipRect, fAntialias);
1220}
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

◆ push_layer()

void sk_fontations::ColorPainter::push_layer ( uint8_t  compositeMode)
overridevirtual

Implements fontations_ffi::ColorPainterWrapper.

Definition at line 1538 of file SkTypeface_fontations.cpp.

1538 {
1539 SkPaint paint;
1540 paint.setBlendMode(ToSkBlendMode(compositeMode));
1541 fCanvas.saveLayer(nullptr, &paint);
1542}
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496

◆ push_transform()

void sk_fontations::ColorPainter::push_transform ( const fontations_ffi::Transform &  transform)
overridevirtual

Definition at line 1202 of file SkTypeface_fontations.cpp.

1202 {
1203 fCanvas.save();
1204 fCanvas.concat(SkMatrixFromFontationsTransform(transform_arg));
1205}
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318

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