Flutter Engine
 
Loading...
Searching...
No Matches
image.cc
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
6
7#include <algorithm>
8#include <limits>
10
11#if IMPELLER_SUPPORTS_RENDERING
13#endif
19
20namespace flutter {
21
22typedef CanvasImage Image;
23
24// Since _Image is a private class, we can't use IMPLEMENT_WRAPPERTYPEINFO
26const tonic::DartWrapperInfo& Image::dart_wrapper_info_ =
28
29CanvasImage::CanvasImage() = default;
30
32
34 Dart_Handle ui_lib = Dart_LookupLibrary(tonic::ToDart("dart:ui"));
35 return tonic::DartInvokeField(ui_lib, "_wrapImage", {ToDart(this)});
36}
37
38Dart_Handle CanvasImage::toByteData(int format, Dart_Handle callback) {
39 return EncodeImage(this, format, callback);
40}
41
43 image_.reset();
45}
46
48 if (image_->skia_image()) {
49 return ColorSpace::kSRGB;
50 } else if (image_->impeller_texture()) {
51#if IMPELLER_SUPPORTS_RENDERING
52 return ImageEncodingImpeller::GetColorSpace(image_->impeller_texture());
53#endif // IMPELLER_SUPPORTS_RENDERING
54 }
55 return ColorSpace::kSRGB;
56}
57
58} // namespace flutter
Dart_Handle toByteData(int format, Dart_Handle callback)
Definition image.cc:38
~CanvasImage() override
Dart_Handle CreateOuterWrapping()
Definition image.cc:33
static int GetColorSpace(const std::shared_ptr< impeller::Texture > &texture)
uint32_t uint32_t * format
FlutterDesktopBinaryReply callback
@ kSRGB
Definition image.h:17
static const tonic::DartWrapperInfo kDartWrapperInfoUIImage("ui", "_Image")
CanvasImage Image
Definition dart_ui.cc:51
Dart_Handle EncodeImage(CanvasImage *canvas_image, int format, Dart_Handle callback_handle)
Dart_Handle ToDart(const T &object)
Dart_Handle DartInvokeField(Dart_Handle target, const char *name, std::initializer_list< Dart_Handle > args)