Flutter Engine
The Flutter Engine
Classes | Functions
image.cpp File Reference
#include "export.h"
#include "skwasm_support.h"
#include "surface.h"
#include "wrappers.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/gpu/GpuTypes.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/ganesh/GrExternalTextureGenerator.h"
#include "third_party/skia/include/gpu/ganesh/SkImageGanesh.h"
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
#include "third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <emscripten/html5_webgl.h>

Go to the source code of this file.

Classes

class  TextureSourceImageGenerator
 

Functions

SKWASM_EXPORT SkImageimage_createFromPicture (SkPicture *picture, int32_t width, int32_t height)
 
SKWASM_EXPORT SkImageimage_createFromPixels (SkData *data, int width, int height, PixelFormat pixelFormat, size_t rowByteCount)
 
SKWASM_EXPORT SkImageimage_createFromTextureSource (SkwasmObject textureSource, int width, int height, Skwasm::Surface *surface)
 
SKWASM_EXPORT void image_ref (SkImage *image)
 
SKWASM_EXPORT void image_dispose (SkImage *image)
 
SKWASM_EXPORT int image_getWidth (SkImage *image)
 
SKWASM_EXPORT int image_getHeight (SkImage *image)
 

Function Documentation

◆ image_createFromPicture()

SKWASM_EXPORT SkImage * image_createFromPicture ( SkPicture picture,
int32_t  width,
int32_t  height 
)

Definition at line 116 of file image.cpp.

118 {
119 return DeferredFromPicture(sk_ref_sp<SkPicture>(picture), {width, height},
120 nullptr, nullptr, BitDepth::kU8,
122 .release();
123}
static sk_sp< SkColorSpace > MakeSRGB()
SK_API sk_sp< SkImage > DeferredFromPicture(sk_sp< SkPicture > picture, const SkISize &dimensions, const SkMatrix *matrix, const SkPaint *paint, BitDepth bitDepth, sk_sp< SkColorSpace > colorSpace, SkSurfaceProps props)
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
int32_t height
int32_t width

◆ image_createFromPixels()

SKWASM_EXPORT SkImage * image_createFromPixels ( SkData data,
int  width,
int  height,
PixelFormat  pixelFormat,
size_t  rowByteCount 
)

Definition at line 125 of file image.cpp.

129 {
132 colorTypeForPixelFormat(pixelFormat),
133 alphaTypeForPixelFormat(pixelFormat),
135 sk_ref_sp(data), rowByteCount)
136 .release();
137}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
T * release()
Definition: SkRefCnt.h:324
SK_API sk_sp< SkImage > RasterFromData(const SkImageInfo &info, sk_sp< SkData > pixels, size_t rowBytes)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ image_createFromTextureSource()

SKWASM_EXPORT SkImage * image_createFromTextureSource ( SkwasmObject  textureSource,
int  width,
int  height,
Skwasm::Surface surface 
)

Definition at line 139 of file image.cpp.

142 {
144 std::unique_ptr<TextureSourceImageGenerator>(
149 textureSource, surface)))
150 .release();
151}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
VkSurfaceKHR surface
Definition: main.cc:49
SK_API sk_sp< SkImage > DeferredFromTextureGenerator(std::unique_ptr< GrTextureGenerator > gen)

◆ image_dispose()

SKWASM_EXPORT void image_dispose ( SkImage image)

Definition at line 157 of file image.cpp.

157 {
158 image->unref();
159}
void unref() const
Definition: SkRefCnt.h:72
sk_sp< const SkImage > image
Definition: SkRecords.h:269

◆ image_getHeight()

SKWASM_EXPORT int image_getHeight ( SkImage image)

Definition at line 165 of file image.cpp.

165 {
166 return image->height();
167}
int height() const
Definition: SkImage.h:291

◆ image_getWidth()

SKWASM_EXPORT int image_getWidth ( SkImage image)

Definition at line 161 of file image.cpp.

161 {
162 return image->width();
163}
int width() const
Definition: SkImage.h:285

◆ image_ref()

SKWASM_EXPORT void image_ref ( SkImage image)

Definition at line 153 of file image.cpp.

153 {
154 image->ref();
155}
void ref() const
Definition: SkRefCnt.h:62