Flutter Engine
flutter::Canvas Class Reference

#include <canvas.h>

Inheritance diagram for flutter::Canvas:
flutter::RefCountedDartWrappable< Canvas > fml::RefCountedThreadSafe< Canvas > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 ~Canvas () override
 
void save ()
 
void saveLayerWithoutBounds (const Paint &paint, const PaintData &paint_data)
 
void saveLayer (double left, double top, double right, double bottom, const Paint &paint, const PaintData &paint_data)
 
void restore ()
 
int getSaveCount ()
 
void translate (double dx, double dy)
 
void scale (double sx, double sy)
 
void rotate (double radians)
 
void skew (double sx, double sy)
 
void transform (const tonic::Float64List &matrix4)
 
void clipRect (double left, double top, double right, double bottom, SkClipOp clipOp, bool doAntiAlias=true)
 
void clipRRect (const RRect &rrect, bool doAntiAlias=true)
 
void clipPath (const CanvasPath *path, bool doAntiAlias=true)
 
void drawColor (SkColor color, SkBlendMode blend_mode)
 
void drawLine (double x1, double y1, double x2, double y2, const Paint &paint, const PaintData &paint_data)
 
void drawPaint (const Paint &paint, const PaintData &paint_data)
 
void drawRect (double left, double top, double right, double bottom, const Paint &paint, const PaintData &paint_data)
 
void drawRRect (const RRect &rrect, const Paint &paint, const PaintData &paint_data)
 
void drawDRRect (const RRect &outer, const RRect &inner, const Paint &paint, const PaintData &paint_data)
 
void drawOval (double left, double top, double right, double bottom, const Paint &paint, const PaintData &paint_data)
 
void drawCircle (double x, double y, double radius, const Paint &paint, const PaintData &paint_data)
 
void drawArc (double left, double top, double right, double bottom, double startAngle, double sweepAngle, bool useCenter, const Paint &paint, const PaintData &paint_data)
 
void drawPath (const CanvasPath *path, const Paint &paint, const PaintData &paint_data)
 
void drawImage (const CanvasImage *image, double x, double y, const Paint &paint, const PaintData &paint_data, int filterQualityIndex)
 
void drawImageRect (const CanvasImage *image, double src_left, double src_top, double src_right, double src_bottom, double dst_left, double dst_top, double dst_right, double dst_bottom, const Paint &paint, const PaintData &paint_data, int filterQualityIndex)
 
void drawImageNine (const CanvasImage *image, double center_left, double center_top, double center_right, double center_bottom, double dst_left, double dst_top, double dst_right, double dst_bottom, const Paint &paint, const PaintData &paint_data, int bitmapSamplingIndex)
 
void drawPicture (Picture *picture)
 
void drawPoints (const Paint &paint, const PaintData &paint_data, SkCanvas::PointMode point_mode, const tonic::Float32List &points)
 
void drawVertices (const Vertices *vertices, SkBlendMode blend_mode, const Paint &paint, const PaintData &paint_data)
 
void drawAtlas (const Paint &paint, const PaintData &paint_data, int filterQualityIndex, CanvasImage *atlas, const tonic::Float32List &transforms, const tonic::Float32List &rects, const tonic::Int32List &colors, SkBlendMode blend_mode, const tonic::Float32List &cull_rect)
 
void drawShadow (const CanvasPath *path, SkColor color, double elevation, bool transparentOccluder)
 
SkCanvas * canvas () const
 
void Invalidate ()
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< Canvas >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< Canvas >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
virtual size_t GetAllocationSize () const
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static fml::RefPtr< CanvasCreate (PictureRecorder *recorder, double left, double top, double right, double bottom)
 
static void RegisterNatives (tonic::DartLibraryNatives *natives)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex,
  kNumberOfNativeFields
}
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< Canvas >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 26 of file canvas.h.

Constructor & Destructor Documentation

◆ ~Canvas()

flutter::Canvas::~Canvas ( )
override

Definition at line 94 of file canvas.cc.

94 {}

Member Function Documentation

◆ canvas()

SkCanvas* flutter::Canvas::canvas ( ) const
inline

Definition at line 171 of file canvas.h.

Referenced by Create(), and flutter::Paragraph::paint().

171 { return canvas_; }

◆ clipPath()

void flutter::Canvas::clipPath ( const CanvasPath path,
bool  doAntiAlias = true 
)

Definition at line 196 of file canvas.cc.

References flutter::CanvasPath::path(), and tonic::ToDart().

196  {
197  if (!canvas_) {
198  return;
199  }
200  if (!path) {
201  Dart_ThrowException(
202  ToDart("Canvas.clipPath called with non-genuine Path."));
203  return;
204  }
205  canvas_->clipPath(path->path(), doAntiAlias);
206 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
Dart_Handle ToDart(const T &object)

◆ clipRect()

void flutter::Canvas::clipRect ( double  left,
double  top,
double  right,
double  bottom,
SkClipOp  clipOp,
bool  doAntiAlias = true 
)

Definition at line 176 of file canvas.cc.

181  {
182  if (!canvas_) {
183  return;
184  }
185  canvas_->clipRect(SkRect::MakeLTRB(left, top, right, bottom), clipOp,
186  doAntiAlias);
187 }

◆ clipRRect()

void flutter::Canvas::clipRRect ( const RRect rrect,
bool  doAntiAlias = true 
)

Definition at line 189 of file canvas.cc.

References flutter::RRect::sk_rrect.

189  {
190  if (!canvas_) {
191  return;
192  }
193  canvas_->clipRRect(rrect.sk_rrect, doAntiAlias);
194 }

◆ Create()

fml::RefPtr< Canvas > flutter::Canvas::Create ( PictureRecorder recorder,
double  left,
double  top,
double  right,
double  bottom 
)
static

Definition at line 75 of file canvas.cc.

References flutter::PictureRecorder::BeginRecording(), canvas(), flutter::PictureRecorder::display_list_recorder(), flutter::PictureRecorder::set_canvas(), and tonic::ToDart().

Referenced by flutter::Canvas_constructor().

79  {
80  if (!recorder) {
81  Dart_ThrowException(
82  ToDart("Canvas constructor called with non-genuine PictureRecorder."));
83  return nullptr;
84  }
85  fml::RefPtr<Canvas> canvas = fml::MakeRefCounted<Canvas>(
86  recorder->BeginRecording(SkRect::MakeLTRB(left, top, right, bottom)));
87  recorder->set_canvas(canvas);
88  canvas->display_list_recorder_ = recorder->display_list_recorder();
89  return canvas;
90 }
SkCanvas * canvas() const
Definition: canvas.h:171
Dart_Handle ToDart(const T &object)

◆ drawArc()

void flutter::Canvas::drawArc ( double  left,
double  top,
double  right,
double  bottom,
double  startAngle,
double  sweepAngle,
bool  useCenter,
const Paint paint,
const PaintData paint_data 
)

Definition at line 288 of file canvas.cc.

References flutter::Paint::paint().

296  {
297  if (!canvas_) {
298  return;
299  }
300  canvas_->drawArc(SkRect::MakeLTRB(left, top, right, bottom),
301  startAngle * 180.0 / M_PI, sweepAngle * 180.0 / M_PI,
302  useCenter, *paint.paint());
303 }

◆ drawAtlas()

void flutter::Canvas::drawAtlas ( const Paint paint,
const PaintData paint_data,
int  filterQualityIndex,
CanvasImage atlas,
const tonic::Float32List &  transforms,
const tonic::Float32List &  rects,
const tonic::Int32List &  colors,
SkBlendMode  blend_mode,
const tonic::Float32List &  cull_rect 
)

Definition at line 459 of file canvas.cc.

References flutter::CanvasImage::image(), flutter::Paint::paint(), flutter::ImageFilter::SamplingFromIndex(), and tonic::ToDart().

467  {
468  if (!canvas_) {
469  return;
470  }
471  if (!atlas) {
472  Dart_ThrowException(
473  ToDart("Canvas.drawAtlas or Canvas.drawRawAtlas called with "
474  "non-genuine Image."));
475  return;
476  }
477 
478  sk_sp<SkImage> skImage = atlas->image();
479 
480  static_assert(sizeof(SkRSXform) == sizeof(float) * 4,
481  "SkRSXform doesn't use floats.");
482  static_assert(sizeof(SkRect) == sizeof(float) * 4,
483  "SkRect doesn't use floats.");
484 
485  auto sampling = ImageFilter::SamplingFromIndex(filterQualityIndex);
486 
487  canvas_->drawAtlas(
488  skImage.get(), reinterpret_cast<const SkRSXform*>(transforms.data()),
489  reinterpret_cast<const SkRect*>(rects.data()),
490  reinterpret_cast<const SkColor*>(colors.data()),
491  rects.num_elements() / 4, // SkRect have four floats.
492  blend_mode, sampling, reinterpret_cast<const SkRect*>(cull_rect.data()),
493  paint.paint());
494 }
static SkSamplingOptions SamplingFromIndex(int filterQualityIndex)
Definition: image_filter.cc:50
Dart_Handle ToDart(const T &object)
constexpr SkColor colors[]

◆ drawCircle()

void flutter::Canvas::drawCircle ( double  x,
double  y,
double  radius,
const Paint paint,
const PaintData paint_data 
)

Definition at line 277 of file canvas.cc.

References flutter::Paint::paint().

281  {
282  if (!canvas_) {
283  return;
284  }
285  canvas_->drawCircle(x, y, radius, *paint.paint());
286 }

◆ drawColor()

void flutter::Canvas::drawColor ( SkColor  color,
SkBlendMode  blend_mode 
)

Definition at line 208 of file canvas.cc.

208  {
209  if (!canvas_) {
210  return;
211  }
212  canvas_->drawColor(color, blend_mode);
213 }

◆ drawDRRect()

void flutter::Canvas::drawDRRect ( const RRect outer,
const RRect inner,
const Paint paint,
const PaintData paint_data 
)

Definition at line 255 of file canvas.cc.

References flutter::Paint::paint(), and flutter::RRect::sk_rrect.

258  {
259  if (!canvas_) {
260  return;
261  }
262  canvas_->drawDRRect(outer.sk_rrect, inner.sk_rrect, *paint.paint());
263 }

◆ drawImage()

void flutter::Canvas::drawImage ( const CanvasImage image,
double  x,
double  y,
const Paint paint,
const PaintData paint_data,
int  filterQualityIndex 
)

Definition at line 319 of file canvas.cc.

References flutter::CanvasImage::image(), flutter::Paint::paint(), flutter::ImageFilter::SamplingFromIndex(), and tonic::ToDart().

324  {
325  if (!canvas_) {
326  return;
327  }
328  if (!image) {
329  Dart_ThrowException(
330  ToDart("Canvas.drawImage called with non-genuine Image."));
331  return;
332  }
333  auto sampling = ImageFilter::SamplingFromIndex(filterQualityIndex);
334  canvas_->drawImage(image->image(), x, y, sampling, paint.paint());
335 }
static SkSamplingOptions SamplingFromIndex(int filterQualityIndex)
Definition: image_filter.cc:50
Dart_Handle ToDart(const T &object)

◆ drawImageNine()

void flutter::Canvas::drawImageNine ( const CanvasImage image,
double  center_left,
double  center_top,
double  center_right,
double  center_bottom,
double  dst_left,
double  dst_top,
double  dst_right,
double  dst_bottom,
const Paint paint,
const PaintData paint_data,
int  bitmapSamplingIndex 
)

Definition at line 364 of file canvas.cc.

References flutter::ImageFilter::FilterModeFromIndex(), flutter::CanvasImage::image(), flutter::DisplayListCanvasRecorder::kImageOpType, flutter::Paint::paint(), and tonic::ToDart().

375  {
376  if (!canvas_) {
377  return;
378  }
379  if (!image) {
380  Dart_ThrowException(
381  ToDart("Canvas.drawImageNine called with non-genuine Image."));
382  return;
383  }
384  SkRect center =
385  SkRect::MakeLTRB(center_left, center_top, center_right, center_bottom);
386  SkIRect icenter;
387  center.round(&icenter);
388  SkRect dst = SkRect::MakeLTRB(dst_left, dst_top, dst_right, dst_bottom);
389  auto filter = ImageFilter::FilterModeFromIndex(bitmapSamplingIndex);
390  if (display_list_recorder_) {
391  // SkCanvas turns a simple 2-rect DrawImageNine operation into a
392  // drawImageLattice operation which has arrays to allocate and
393  // pass along. For simplicity, we will bypass the canvas and ask
394  // the recorder to record our paint attributes and record a much
395  // simpler DrawImageNineOp record directly.
396  display_list_recorder_->RecordPaintAttributes(
398  builder()->drawImageNine(image->image(), icenter, dst, filter, true);
399  } else {
400  canvas_->drawImageNine(image->image().get(), icenter, dst, filter,
401  paint.paint());
402  }
403 }
static SkFilterMode FilterModeFromIndex(int index)
Definition: image_filter.cc:60
Dart_Handle ToDart(const T &object)

◆ drawImageRect()

void flutter::Canvas::drawImageRect ( const CanvasImage image,
double  src_left,
double  src_top,
double  src_right,
double  src_bottom,
double  dst_left,
double  dst_top,
double  dst_right,
double  dst_bottom,
const Paint paint,
const PaintData paint_data,
int  filterQualityIndex 
)

Definition at line 337 of file canvas.cc.

References flutter::CanvasImage::image(), flutter::Paint::paint(), flutter::ImageFilter::SamplingFromIndex(), and tonic::ToDart().

348  {
349  if (!canvas_) {
350  return;
351  }
352  if (!image) {
353  Dart_ThrowException(
354  ToDart("Canvas.drawImageRect called with non-genuine Image."));
355  return;
356  }
357  SkRect src = SkRect::MakeLTRB(src_left, src_top, src_right, src_bottom);
358  SkRect dst = SkRect::MakeLTRB(dst_left, dst_top, dst_right, dst_bottom);
359  auto sampling = ImageFilter::SamplingFromIndex(filterQualityIndex);
360  canvas_->drawImageRect(image->image(), src, dst, sampling, paint.paint(),
361  SkCanvas::kFast_SrcRectConstraint);
362 }
static SkSamplingOptions SamplingFromIndex(int filterQualityIndex)
Definition: image_filter.cc:50
Dart_Handle ToDart(const T &object)

◆ drawLine()

void flutter::Canvas::drawLine ( double  x1,
double  y1,
double  x2,
double  y2,
const Paint paint,
const PaintData paint_data 
)

Definition at line 215 of file canvas.cc.

References flutter::Paint::paint().

220  {
221  if (!canvas_) {
222  return;
223  }
224  canvas_->drawLine(x1, y1, x2, y2, *paint.paint());
225 }

◆ drawOval()

void flutter::Canvas::drawOval ( double  left,
double  top,
double  right,
double  bottom,
const Paint paint,
const PaintData paint_data 
)

Definition at line 265 of file canvas.cc.

References flutter::Paint::paint().

270  {
271  if (!canvas_) {
272  return;
273  }
274  canvas_->drawOval(SkRect::MakeLTRB(left, top, right, bottom), *paint.paint());
275 }

◆ drawPaint()

void flutter::Canvas::drawPaint ( const Paint paint,
const PaintData paint_data 
)

Definition at line 227 of file canvas.cc.

References flutter::Paint::paint().

227  {
228  if (!canvas_) {
229  return;
230  }
231  canvas_->drawPaint(*paint.paint());
232 }

◆ drawPath()

void flutter::Canvas::drawPath ( const CanvasPath path,
const Paint paint,
const PaintData paint_data 
)

Definition at line 305 of file canvas.cc.

References flutter::Paint::paint(), flutter::CanvasPath::path(), and tonic::ToDart().

307  {
308  if (!canvas_) {
309  return;
310  }
311  if (!path) {
312  Dart_ThrowException(
313  ToDart("Canvas.drawPath called with non-genuine Path."));
314  return;
315  }
316  canvas_->drawPath(path->path(), *paint.paint());
317 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
Dart_Handle ToDart(const T &object)

◆ drawPicture()

void flutter::Canvas::drawPicture ( Picture picture)

Definition at line 405 of file canvas.cc.

References flutter::Picture::display_list(), FML_DCHECK, flutter::Picture::picture(), and tonic::ToDart().

405  {
406  if (!canvas_) {
407  return;
408  }
409  if (!picture) {
410  Dart_ThrowException(
411  ToDart("Canvas.drawPicture called with non-genuine Picture."));
412  return;
413  }
414  if (picture->picture()) {
415  canvas_->drawPicture(picture->picture().get());
416  } else if (picture->display_list()) {
417  if (display_list_recorder_) {
418  builder()->drawDisplayList(picture->display_list());
419  } else {
420  picture->display_list()->RenderTo(canvas_);
421  }
422  } else {
423  FML_DCHECK(false);
424  }
425 }
#define FML_DCHECK(condition)
Definition: logging.h:86
Dart_Handle ToDart(const T &object)

◆ drawPoints()

void flutter::Canvas::drawPoints ( const Paint paint,
const PaintData paint_data,
SkCanvas::PointMode  point_mode,
const tonic::Float32List &  points 
)

Definition at line 427 of file canvas.cc.

References flutter::Paint::paint().

430  {
431  if (!canvas_) {
432  return;
433  }
434 
435  static_assert(sizeof(SkPoint) == sizeof(float) * 2,
436  "SkPoint doesn't use floats.");
437 
438  canvas_->drawPoints(point_mode,
439  points.num_elements() / 2, // SkPoints have two floats.
440  reinterpret_cast<const SkPoint*>(points.data()),
441  *paint.paint());
442 }

◆ drawRect()

void flutter::Canvas::drawRect ( double  left,
double  top,
double  right,
double  bottom,
const Paint paint,
const PaintData paint_data 
)

Definition at line 234 of file canvas.cc.

References flutter::Paint::paint().

239  {
240  if (!canvas_) {
241  return;
242  }
243  canvas_->drawRect(SkRect::MakeLTRB(left, top, right, bottom), *paint.paint());
244 }

◆ drawRRect()

void flutter::Canvas::drawRRect ( const RRect rrect,
const Paint paint,
const PaintData paint_data 
)

Definition at line 246 of file canvas.cc.

References flutter::Paint::paint(), and flutter::RRect::sk_rrect.

248  {
249  if (!canvas_) {
250  return;
251  }
252  canvas_->drawRRect(rrect.sk_rrect, *paint.paint());
253 }

◆ drawShadow()

void flutter::Canvas::drawShadow ( const CanvasPath path,
SkColor  color,
double  elevation,
bool  transparentOccluder 
)

Definition at line 496 of file canvas.cc.

References flutter::UIDartState::Current(), flutter::ViewportMetrics::device_pixel_ratio, flutter::PhysicalShapeLayer::DrawShadow(), flutter::PlatformConfiguration::get_window(), flutter::CanvasPath::path(), flutter::UIDartState::platform_configuration(), tonic::ToDart(), and flutter::Window::viewport_metrics().

499  {
500  if (!path) {
501  Dart_ThrowException(
502  ToDart("Canvas.drawShader called with non-genuine Path."));
503  return;
504  }
505  SkScalar dpr = UIDartState::Current()
507  ->get_window(0)
508  ->viewport_metrics()
510  if (display_list_recorder_) {
511  // The DrawShadow mechanism results in non-public operations to be
512  // performed on the canvas involving an SkDrawShadowRec. Since we
513  // cannot include the header that defines that structure, we cannot
514  // record an operation that it injects into an SkCanvas. To prevent
515  // that situation we bypass the canvas interface and inject the
516  // shadow parameters directly into the underlying DisplayList.
517  // See: https://bugs.chromium.org/p/skia/issues/detail?id=12125
518  builder()->drawShadow(path->path(), color, elevation, transparentOccluder,
519  dpr);
520  } else {
522  canvas_, path->path(), color, elevation, transparentOccluder, dpr);
523  }
524 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
PlatformConfiguration * platform_configuration() const
static void DrawShadow(SkCanvas *canvas, const SkPath &path, SkColor color, float elevation, bool transparentOccluder, SkScalar dpr)
Dart_Handle ToDart(const T &object)
Window * get_window(int window_id)
Retrieves the Window with the given ID managed by the PlatformConfiguration.
const ViewportMetrics & viewport_metrics() const
Definition: window.h:29
static UIDartState * Current()

◆ drawVertices()

void flutter::Canvas::drawVertices ( const Vertices vertices,
SkBlendMode  blend_mode,
const Paint paint,
const PaintData paint_data 
)

Definition at line 444 of file canvas.cc.

References flutter::Paint::paint(), tonic::ToDart(), and flutter::Vertices::vertices().

447  {
448  if (!canvas_) {
449  return;
450  }
451  if (!vertices) {
452  Dart_ThrowException(
453  ToDart("Canvas.drawVertices called with non-genuine Vertices."));
454  return;
455  }
456  canvas_->drawVertices(vertices->vertices(), blend_mode, *paint.paint());
457 }
Dart_Handle ToDart(const T &object)

◆ getSaveCount()

int flutter::Canvas::getSaveCount ( )

Definition at line 131 of file canvas.cc.

131  {
132  if (!canvas_) {
133  return 0;
134  }
135  return canvas_->getSaveCount();
136 }

◆ Invalidate()

void flutter::Canvas::Invalidate ( )

Definition at line 526 of file canvas.cc.

References tonic::DartWrappable::ClearDartWrapper(), and tonic::DartWrappable::dart_wrapper().

526  {
527  canvas_ = nullptr;
528  if (dart_wrapper()) {
530  }
531 }
Dart_WeakPersistentHandle dart_wrapper() const

◆ RegisterNatives()

void flutter::Canvas::RegisterNatives ( tonic::DartLibraryNatives natives)
static

Definition at line 70 of file canvas.cc.

References flutter::Canvas_constructor(), DART_REGISTER_NATIVE, and FOR_EACH_BINDING.

Referenced by flutter::DartUI::InitForGlobal().

70  {
71  natives->Register({{"Canvas_constructor", Canvas_constructor, 6, true},
73 }
#define FOR_EACH_BINDING(V)
Definition: canvas.cc:35
void Register(std::initializer_list< Entry > entries)
static void Canvas_constructor(Dart_NativeArguments args)
Definition: canvas.cc:28
#define DART_REGISTER_NATIVE(CLASS, METHOD)

◆ restore()

void flutter::Canvas::restore ( )

Definition at line 124 of file canvas.cc.

124  {
125  if (!canvas_) {
126  return;
127  }
128  canvas_->restore();
129 }

◆ rotate()

void flutter::Canvas::rotate ( double  radians)

Definition at line 152 of file canvas.cc.

152  {
153  if (!canvas_) {
154  return;
155  }
156  canvas_->rotate(radians * 180.0 / M_PI);
157 }

◆ save()

void flutter::Canvas::save ( )

Definition at line 96 of file canvas.cc.

96  {
97  if (!canvas_) {
98  return;
99  }
100  canvas_->save();
101 }

◆ saveLayer()

void flutter::Canvas::saveLayer ( double  left,
double  top,
double  right,
double  bottom,
const Paint paint,
const PaintData paint_data 
)

Definition at line 111 of file canvas.cc.

References flutter::Paint::paint().

116  {
117  if (!canvas_) {
118  return;
119  }
120  SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom);
121  canvas_->saveLayer(&bounds, paint.paint());
122 }

◆ saveLayerWithoutBounds()

void flutter::Canvas::saveLayerWithoutBounds ( const Paint paint,
const PaintData paint_data 
)

Definition at line 103 of file canvas.cc.

References flutter::Paint::paint().

104  {
105  if (!canvas_) {
106  return;
107  }
108  canvas_->saveLayer(nullptr, paint.paint());
109 }

◆ scale()

void flutter::Canvas::scale ( double  sx,
double  sy 
)

Definition at line 145 of file canvas.cc.

145  {
146  if (!canvas_) {
147  return;
148  }
149  canvas_->scale(sx, sy);
150 }

◆ skew()

void flutter::Canvas::skew ( double  sx,
double  sy 
)

Definition at line 159 of file canvas.cc.

159  {
160  if (!canvas_) {
161  return;
162  }
163  canvas_->skew(sx, sy);
164 }

◆ transform()

void flutter::Canvas::transform ( const tonic::Float64List &  matrix4)

Definition at line 166 of file canvas.cc.

166  {
167  if (!canvas_) {
168  return;
169  }
170  canvas_->concat(SkM44(matrix4[0], matrix4[4], matrix4[8], matrix4[12],
171  matrix4[1], matrix4[5], matrix4[9], matrix4[13],
172  matrix4[2], matrix4[6], matrix4[10], matrix4[14],
173  matrix4[3], matrix4[7], matrix4[11], matrix4[15]));
174 }

◆ translate()

void flutter::Canvas::translate ( double  dx,
double  dy 
)

Definition at line 138 of file canvas.cc.

138  {
139  if (!canvas_) {
140  return;
141  }
142  canvas_->translate(dx, dy);
143 }

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