Commit 56423634 authored by Peter Billam's avatar Peter Billam

1.2 introduce the -f Flip option

parent 2d179ada
......@@ -5,7 +5,7 @@
-- This script is free software; you can redistribute it and/or --
-- modify it under the same terms as Lua5 itself. --
---------------------------------------------------------------------
local Version = '1.1 for Lua5'
local Version = '1.2 for Lua5'
local VersionDate = '27jun2018';
local Synopsis = [[
fen2img [-w 350] \
......@@ -19,6 +19,7 @@ perldoc fen2img # read the manual :-)
local FEN = require 'chess.fen'
Width = 400;
Flip = 'false'
local function which(s)
local f
......@@ -41,10 +42,9 @@ local iarg=1; while arg[iarg] ~= nil do
local n = string.gsub(arg[0],"^.*/","",1)
print(n.." version "..Version.." "..VersionDate)
os.exit(0)
-- elseif first_letter == 'd' then
-- iarg = iarg + 1
-- Display = which('display')
-- if not Display then die("-d given but can't find display in $PATH") end
elseif first_letter == 'f' then
-- iarg = iarg + 1
Flip = 'true'
elseif first_letter == 'w' then
iarg = iarg + 1
Width = tonumber( arg[iarg] )
......@@ -364,7 +364,7 @@ table.insert(PS_sections, [[
%%EndProlog
]])
table.insert(PS_sections, '('..Fenstr..') false fen2board\n')
table.insert(PS_sections, '('..Fenstr..') '..Flip..' fen2board\n')
table.insert(PS_sections, '%%EOF\n')
if Device == 'eps' then
......@@ -406,6 +406,7 @@ fen2img - Creates a .png or .jpg diagram of a chess position in FEN
fen2img -w 500 "$FEN" /tmp/t.png
fen2img -w 500 "$FEN" /tmp/t.eps
fen2img -w 500 "$FEN" - | display - # pipes into display as a .png
fen2img -w 500 "$FEN" -f - | display - # flip the display
=head1 DESCRIPTION
......@@ -420,6 +421,10 @@ to convert into C<.jpg> or C<.png> format.
=over 3
=item I<-f>
The board will be displayed B<F>lipped, ie: from Black's point of view.
=item I<-w 500>
This option sets the B<W>idth in pixels of the C<.jpg> or C<.png> image,
......@@ -458,6 +463,7 @@ which you move into C</usr/share/fonts/truetype/>
=head1 CHANGES
20180627 1.2 introduce the -f Flip option
20180627 1.1 allows output on stdout, for piping into display
20180411 1.0 first working version
......
......@@ -52,7 +52,8 @@ CONTENT="PostScript, chess, FEN, pgn, jpg">
fen2img -w 500 "$FEN" /tmp/t.jpg
fen2img -w 500 "$FEN" /tmp/t.png
fen2img -w 500 "$FEN" /tmp/t.eps
fen2img -w 500 "$FEN" - | display - # pipes a .png into display</code></pre>
fen2img -w 500 "$FEN" - | display - # pipes a .png into display
fen2img -w 500 "$FEN" -f - | display - # flip the display</code></pre>
<H3 id="DESCRIPTION">DESCRIPTION</H3>
......@@ -68,6 +69,11 @@ to convert into <code>.jpg</code> or <code>.png</code> format.</p>
<dl>
<dt id="f"><i>-f</i></dt> <dd>
<p>The board will be displayed <B>F</B>lipped,
ie: from Black's point of view.</p>
</dd>
<dt id="w-500"><i>-w 500</i></dt> <dd>
<p>This option sets the <b>W</b>idth in pixels of the <code>.jpg</code>
or <code>.png</code> image, or the width in points of <code>.eps</code>
......@@ -99,7 +105,8 @@ It also needs a particular TrueType font:</p>
</p>
<H3 id="CHANGES">CHANGES</H3>
<PRE> 20180627 1.1 allows output on stdout, for piping into display
<PRE> 20180627 1.2 introduce the -f Flip option
20180627 1.1 allows output on stdout, for piping into display
20180411 1.0 first working version
</PRE>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment