Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
path_measure.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_UI_PAINTING_PATH_MEASURE_H_
6#define FLUTTER_LIB_UI_PAINTING_PATH_MEASURE_H_
7
8#include <vector>
9
10#include "flutter/lib/ui/dart_wrapper.h"
11#include "flutter/lib/ui/painting/path.h"
15
16// Be sure that the client doesn't modify a path on us before Skia finishes
17// See AOSP's reasoning in PathMeasure.cpp
18
19namespace flutter {
20
21class CanvasPathMeasure : public RefCountedDartWrappable<CanvasPathMeasure> {
22 DEFINE_WRAPPERTYPEINFO();
23 FML_FRIEND_MAKE_REF_COUNTED(CanvasPathMeasure);
24
25 public:
26 ~CanvasPathMeasure() override;
27 static void Create(Dart_Handle wrapper,
28 const CanvasPath* path,
29 bool forceClosed);
30
31 void setPath(const CanvasPath* path, bool isClosed);
32 double getLength(int contour_index);
33 tonic::Float32List getPosTan(int contour_index, double distance);
34 void getSegment(Dart_Handle path_handle,
35 int contour_index,
36 double start_d,
37 double stop_d,
38 bool start_with_move_to);
39 bool isClosed(int contour_index);
40 bool nextContour();
41
42 const SkContourMeasureIter& pathMeasure() const { return *path_measure_; }
43
44 private:
46
47 std::unique_ptr<SkContourMeasureIter> path_measure_;
48 std::vector<sk_sp<SkContourMeasure>> measures_;
49};
50
51} // namespace flutter
52
53#endif // FLUTTER_LIB_UI_PAINTING_PATH_MEASURE_H_
bool isClosed(int contour_index)
void setPath(const CanvasPath *path, bool isClosed)
Definition: path_measure.cc:44
void getSegment(Dart_Handle path_handle, int contour_index, double start_d, double stop_d, bool start_with_move_to)
Definition: path_measure.cc:82
const SkContourMeasureIter & pathMeasure() const
Definition: path_measure.h:42
double getLength(int contour_index)
Definition: path_measure.cc:49
static void Create(Dart_Handle wrapper, const CanvasPath *path, bool forceClosed)
Definition: path_measure.cc:23
tonic::Float32List getPosTan(int contour_index, double distance)
Definition: path_measure.cc:57
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
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