34 {
36
37 if (FLAGS_input.isEmpty() || FLAGS_output.isEmpty()) {
38 std::cerr << "Missing required 'input' and 'output' args.\n";
39 return 1;
40 }
41
42 if (FLAGS_width <= 0 || FLAGS_height <= 0) {
43 std::cerr << "Invalid width/height.\n";
44 return 1;
45 }
46
48 if (!in.isValid()) {
49 std::cerr << "Could not open " << FLAGS_input[0] << "\n";
50 return 1;
51 }
52
53
54#if defined(SK_BUILD_FOR_MAC)
56#else
58#endif
59
61
65 predecode,
67
70 .setResourceProvider(std::move(rp))
72 .make(in);
73
74 if (!svg_dom) {
75 std::cerr << "Could not parse " << FLAGS_input[0] << "\n";
76 return 1;
77 }
78
80
81 svg_dom->setContainerSize(
SkSize::Make(FLAGS_width, FLAGS_height));
82 svg_dom->render(
surface->getCanvas());
83
86
89 std::cerr << "Could not open " << FLAGS_output[0] << " for writing.\n";
90 return 1;
91 }
92
93
95
97 std::cerr << "PNG encoding failed.\n";
98 return 1;
99 }
100
101 return 0;
102}
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Custom_Empty()
SK_API sk_sp< SkFontMgr > SkFontMgr_New_CoreText(CTFontCollectionRef)
static void Parse(int argc, const char *const *argv)
static SkString Dirname(const char *fullPath)
static sk_sp< DataURIResourceProviderProxy > Make(sk_sp< ResourceProvider > rp, ImageDecodeStrategy=ImageDecodeStrategy::kLazyDecode, sk_sp< const SkFontMgr > fontMgr=nullptr)
static sk_sp< FileResourceProvider > Make(SkString base_dir, ImageDecodeStrategy=ImageDecodeStrategy::kLazyDecode)
sk_sp< SkFontMgr > fontMgr
void RegisterAllAvailable()
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
sk_sp< Factory > BestAvailable()
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DlVertices::Builder Builder
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkSize Make(SkScalar w, SkScalar h)