Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
Image_RasterFromData.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Image_RasterFromData, 256, 256, false, 3)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Image_RasterFromData  ,
256  ,
256  ,
false  ,
 
)

Definition at line 5 of file Image_RasterFromData.cpp.

5 {
6void draw(SkCanvas* canvas) {
11 image->readPixels(nullptr, dstInfo, data->writable_data(), rowBytes, 0, 0, SkImage::kAllow_CachingHint);
12 auto ii = dstInfo.makeColorType(kRGBA_8888_SkColorType);
13 sk_sp<SkImage> raw = SkImages::RasterFromData(ii, data, rowBytes);
14 canvas->drawImage(image, 0, 0);
15 canvas->drawImage(raw.get(), 128, 0);
16}
17} // END FIDDLE
@ 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
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
static sk_sp< SkData > MakeUninitialized(size_t length)
Definition SkData.cpp:116
bool readPixels(GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
Definition SkImage.cpp:42
int width() const
Definition SkImage.h:285
int height() const
Definition SkImage.h:291
@ kAllow_CachingHint
allows internally caching decoded and copied pixels
Definition SkImage.h:464
T * get() const
Definition SkRefCnt.h:303
sk_sp< SkImage > image
Definition examples.cpp:29
SK_API sk_sp< SkImage > RasterFromData(const SkImageInfo &info, sk_sp< SkData > pixels, size_t rowBytes)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
SkImageInfo makeColorType(SkColorType newColorType) const