1. ------------------------------------------------------------------------------ 
  2. --                  GtkAda - Ada95 binding for Gtk+/Gnome                   -- 
  3. --                                                                          -- 
  4. --                     Copyright (C) 2010-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  Reading and writing PNG images. 
  26. --  </description> 
  27. -- 
  28. --  <c_version>1.8.8</c_version> 
  29. --  <group>Cairo</group> 
  30.  
  31. package Cairo.Png is 
  32.  
  33.    function Write_To_Png 
  34.      (Surface  : Cairo_Surface; 
  35.       Filename : String) 
  36.       return     Cairo_Status; 
  37.    --  Surface: a Cairo_Surface with pixel contents 
  38.    --  Filename: the name of a file to write to 
  39.    -- 
  40.    --  Writes the contents of surface to a new file filename as a PNG 
  41.    --  image. 
  42.    -- 
  43.    --  Return value: Cairo_Status_Success if the PNG file was written 
  44.    --  successfully. Otherwise, Cairo_Status_No_Memory if memory could not 
  45.    --  be allocated for the operation or 
  46.    --  Cairo_Status_Surface_Type_Mismatch if the surface does not have 
  47.    --  pixel contents, or Cairo_Status_Write_Error if an I/O error occurs 
  48.    --  while attempting to write the file. 
  49.  
  50.    function Create_From_Png 
  51.      (Filename : String) 
  52.       return     Cairo_Surface; 
  53.    --  Filename: name of PNG file to load 
  54.    -- 
  55.    --  Creates a new image surface and initializes the contents to the 
  56.    --  given PNG file. 
  57.    -- 
  58.    --  Return value: a new Cairo_Surface initialized with the contents 
  59.    --  of the PNG file, or a "nil" surface if any error occurred. A nil 
  60.    --  surface can be checked for with Cairo.Surface.Status (Surface) which 
  61.    --  may return one of the following values: 
  62.    -- 
  63.    --  Cairo_Status_No_Memory 
  64.    --  Cairo_Status_File_Not_Found 
  65.    --  Cairo_Status_Read_Error 
  66.    -- 
  67.    --  Alternatively, you can allow errors to propagate through the drawing 
  68.    --  operations and check the status on the context upon completion 
  69.    --  using Cairo_Status. 
  70.  
  71. end Cairo.Png;