1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                    Copyright (C) 2010, AdaCore                    -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  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;