Flutter Engine
The Flutter Engine
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 4 of file Image_RasterFromData.cpp.

4 {
5void draw(SkCanvas* canvas) {
10 image->readPixels(nullptr, dstInfo, data->writable_data(), rowBytes, 0, 0, SkImage::kAllow_CachingHint);
11 auto ii = dstInfo.makeColorType(kRGBA_8888_SkColorType);
12 sk_sp<SkImage> raw = SkImages::RasterFromData(ii, data, rowBytes);
13 canvas->drawImage(image, 0, 0);
14 canvas->drawImage(raw.get(), 128, 0);
15}
16} // 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)
Definition: SkImageInfo.cpp:16
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_API sk_sp< SkImage > RasterFromData(const SkImageInfo &info, sk_sp< SkData > pixels, size_t rowBytes)
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
SkImageInfo makeColorType(SkColorType newColorType) const
Definition: SkImageInfo.h:475
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63