wl_lib_0.1.3_1c94dc7c/src/wl-images-reader.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
with Ada.Characters.Handling;
with Ada.Directories;

with WL.Images.DDS;
with WL.Images.TGA;

package body WL.Images.Reader is

   ---------------------
   -- Read_Image_File --
   ---------------------

   procedure Read_Image_File
     (Image : out Image_Type'Class;
      Path  : String)
   is
      Ext : constant String :=
              Ada.Characters.Handling.To_Lower
                (Ada.Directories.Extension (Path));
   begin
      if Ext = "dds" then
         WL.Images.DDS.Read_DDS (Image, Path);
      elsif Ext = "tga" then
         WL.Images.TGA.Read_TGA (Image, Path);
      else
         raise Constraint_Error with
           "unknown image format: " & Ext;
      end if;
   end Read_Image_File;

end WL.Images.Reader;