Flutter Engine
The 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 "flutter/display_list/display_list.h"
9#include "flutter/display_list/dl_op_flags.h"
12
13namespace flutter {
14
15class Paint {
16 public:
17 Paint() = default;
18 Paint(Dart_Handle paint_objects, Dart_Handle paint_data);
19
20 const DlPaint* paint(DlPaint& paint,
21 const DisplayListAttributeFlags& flags) const;
22
23 void toDlPaint(DlPaint& paint) const;
24
25 bool isNull() const { return Dart_IsNull(paint_data_); }
26 bool isNotNull() const { return !Dart_IsNull(paint_data_); }
27
28 private:
29 friend struct tonic::DartConverter<Paint>;
30
31 Dart_Handle paint_objects_;
32 Dart_Handle paint_data_;
33};
34
35// The PaintData argument is a placeholder to receive encoded data for Paint
36// objects. The data is actually processed by DartConverter<Paint>, which reads
37// both at the given index and at the next index (which it assumes is a byte
38// data for a Paint object).
39class PaintData {};
40
41} // namespace flutter
42
43namespace tonic {
44
45template <>
47 static flutter::Paint FromArguments(Dart_NativeArguments args,
48 int index,
49 Dart_Handle& exception);
50};
51
52template <>
53struct DartConverter<flutter::PaintData> {
54 static flutter::PaintData FromArguments(Dart_NativeArguments args,
55 int index,
56 Dart_Handle& exception);
57};
58
59} // namespace tonic
60
61#endif // FLUTTER_LIB_UI_PAINTING_PAINT_H_
Paint()=default
void toDlPaint(DlPaint &paint) const
Definition: paint.cc:191
bool isNotNull() const
Definition: paint.h:26
bool isNull() const
Definition: paint.h:25
const DlPaint * paint(DlPaint &paint, const DisplayListAttributeFlags &flags) const
Definition: paint.cc:64
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
struct _Dart_NativeArguments * Dart_NativeArguments
Definition: dart_api.h:3019
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args