21 {
22 if (argc != 2) {
24 return 1;
25 }
26
29 printf(
"Cannot open output file %s\n",
argv[1]);
30 return 1;
31 }
32
35 if (!ctx) {
36 printf(
"Could not make metal context\n");
37 return 1;
38 }
39 printf(
"Context made, now to make the surface\n");
40
43
47 printf(
"Could not make surface from Metal DirectContext\n");
48 return 1;
49 }
50
54
57 paint.setAntiAlias(
true);
58
60
62
63 printf(
"Drew to surface, now doing readback\n");
66 if (!jpeg) {
67 printf(
"Readback of pixels (or encoding) failed\n");
68 return 1;
69 }
72 return 0;
73}
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
GrSemaphoresSubmitted flush(const GrFlushInfo &info)
void clear(SkColor color)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
const void * data() const
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
GrMtlBackendContext GetMetalContext()
SK_API sk_sp< GrDirectContext > MakeMetal(const GrMtlBackendContext &, const GrContextOptions &)
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
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 SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)