Flutter Engine
paint.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_PAINT_H_
6 #define FLUTTER_LIB_UI_PAINTING_PAINT_H_
7 
8 #include "third_party/skia/include/core/SkPaint.h"
10 
11 namespace flutter {
12 
13 class Paint {
14  public:
15  Paint() = default;
16  Paint(Dart_Handle paint_objects, Dart_Handle paint_data);
17 
18  const SkPaint* paint() const { return is_null_ ? nullptr : &paint_; }
19 
20  private:
21  friend struct tonic::DartConverter<Paint>;
22 
23  SkPaint paint_;
24  bool is_null_ = true;
25 };
26 
27 // The PaintData argument is a placeholder to receive encoded data for Paint
28 // objects. The data is actually processed by DartConverter<Paint>, which reads
29 // both at the given index and at the next index (which it assumes is a byte
30 // data for a Paint object).
31 class PaintData {};
32 
33 } // namespace flutter
34 
35 namespace tonic {
36 
37 template <>
39  static flutter::Paint FromArguments(Dart_NativeArguments args,
40  int index,
41  Dart_Handle& exception);
42 };
43 
44 template <>
45 struct DartConverter<flutter::PaintData> {
46  static flutter::PaintData FromArguments(Dart_NativeArguments args,
47  int index,
48  Dart_Handle& exception);
49 };
50 
51 } // namespace tonic
52 
53 #endif // FLUTTER_LIB_UI_PAINTING_PAINT_H_
G_BEGIN_DECLS FlValue * args
const SkPaint * paint() const
Definition: paint.h:18
Paint()=default