34 resource =
"images/grayscale.jpg";
43 resource =
"images/color_wheel.jpg";
47 :
"images/rainbow-gradient.png";
59 return surface->makeImageSnapshot();
140 if (fQuality < 100) {
171 using INHERITED =
GM;
175#define DEF_ENCODE_GM(format, quality, variant, name) \
176 static skiagm::GMRegistry SK_MACRO_CONCAT(SK_MACRO_APPEND_LINE(REG_), variant)(\
177 [](){return std::unique_ptr<skiagm::GM>([](){\
178 return new EncodeColorTypesGM(format, quality, Variant::variant, name);\
181#define DEF_VARIANTS(format, quality, name) \
182 DEF_ENCODE_GM(format, quality, kNormal, name); \
183 DEF_ENCODE_GM(format, quality, kOpaque, name); \
184 DEF_ENCODE_GM(format, quality, kGray, name);
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERT_RELEASE(cond)
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SK_API SkString static SkString SkStringPrintf()
void translate(SkScalar dx, SkScalar dy)
SkImageInfo imageInfo() const
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
sk_sp< SkColorSpace > refColorSpace() const
SkString getName() const override
SkISize getISize() override
DrawResult onDraw(SkCanvas *canvas, SkString *errorMsg) override
EncodeColorTypesGM(SkEncodedImageFormat format, int quality, Variant variant, const char *name)
#define DEF_VARIANTS(format, quality, name)
uint32_t uint32_t * format
static sk_sp< SkImage > make_image()
SK_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
static const int imageHeight
static const int imageWidth
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkColorType colorType() const