MCPcopy Create free account
hub / github.com/Tencent/tgfx / onReadPixels

Method onReadPixels

src/platform/web/NativeCodec.cpp:88–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88bool NativeCodec::onReadPixels(ColorType colorType, AlphaType alphaType, size_t dstRowBytes,
89 void* dstPixels) const {
90 if (dstPixels == nullptr) {
91 return false;
92 }
93
94 auto data = val::module_property("tgfx").call<val>(
95 "readImagePixels", val::module_property("module"), nativeImage, width(), height());
96 auto imageData = CopyDataFromUint8Array(data);
97 if (imageData == nullptr) {
98 return false;
99 }
100 auto info = ImageInfo::Make(width(), height(), ColorType::RGBA_8888, AlphaType::Unpremultiplied);
101 auto dstInfo = ImageInfo::Make(width(), height(), colorType, alphaType, dstRowBytes);
102 Pixmap pixmap(info, imageData->data());
103 auto result = pixmap.readPixels(dstInfo, dstPixels);
104 return result;
105}
106
107std::shared_ptr<ImageBuffer> NativeCodec::onMakeBuffer(bool) const {
108 auto image = nativeImage;

Callers

nothing calls this directly

Calls 4

CopyDataFromUint8ArrayFunction · 0.85
MakeFunction · 0.85
dataMethod · 0.45
readPixelsMethod · 0.45

Tested by

no test coverage detected