-- A library for drawing bar codes -- -- Copyright (C) by PragmAda Software Engineering -- -- Released under the terms of the 3-Clause BSD License. See https://opensource.org/licenses/BSD-3-Clause with Ada.Characters.Latin_1; with Ada.Strings.Unbounded; with PragmARC.Images; package body Bar_Code_Drawing.How.SVG is function Image (Info : in Drawing_Info; Width : in Float := 1.0; Height : in Float := 1.0) return String is use Ada.Strings.Unbounded; LF : constant Character := Ada.Characters.Latin_1.LF; function Image is new PragmARC.Images.Float_Image (Number => Float); Unit : constant String := "mm"; Result : Unbounded_String := To_Unbounded_String ("" & LF & "" & LF & "" & LF & "" & LF & "" & LF & " " & LF); -- White rectangle as background begin -- Image if Info.Dim = 1 then -- 1D barcode All_X : for X in Info.Bitmap'Range (1) loop if Info.Bitmap (X, 0) then Append (Source => Result, New_Item => " " & LF); end if; end loop All_X; else X_2 : for X in Info.Bitmap'Range (1) loop Y_2 : for Y in Info.Bitmap'Range (2) loop if Info.Bitmap (X, Y) then Append (Source => Result, New_Item => " " & LF); end if; end loop Y_2; end loop X_2; end if; Append (Source => Result, New_Item => "" & LF); return To_String (Result); end Image; end Bar_Code_Drawing.How.SVG;