From: Hal Canary Date: Mon, 14 Nov 2016 15:36:24 +0000 (-0500) Subject: experimental/xps_to_png: pass in DPI as program argument X-Git-Tag: submit/tizen/20180928.044319~73^2~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6ca9511ca06587f29ce2ddecf814ce440fc1773;p=platform%2Fupstream%2FlibSkiaSharp.git experimental/xps_to_png: pass in DPI as program argument NOTRY=true Change-Id: Ieb4f43c69a4f185d8e7877c9c736bd6a7d7b1eac Reviewed-on: https://skia-review.googlesource.com/4761 Reviewed-by: Hal Canary Commit-Queue: Hal Canary --- diff --git a/experimental/xps_to_png/xps_to_png.cs b/experimental/xps_to_png/xps_to_png.cs index 34b913246d..738e0fc17e 100644 --- a/experimental/xps_to_png/xps_to_png.cs +++ b/experimental/xps_to_png/xps_to_png.cs @@ -79,14 +79,27 @@ class Program { } // For each command line argument, convert xps to sequence of pngs. static void Main(string[] args) { - const double dpi = 72.0; + double dpi = 72.0; if (args.Length == 0) { - System.Console.WriteLine("usage:\n\txps_to_png [XPS_FILES]\n\n"); + System.Console.WriteLine("usage:\n\txps_to_png [-dDPI] [XPS_FILES]\n\n"); System.Environment.Exit(1); } + System.Collections.Generic.List xpsFiles = + new System.Collections.Generic.List(); foreach (string arg in args) { + string flag = "-d"; + if (arg.StartsWith(flag)) { + dpi = System.Convert.ToDouble(arg.Remove(0, flag.Length)); + } else if (System.IO.File.Exists(arg)) { + xpsFiles.Add(arg); + } else { + System.Console.WriteLine("file missing: '" + arg + "'\n\n"); + System.Environment.Exit(1); + } + } + foreach (string file in xpsFiles) { System.Threading.Thread t = new System.Threading.Thread( - () => try_convert(dpi, arg, arg)); + () => try_convert(dpi, file, file)); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); }