319 {
320
323
324#if defined(SK_GRAPHITE)
326 isGPU = isGPU ||
SkToBool(recorder);
327#endif
328
329 if (!isGPU) {
332 }
333
334 auto render_image = [](
SkCanvas* canvas) {
345 };
346
347 static constexpr int kSize = 50;
354 render_image(&bmpCanvas);
355
356 std::function<sk_sp<SkImage>()> imageFactories[] = {
357
359
360 [&] {
364 },
365
366 [&] {
370 },
371
372 [&] {
376 render_image(canvas);
380 nullptr,
381 nullptr,
383 srgbColorSpace);
384 },
385
388 if (dContext) {
390 } else {
391#if defined(SK_GRAPHITE)
393#endif
394 }
395
397 return nullptr;
398 }
399 render_image(
surface->getCanvas());
400 return surface->makeImageSnapshot();
401 }};
402
405 for (const auto& factory : imageFactories) {
408 for (auto mm : { false, true }) {
410 if (dContext) {
415 } else {
416#if defined(SK_GRAPHITE)
418#endif
419 }
420 if (texImage) {
422 }
423 }
424 }
426 }
427
429}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERT_RELEASE(cond)
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
static constexpr bool SkToBool(const T &x)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
sk_sp< SkImage > asImage() const
const SkPixmap & pixmap() const
void translate(SkScalar dx, SkScalar dy)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
static sk_sp< SkColorSpace > MakeSRGB()
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
static constexpr char kErrorMsg_DrawSkippedGpuOnly[]
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_API sk_sp< SkImage > DeferredFromEncodedData(sk_sp< SkData > encoded, std::optional< SkAlphaType > alphaType=std::nullopt)
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
@ kU8
uses 8-bit unsigned int per color component
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)