Flutter Engine
The Flutter Engine
picture.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_PICTURE_H_
6#define FLUTTER_LIB_UI_PAINTING_PICTURE_H_
7
8#include "flutter/display_list/display_list.h"
9#include "flutter/flow/layers/layer_tree.h"
10#include "flutter/lib/ui/dart_wrapper.h"
11#include "flutter/lib/ui/painting/image.h"
12#include "flutter/lib/ui/ui_dart_state.h"
13
14namespace flutter {
15class Canvas;
16
17class Picture : public RefCountedDartWrappable<Picture> {
18 DEFINE_WRAPPERTYPEINFO();
19 FML_FRIEND_MAKE_REF_COUNTED(Picture);
20
21 public:
22 ~Picture() override;
24 Dart_Handle dart_handle,
26
27 sk_sp<DisplayList> display_list() const { return display_list_; }
28
29 Dart_Handle toImage(uint32_t width,
30 uint32_t height,
31 Dart_Handle raw_image_callback);
32
33 void toImageSync(uint32_t width,
34 uint32_t height,
35 Dart_Handle raw_image_handle);
36
37 void dispose();
38
39 size_t GetAllocationSize() const;
40
42 uint32_t width,
43 uint32_t height,
44 Dart_Handle raw_image_handle);
45
47 uint32_t width,
48 uint32_t height,
49 Dart_Handle raw_image_callback);
50
52 std::unique_ptr<LayerTree> layer_tree,
53 Dart_Handle raw_image_callback);
54
55 // Callers may provide either a display list or a layer tree, but not both.
56 //
57 // If a layer tree is provided, it will be flattened on the raster thread, and
58 // picture_bounds should be the layer tree's frame_size().
60 std::unique_ptr<LayerTree> layer_tree,
61 uint32_t width,
62 uint32_t height,
63 Dart_Handle raw_image_callback);
64
65 private:
67
68 sk_sp<DisplayList> display_list_;
69};
70
71} // namespace flutter
72
73#endif // FLUTTER_LIB_UI_PAINTING_PICTURE_H_
~Picture() override
sk_sp< DisplayList > display_list() const
Definition: picture.h:27
static void CreateAndAssociateWithDartWrapper(Dart_Handle dart_handle, sk_sp< DisplayList > display_list)
Definition: picture.cc:29
Dart_Handle toImage(uint32_t width, uint32_t height, Dart_Handle raw_image_callback)
Definition: picture.cc:42
void dispose()
Definition: picture.cc:108
static Dart_Handle RasterizeLayerTreeToImage(std::unique_ptr< LayerTree > layer_tree, Dart_Handle raw_image_callback)
Definition: picture.cc:129
size_t GetAllocationSize() const
Definition: picture.cc:113
void toImageSync(uint32_t width, uint32_t height, Dart_Handle raw_image_handle)
Definition: picture.cc:51
static Dart_Handle DoRasterizeToImage(const sk_sp< DisplayList > &display_list, std::unique_ptr< LayerTree > layer_tree, uint32_t width, uint32_t height, Dart_Handle raw_image_callback)
Definition: picture.cc:138
static Dart_Handle RasterizeToImage(const sk_sp< DisplayList > &display_list, uint32_t width, uint32_t height, Dart_Handle raw_image_callback)
Definition: picture.cc:121
static void RasterizeToImageSync(sk_sp< DisplayList > display_list, uint32_t width, uint32_t height, Dart_Handle raw_image_handle)
Definition: picture.cc:87
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
int32_t height
int32_t width