Skip to content

Commit

Permalink
add png output option
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Jun 11, 2018
1 parent 8f8956b commit d32cede
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ obj
/Native/windows
Samples/CSharp/SineWaves/SineWaves.svg
.vscode/launch.json
Samples/CSharp/SineWaves/SineWaves.png
14 changes: 11 additions & 3 deletions Samples/CSharp/SineWaves/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,16 @@ private static void Main(string[] args)
var pl = new PLStream();

// use SVG backend and write to SineWaves.svg in current directory
pl.sdev("svg");
pl.sfnam("SineWaves.svg");
if (args.Length == 1 && args[0] == "svg")
{
pl.sdev("svg");
pl.sfnam("SineWaves.svg");
}
else
{
pl.sdev("pngcairo");
pl.sfnam("SineWaves.png");
}

// use white background with black foreground
pl.spal0("cmap0_alternate.pal");
Expand Down Expand Up @@ -89,7 +97,7 @@ private static void Main(string[] args)
pl.col0(4);
pl.line(x3, y3);

// end page (writes SVG to disk)
// end page (writes output to disk)
pl.eop();

// output version
Expand Down

0 comments on commit d32cede

Please sign in to comment.