------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2010 Vadim Godunko <vgodunko@gmail.com>                      --
--                                                                          --
-- QtAda is free software;  you can  redistribute it and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion. QtAda is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License distributed with QtAda;  see file COPYING.  If not, write --
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
-- Boston, MA 02110-1301, USA.                                              --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
-- covered  by the  GNU  General  Public  License.  This exception does not --
-- however invalidate  any other reasons why  the executable file  might be --
-- covered by the  GNU Public License.                                      --
--                                                                          --
------------------------------------------------------------------------------
--  $Revision: 3732 $ $Date: 2010-04-30 14:49:36 +0400 (Fri, 30 Apr 2010) $
------------------------------------------------------------------------------
pragma Style_Checks ("M32766");
with System.Address_To_Access_Conversions;

with Qt_Ada.Internals.Boolean_Conversions;

package body Qt4.Image_Readers is

   function initialize_QImageReader
    (Storage : System.Address)
      return Internals.QImageReader_Access;
   pragma Import (C, initialize_QImageReader, "__QtAda_inititialize_QImageReader");

   function initialize_QImageReader_QStringCR_QByteArrayCR
    (Storage : System.Address;
     File_Name : Qt4.Strings.Internals.QString_Access;
     Format : Qt4.Byte_Arrays.Internals.QByteArray_Access)
      return Internals.QImageReader_Access;
   pragma Import (C, initialize_QImageReader_QStringCR_QByteArrayCR, "__QtAda_inititialize_QImageReader_QStringCR_QByteArrayCR");

   procedure finalize_QImageReader (Object : Internals.QImageReader_Access);
   pragma Import (C, finalize_QImageReader, "__QtAda_finalize_QImageReader");

   function QImageReader_autoDetectImageFormat
    (Self : Internals.QImageReader_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_autoDetectImageFormat, "__QtAda_QImageReader_autoDetectImageFormat_Q");

   procedure QImageReader_backgroundColor
    (Returns : Qt4.Colors.Internals.QColor_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_backgroundColor, "__QtAda_QImageReader_backgroundColor_Q");

   function QImageReader_canRead
    (Self : Internals.QImageReader_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_canRead, "__QtAda_QImageReader_canRead_Q");

   procedure QImageReader_clipRect
    (Returns : Qt4.Rects.Internals.QRect_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_clipRect, "__QtAda_QImageReader_clipRect_Q");

   function QImageReader_currentImageNumber
    (Self : Internals.QImageReader_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QImageReader_currentImageNumber, "__QtAda_QImageReader_currentImageNumber_Q");

   procedure QImageReader_currentImageRect
    (Returns : Qt4.Rects.Internals.QRect_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_currentImageRect, "__QtAda_QImageReader_currentImageRect_Q");

   function QImageReader_decideFormatFromContent
    (Self : Internals.QImageReader_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_decideFormatFromContent, "__QtAda_QImageReader_decideFormatFromContent_Q");

   function QImageReader_error
    (Self : Internals.QImageReader_Access)
       return Image_Reader_Error;
   pragma Import (C, QImageReader_error, "__QtAda_QImageReader_error_Q");

   procedure QImageReader_errorString
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_errorString, "__QtAda_QImageReader_errorString_Q");

   procedure QImageReader_fileName
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_fileName, "__QtAda_QImageReader_fileName_Q");

   procedure QImageReader_format
    (Returns : Qt4.Byte_Arrays.Internals.QByteArray_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_format, "__QtAda_QImageReader_format_Q");

   function QImageReader_imageCount
    (Self : Internals.QImageReader_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QImageReader_imageCount, "__QtAda_QImageReader_imageCount_Q");

   function QImageReader_imageFormat
    (Self : Internals.QImageReader_Access)
       return Qt4.Images.Image_Format;
   pragma Import (C, QImageReader_imageFormat, "__QtAda_QImageReader_imageFormat_Q");

   function QImageReader_jumpToImage_int
    (Self : Internals.QImageReader_Access;
     Image_Number : Qt4.Q_Integer)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_jumpToImage_int, "__QtAda_QImageReader_jumpToImage_int");

   function QImageReader_jumpToNextImage
    (Self : Internals.QImageReader_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_jumpToNextImage, "__QtAda_QImageReader_jumpToNextImage");

   function QImageReader_loopCount
    (Self : Internals.QImageReader_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QImageReader_loopCount, "__QtAda_QImageReader_loopCount_Q");

   function QImageReader_nextImageDelay
    (Self : Internals.QImageReader_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QImageReader_nextImageDelay, "__QtAda_QImageReader_nextImageDelay_Q");

   function QImageReader_quality
    (Self : Internals.QImageReader_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QImageReader_quality, "__QtAda_QImageReader_quality_Q");

   procedure QImageReader_read
    (Returns : Qt4.Images.Internals.QImage_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_read, "__QtAda_QImageReader_read");

   function QImageReader_read_QImageP
    (Self : Internals.QImageReader_Access;
     Image :  Qt4.Images.Internals.QImage_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_read_QImageP, "__QtAda_QImageReader_read_QImageP");

   procedure QImageReader_scaledClipRect
    (Returns : Qt4.Rects.Internals.QRect_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_scaledClipRect, "__QtAda_QImageReader_scaledClipRect_Q");

   procedure QImageReader_scaledSize
    (Returns : Qt4.Sizes.Internals.QSize_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_scaledSize, "__QtAda_QImageReader_scaledSize_Q");

   procedure QImageReader_setAutoDetectImageFormat_bool
    (Self : Internals.QImageReader_Access;
     Enabled : Interfaces.C.unsigned);
   pragma Import (C, QImageReader_setAutoDetectImageFormat_bool, "__QtAda_QImageReader_setAutoDetectImageFormat_bool");

   procedure QImageReader_setBackgroundColor_QColorCR
    (Self : Internals.QImageReader_Access;
     Color : Qt4.Colors.Internals.QColor_Access);
   pragma Import (C, QImageReader_setBackgroundColor_QColorCR, "__QtAda_QImageReader_setBackgroundColor_QColorCR");

   procedure QImageReader_setClipRect_QRectCR
    (Self : Internals.QImageReader_Access;
     Rect : Qt4.Rects.Internals.QRect_Access);
   pragma Import (C, QImageReader_setClipRect_QRectCR, "__QtAda_QImageReader_setClipRect_QRectCR");

   procedure QImageReader_setDecideFormatFromContent_bool
    (Self : Internals.QImageReader_Access;
     Ignored : Interfaces.C.unsigned);
   pragma Import (C, QImageReader_setDecideFormatFromContent_bool, "__QtAda_QImageReader_setDecideFormatFromContent_bool");

   procedure QImageReader_setFileName_QStringCR
    (Self : Internals.QImageReader_Access;
     File_Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QImageReader_setFileName_QStringCR, "__QtAda_QImageReader_setFileName_QStringCR");

   procedure QImageReader_setFormat_QByteArrayCR
    (Self : Internals.QImageReader_Access;
     Format : Qt4.Byte_Arrays.Internals.QByteArray_Access);
   pragma Import (C, QImageReader_setFormat_QByteArrayCR, "__QtAda_QImageReader_setFormat_QByteArrayCR");

   procedure QImageReader_setQuality_int
    (Self : Internals.QImageReader_Access;
     Quality : Qt4.Q_Integer);
   pragma Import (C, QImageReader_setQuality_int, "__QtAda_QImageReader_setQuality_int");

   procedure QImageReader_setScaledClipRect_QRectCR
    (Self : Internals.QImageReader_Access;
     Rect : Qt4.Rects.Internals.QRect_Access);
   pragma Import (C, QImageReader_setScaledClipRect_QRectCR, "__QtAda_QImageReader_setScaledClipRect_QRectCR");

   procedure QImageReader_setScaledSize_QSizeCR
    (Self : Internals.QImageReader_Access;
     Size : Qt4.Sizes.Internals.QSize_Access);
   pragma Import (C, QImageReader_setScaledSize_QSizeCR, "__QtAda_QImageReader_setScaledSize_QSizeCR");

   procedure QImageReader_size
    (Returns : Qt4.Sizes.Internals.QSize_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_size, "__QtAda_QImageReader_size_Q");

   function QImageReader_supportsAnimation
    (Self : Internals.QImageReader_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_supportsAnimation, "__QtAda_QImageReader_supportsAnimation_Q");

   function QImageReader_supportsOption_ImageOption
    (Self : Internals.QImageReader_Access;
     Option : Qt4.Image_IO_Handlers.Image_Option)
       return Interfaces.C.unsigned;
   pragma Import (C, QImageReader_supportsOption_ImageOption, "__QtAda_QImageReader_supportsOption_ImageOption_Q");

   procedure QImageReader_text_QStringCR
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QImageReader_Access;
     Key : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QImageReader_text_QStringCR, "__QtAda_QImageReader_text_QStringCR_Q");

   procedure QImageReader_textKeys
    (Returns : Qt4.String_Lists.Internals.QStringList_Access;
     Self : Internals.QImageReader_Access);
   pragma Import (C, QImageReader_textKeys, "__QtAda_QImageReader_textKeys_Q");

   procedure QImageReader_imageFormat_QStringCR
    (Returns : Qt4.Byte_Arrays.Internals.QByteArray_Access;
     File_Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QImageReader_imageFormat_QStringCR, "__QtAda_QImageReader_imageFormat_QStringCR_S");

   procedure QImageReader_supportedImageFormats
    (Returns : Qt4.List_Of_Q_Byte_Arrays.Internals.QListOfQByteArray_Access);
   pragma Import (C, QImageReader_supportedImageFormats, "__QtAda_QImageReader_supportedImageFormats_S");

   --------------
   -- Finalize --
   --------------

   overriding
   procedure Finalize (Self : in out Q_Image_Reader) is
   begin
      if not Self.Wrapper then
         finalize_QImageReader (Self.Object);
      end if;
   end Finalize;

   ----------------
   -- Initialize --
   ----------------

   overriding
   procedure Initialize (Self : in out Q_Image_Reader) is
      use type Internals.QImageReader_Access;

   begin
      if Self.Object = null then
         Self.Object := initialize_QImageReader (Self.Storage'Address);
      end if;
   end Initialize;

   ------------
   -- Create --
   ------------

   function Create
    (File_Name : Qt4.Strings.Q_String'Class;
     Format : Qt4.Byte_Arrays.Q_Byte_Array'Class)
       return Q_Image_Reader
   is
   begin
      return Self : Q_Image_Reader
        := (Ada.Finalization.Limited_Controlled with others => <>)
      do
         Self.Object := initialize_QImageReader_QStringCR_QByteArrayCR (Self.Storage'Address, Qt4.Strings.Internals.QString_View (File_Name), Qt4.Byte_Arrays.Internals.QByteArray_View (Format));
      end return;
   end Create;

   ------------------------------
   -- Auto_Detect_Image_Format --
   ------------------------------

   function Auto_Detect_Image_Format
    (Self : Q_Image_Reader'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_autoDetectImageFormat (Self.Object), 0);
   end Auto_Detect_Image_Format;

   ----------------------
   -- Background_Color --
   ----------------------

   function Background_Color
    (Self : Q_Image_Reader'Class)
       return Qt4.Colors.Q_Color
   is
   begin
      return Returns : Qt4.Colors.Q_Color do
         QImageReader_backgroundColor (Qt4.Colors.Internals.QColor_View (Returns), Self.Object);
      end return;
   end Background_Color;

   --------------
   -- Can_Read --
   --------------

   function Can_Read
    (Self : Q_Image_Reader'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_canRead (Self.Object), 0);
   end Can_Read;

   ---------------
   -- Clip_Rect --
   ---------------

   function Clip_Rect
    (Self : Q_Image_Reader'Class)
       return Qt4.Rects.Q_Rect
   is
   begin
      return Returns : Qt4.Rects.Q_Rect do
         QImageReader_clipRect (Qt4.Rects.Internals.QRect_View (Returns), Self.Object);
      end return;
   end Clip_Rect;

   --------------------------
   -- Current_Image_Number --
   --------------------------

   function Current_Image_Number
    (Self : Q_Image_Reader'Class)
       return Qt4.Q_Integer
   is
   begin
      return QImageReader_currentImageNumber (Self.Object);
   end Current_Image_Number;

   ------------------------
   -- Current_Image_Rect --
   ------------------------

   function Current_Image_Rect
    (Self : Q_Image_Reader'Class)
       return Qt4.Rects.Q_Rect
   is
   begin
      return Returns : Qt4.Rects.Q_Rect do
         QImageReader_currentImageRect (Qt4.Rects.Internals.QRect_View (Returns), Self.Object);
      end return;
   end Current_Image_Rect;

   --------------------------------
   -- Decide_Format_From_Content --
   --------------------------------

   function Decide_Format_From_Content
    (Self : Q_Image_Reader'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_decideFormatFromContent (Self.Object), 0);
   end Decide_Format_From_Content;

   -----------
   -- Error --
   -----------

   function Error
    (Self : Q_Image_Reader'Class)
       return Image_Reader_Error
   is
   begin
      return QImageReader_error (Self.Object);
   end Error;

   ------------------
   -- Error_String --
   ------------------

   function Error_String
    (Self : Q_Image_Reader'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QImageReader_errorString (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Error_String;

   ---------------
   -- File_Name --
   ---------------

   function File_Name
    (Self : Q_Image_Reader'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QImageReader_fileName (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end File_Name;

   ------------
   -- Format --
   ------------

   function Format
    (Self : Q_Image_Reader'Class)
       return Qt4.Byte_Arrays.Q_Byte_Array
   is
   begin
      return Returns : Qt4.Byte_Arrays.Q_Byte_Array do
         QImageReader_format (Qt4.Byte_Arrays.Internals.QByteArray_View (Returns), Self.Object);
      end return;
   end Format;

   -----------------
   -- Image_Count --
   -----------------

   function Image_Count
    (Self : Q_Image_Reader'Class)
       return Qt4.Q_Integer
   is
   begin
      return QImageReader_imageCount (Self.Object);
   end Image_Count;

   ------------------
   -- Image_Format --
   ------------------

   function Image_Format
    (Self : Q_Image_Reader'Class)
       return Qt4.Images.Image_Format
   is
   begin
      return QImageReader_imageFormat (Self.Object);
   end Image_Format;

   -------------------
   -- Jump_To_Image --
   -------------------

   function Jump_To_Image
    (Self : not null access Q_Image_Reader'Class;
     Image_Number : Qt4.Q_Integer)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_jumpToImage_int (Self.Object, Image_Number), 0);
   end Jump_To_Image;

   ------------------------
   -- Jump_To_Next_Image --
   ------------------------

   function Jump_To_Next_Image
    (Self : not null access Q_Image_Reader'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_jumpToNextImage (Self.Object), 0);
   end Jump_To_Next_Image;

   ----------------
   -- Loop_Count --
   ----------------

   function Loop_Count
    (Self : Q_Image_Reader'Class)
       return Qt4.Q_Integer
   is
   begin
      return QImageReader_loopCount (Self.Object);
   end Loop_Count;

   ----------------------
   -- Next_Image_Delay --
   ----------------------

   function Next_Image_Delay
    (Self : Q_Image_Reader'Class)
       return Duration
   is
   begin
      return Duration (QImageReader_nextImageDelay (Self.Object)) / 1000.0;
   end Next_Image_Delay;

   -------------
   -- Quality --
   -------------

   function Quality
    (Self : Q_Image_Reader'Class)
       return Qt4.Q_Integer
   is
   begin
      return QImageReader_quality (Self.Object);
   end Quality;

   ----------
   -- Read --
   ----------

   function Read
    (Self : not null access Q_Image_Reader'Class)
       return Qt4.Images.Q_Image
   is
   begin
      return Returns : Qt4.Images.Q_Image do
         QImageReader_read (Qt4.Images.Internals.QImage_View (Returns), Self.Object);
      end return;
   end Read;

   ----------
   -- Read --
   ----------

   function Read
    (Self : not null access Q_Image_Reader'Class;
     Image : not null access Qt4.Images.Q_Image'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_read_QImageP (Self.Object, Qt4.Images.Internals.QImage_View (Image.all)), 0);
   end Read;

   ----------------------
   -- Scaled_Clip_Rect --
   ----------------------

   function Scaled_Clip_Rect
    (Self : Q_Image_Reader'Class)
       return Qt4.Rects.Q_Rect
   is
   begin
      return Returns : Qt4.Rects.Q_Rect do
         QImageReader_scaledClipRect (Qt4.Rects.Internals.QRect_View (Returns), Self.Object);
      end return;
   end Scaled_Clip_Rect;

   -----------------
   -- Scaled_Size --
   -----------------

   function Scaled_Size
    (Self : Q_Image_Reader'Class)
       return Qt4.Sizes.Q_Size
   is
   begin
      return Returns : Qt4.Sizes.Q_Size do
         QImageReader_scaledSize (Qt4.Sizes.Internals.QSize_View (Returns), Self.Object);
      end return;
   end Scaled_Size;

   ----------------------------------
   -- Set_Auto_Detect_Image_Format --
   ----------------------------------

   procedure Set_Auto_Detect_Image_Format
    (Self : in out Q_Image_Reader'Class;
     Enabled : Boolean)
   is
   begin
      QImageReader_setAutoDetectImageFormat_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enabled));
   end Set_Auto_Detect_Image_Format;

   --------------------------
   -- Set_Background_Color --
   --------------------------

   procedure Set_Background_Color
    (Self : in out Q_Image_Reader'Class;
     Color : Qt4.Colors.Q_Color'Class)
   is
   begin
      QImageReader_setBackgroundColor_QColorCR (Self.Object, Qt4.Colors.Internals.QColor_View (Color));
   end Set_Background_Color;

   -------------------
   -- Set_Clip_Rect --
   -------------------

   procedure Set_Clip_Rect
    (Self : in out Q_Image_Reader'Class;
     Rect : Qt4.Rects.Q_Rect'Class)
   is
   begin
      QImageReader_setClipRect_QRectCR (Self.Object, Qt4.Rects.Internals.QRect_View (Rect));
   end Set_Clip_Rect;

   ------------------------------------
   -- Set_Decide_Format_From_Content --
   ------------------------------------

   procedure Set_Decide_Format_From_Content
    (Self : in out Q_Image_Reader'Class;
     Ignored : Boolean)
   is
   begin
      QImageReader_setDecideFormatFromContent_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Ignored));
   end Set_Decide_Format_From_Content;

   -------------------
   -- Set_File_Name --
   -------------------

   procedure Set_File_Name
    (Self : in out Q_Image_Reader'Class;
     File_Name : Qt4.Strings.Q_String'Class)
   is
   begin
      QImageReader_setFileName_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (File_Name));
   end Set_File_Name;

   ----------------
   -- Set_Format --
   ----------------

   procedure Set_Format
    (Self : in out Q_Image_Reader'Class;
     Format : Qt4.Byte_Arrays.Q_Byte_Array'Class)
   is
   begin
      QImageReader_setFormat_QByteArrayCR (Self.Object, Qt4.Byte_Arrays.Internals.QByteArray_View (Format));
   end Set_Format;

   -----------------
   -- Set_Quality --
   -----------------

   procedure Set_Quality
    (Self : in out Q_Image_Reader'Class;
     Quality : Qt4.Q_Integer)
   is
   begin
      QImageReader_setQuality_int (Self.Object, Quality);
   end Set_Quality;

   --------------------------
   -- Set_Scaled_Clip_Rect --
   --------------------------

   procedure Set_Scaled_Clip_Rect
    (Self : in out Q_Image_Reader'Class;
     Rect : Qt4.Rects.Q_Rect'Class)
   is
   begin
      QImageReader_setScaledClipRect_QRectCR (Self.Object, Qt4.Rects.Internals.QRect_View (Rect));
   end Set_Scaled_Clip_Rect;

   ---------------------
   -- Set_Scaled_Size --
   ---------------------

   procedure Set_Scaled_Size
    (Self : in out Q_Image_Reader'Class;
     Size : Qt4.Sizes.Q_Size'Class)
   is
   begin
      QImageReader_setScaledSize_QSizeCR (Self.Object, Qt4.Sizes.Internals.QSize_View (Size));
   end Set_Scaled_Size;

   ----------
   -- Size --
   ----------

   function Size
    (Self : Q_Image_Reader'Class)
       return Qt4.Sizes.Q_Size
   is
   begin
      return Returns : Qt4.Sizes.Q_Size do
         QImageReader_size (Qt4.Sizes.Internals.QSize_View (Returns), Self.Object);
      end return;
   end Size;

   ------------------------
   -- Supports_Animation --
   ------------------------

   function Supports_Animation
    (Self : Q_Image_Reader'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_supportsAnimation (Self.Object), 0);
   end Supports_Animation;

   ---------------------
   -- Supports_Option --
   ---------------------

   function Supports_Option
    (Self : Q_Image_Reader'Class;
     Option : Qt4.Image_IO_Handlers.Image_Option)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QImageReader_supportsOption_ImageOption (Self.Object, Option), 0);
   end Supports_Option;

   ----------
   -- Text --
   ----------

   function Text
    (Self : Q_Image_Reader'Class;
     Key : Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QImageReader_text_QStringCR (Qt4.Strings.Internals.QString_View (Returns), Self.Object, Qt4.Strings.Internals.QString_View (Key));
      end return;
   end Text;

   ---------------
   -- Text_Keys --
   ---------------

   function Text_Keys
    (Self : Q_Image_Reader'Class)
       return Qt4.String_Lists.Q_String_List
   is
   begin
      return Returns : Qt4.String_Lists.Q_String_List do
         QImageReader_textKeys (Qt4.String_Lists.Internals.QStringList_View (Returns), Self.Object);
      end return;
   end Text_Keys;

   ------------------
   -- Image_Format --
   ------------------

   function Image_Format
    (File_Name : Qt4.Strings.Q_String'Class)
       return Qt4.Byte_Arrays.Q_Byte_Array
   is
   begin
      return Returns : Qt4.Byte_Arrays.Q_Byte_Array do
         QImageReader_imageFormat_QStringCR (Qt4.Byte_Arrays.Internals.QByteArray_View (Returns), Qt4.Strings.Internals.QString_View (File_Name));
      end return;
   end Image_Format;

   -----------------------------
   -- Supported_Image_Formats --
   -----------------------------

   function Supported_Image_Formats
     return Qt4.List_Of_Q_Byte_Arrays.Q_List_Of_Q_Byte_Array
   is
   begin
      return Returns : Qt4.List_Of_Q_Byte_Arrays.Q_List_Of_Q_Byte_Array do
         QImageReader_supportedImageFormats (Qt4.List_Of_Q_Byte_Arrays.Internals.QListOfQByteArray_View (Returns));
      end return;
   end Supported_Image_Formats;

   ---------------
   -- Internals --
   ---------------

   package body Internals is

   -----------------------
   -- QImageReader_View --
   -----------------------

      function QImageReader_View
       (Item : Q_Image_Reader'Class)
          return QImageReader_Access
      is
      begin
         return Item.Object;
      end QImageReader_View;

      package QImageReader_Conversions is
        new System.Address_To_Access_Conversions
             (QImageReader);

   ----------------------------
   -- QImageReaderTo_Pointer --
   ----------------------------

      function To_Pointer
       (Address : System.Address)
          return QImageReader_Access
      is
      begin
         return
           QImageReader_Access
            (QImageReader_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   ----------------------------
   -- QImageReaderTo_Address --
   ----------------------------

      function To_Address
       (Pointer : QImageReader_Access)
          return System.Address
      is
      begin
         return
           QImageReader_Conversions.To_Address
            (QImageReader_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

   --------------------
   -- Create_Wrapper --
   --------------------

      function Create_Wrapper
       (Item : Internals.QImageReader_Access)
          return Q_Image_Reader
      is
      begin
         return Q_Image_Reader'
          (Ada.Finalization.Limited_Controlled with
             Object  => Item,
             Wrapper => True,
             others  => <>);
      end Create_Wrapper;

   end Internals;

end Qt4.Image_Readers;
