Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
image.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_IMAGE_H_
6#define FLUTTER_LIB_UI_PAINTING_IMAGE_H_
7
10
11namespace flutter {
12
13// Must be kept in sync with painting.dart.
14enum class PixelFormat {
18 kRFloat32, // kLastPixelFormat
19};
20
22
23// Must be kept in sync with painting.dart.
28
29class CanvasImage final : public RefCountedDartWrappable<CanvasImage> {
30 DEFINE_WRAPPERTYPEINFO();
32
33 public:
34 ~CanvasImage() override;
35
37 return fml::MakeRefCounted<CanvasImage>();
38 }
39
40 Dart_Handle CreateOuterWrapping();
41
42 int width() { return image_ ? image_->width() : 0; }
43
44 int height() { return image_ ? image_->height() : 0; }
45
46 static void decodeImageFromPixelsSync(Dart_Handle pixels_handle,
47 uint32_t width,
48 uint32_t height,
49 int32_t pixel_format,
50 Dart_Handle raw_image_handle);
51
52 Dart_Handle toByteData(int format, Dart_Handle callback);
53
54 void dispose();
55
56 sk_sp<DlImage> image() const { return image_; }
57
58 void set_image(const sk_sp<DlImage>& image) {
59 FML_DCHECK(image->isUIThreadSafe());
60 image_ = image;
61 }
62
63 int colorSpace();
64
65 private:
67
68 sk_sp<DlImage> image_;
69};
70
71} // namespace flutter
72
73#endif // FLUTTER_LIB_UI_PAINTING_IMAGE_H_
Dart_Handle toByteData(int format, Dart_Handle callback)
Definition image.cc:36
static void decodeImageFromPixelsSync(Dart_Handle pixels_handle, uint32_t width, uint32_t height, int32_t pixel_format, Dart_Handle raw_image_handle)
Definition image.cc:160
sk_sp< DlImage > image() const
Definition image.h:56
~CanvasImage() override
static fml::RefPtr< CanvasImage > Create()
Definition image.h:36
Dart_Handle CreateOuterWrapping()
Definition image.cc:31
void set_image(const sk_sp< DlImage > &image)
Definition image.h:58
FlutterDesktopBinaryReply callback
#define FML_DCHECK(condition)
Definition logging.h:122
constexpr PixelFormat kLastPixelFormat
Definition image.h:21
ColorSpace
Definition image.h:24
@ kExtendedSRGB
Definition image.h:26
@ kSRGB
Definition image.h:25
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition formats.h:99
#define FML_FRIEND_MAKE_REF_COUNTED(T)