Cairo.Png

Entities

Subprograms

Description

Reading and writing PNG images.

<c_version>1.8.8</c_version> <group>Cairo</group>

Create_From_Png

function Create_From_Png
  (Filename : String)
   return     Cairo_Surface

Creates a new image surface and initializes the contents to the given PNG file.

Cairo_Status_No_Memory Cairo_Status_File_Not_Found Cairo_Status_Read_Error

Alternatively, you can allow errors to propagate through the drawing operations and check the status on the context upon completion using Cairo_Status.

Parameters
Filename

name of PNG file to load

Return Value

a new Cairo_Surface initialized with the contents of the PNG file, or a "nil" surface if any error occurred. A nil surface can be checked for with Cairo.Surface.Status (Surface) which may return one of the following values:

Write_To_Png

function Write_To_Png
  (Surface  : Cairo_Surface;
   Filename : String)
   return     Cairo_Status

Writes the contents of surface to a new file filename as a PNG image.

Parameters
Surface

a Cairo_Surface with pixel contents

Filename

the name of a file to write to

Return Value

Cairo_Status_Success if the PNG file was written successfully. Otherwise, Cairo_Status_No_Memory if memory could not be allocated for the operation or Cairo_Status_Surface_Type_Mismatch if the surface does not have pixel contents, or Cairo_Status_Write_Error if an I/O error occurs while attempting to write the file.