diff options
author | Hal Canary <halcanary@google.com> | 2016-11-14 10:36:24 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-14 15:39:09 +0000 |
commit | c6ca9511ca06587f29ce2ddecf814ce440fc1773 (patch) | |
tree | b7437e7316ce159478807e93d23308926b6d63ae /experimental/xps_to_png | |
parent | b0d10e05f1054a86a00b42d9089b53d779f8d01e (diff) |
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 <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'experimental/xps_to_png')
-rw-r--r-- | experimental/xps_to_png/xps_to_png.cs | 19 |
1 files changed, 16 insertions, 3 deletions
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<string> xpsFiles = + new System.Collections.Generic.List<string>(); 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(); } |