Hosted by
 |
with Ada.Command_Line; use Ada.Command_Line;
with Glyphs; use Glyphs;
with EPS;
with Glyph_Images; use Glyph_Images;
with Gray_Images; use Gray_Images;
with Real_Numbers; use Real_Numbers;
with Real_Strings; use Real_Strings;
with Messages; use Messages;
with PGM;
procedure Glyph2PGM is
Index : Positive;
Exit_Now : Boolean;
Staff_Height : Real;
G : Glyph;
I : Glyph_Image;
begin
User_Friendly("glyph2pgm", "",
(
-"Read an EPS (Encapsulated PostScript) from standard input.",
-"Render it to grayscale raster graphics, with anti-alias.",
-"Write a PGM (Portable Graymap) to standard output."),
(1 =>
-" Staff height in pixels."),
No_Strings,
Index, Exit_Now);
if Exit_Now then return; end if;
while Index < Argument_Count loop
if Argument(Index) = "-q" or Argument(Index) = "--quiet" then null;
else
Invalid_Option(Index);
return;
end if;
Index := Index + 1;
end loop;
if Index > Argument_Count then
Too_Few_Arguments;
return;
end if;
Staff_Height := To_Number(Argument(Index));
Message("reading EPS from standard input");
G := EPS.Read;
Message("rendering glyph");
I := Get_Image(G, Staff_Height, 1.0, 4);
Message("writing PGM to standard output");
PGM.Write(Gray_Image(I));
Message("finished successfully");
end Glyph2PGM;
|