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. --  Bindings to the Cairo 2D graphics library. 
  26. --  The Cairo_Context is the main object used when drawing with cairo. To draw 
  27. --  with Cairo, you create a Context, set the target surface, and drawing 
  28. --  options for the Cairo_Context, create shapes with functions like Move_To 
  29. --  and Line_To, and then draw shapes with Stroke or Fill. 
  30. -- 
  31. --  All drawing in Cairo is done on a Cairo_Context. 
  32. -- 
  33. --  Drawing on on-screen Gtk widgets should be done in a callback to the 
  34. --  "expose" event: 
  35. -- 
  36. --  When the widget has been created, connect a drawing function: 
  37. -- 
  38. --  <code> 
  39. --     declare 
  40. --        Area : Gtk_Drawing_Area; 
  41. -- 
  42. --        package Event_Cb is new Gtk.Handlers.Return_Callback 
  43. --            (Gtk_Drawing_Area_Record, Boolean); 
  44. --     begin 
  45. --        Gtk_New (Area); 
  46. --        Event_Cb.Connect (Area, "expose_event", 
  47. --                          Event_Cb.To_Marshaller (Expose_Cb'Access)); 
  48. --     end; 
  49. --  </code> 
  50. -- 
  51. --  In the callback, first get the context of the drawable on which you 
  52. --  need to draw, using Gdk.Cairo.Create. Then do the drawing operations, and 
  53. --  release the memory allocated to Cr using Cairo.Destroy. 
  54. -- 
  55. --  In addition to drawing on on-screen widgets, drawing can also be done using 
  56. --  the same Cairo calls to pixbufs (see Gdk.Cairo) to memory 
  57. --  (see Cairo.Image_Surface), and to PNG or PDF files (see Cairo.Png and 
  58. --  Cairo.Pdf). 
  59. -- 
  60. --  Code samples demonstrating how to use various functionalities of Cairo 
  61. --  can be found in the testcairo example, shipped with GtkAda. 
  62. --  </description> 
  63. -- 
  64. --  <c_version>1.8.8</c_version> 
  65. --  <group>Cairo</group> 
  66.  
  67. with Ada.Unchecked_Deallocation; 
  68.  
  69. with System; 
  70. with Interfaces.C.Strings; 
  71.  
  72. with Glib; use Glib; 
  73. with Glib.Values; 
  74.  
  75. package Cairo is 
  76.  
  77.    type Cairo_Context is private; 
  78.    --  A Cairo_Context contains the current state of the rendering device, 
  79.    --  including coordinates of yet to be drawn shapes. 
  80.    -- 
  81.    --  Cairo contexts, as Cairo_Context objects are named, are central to 
  82.    --  cairo and all drawing with cairo is always done to a Cairo_Context 
  83.    --  object. 
  84.    -- 
  85.    --  Memory management of Cairo_Context is done with subprograms 
  86.    --  Reference and Destroy, see below. 
  87.  
  88.    function Get_Context 
  89.       (Value : Glib.Values.GValue) return Cairo_Context; 
  90.    --  Support for callbacks that receive a Cairo_Context as parameter. 
  91.  
  92.    type Cairo_Surface is private; 
  93.    --  A Cairo_Surface represents an image, either as the destination 
  94.    --  of a drawing operation or as source when drawing onto another 
  95.    --  surface.  To draw to a Cairo_Surface, create a cairo context 
  96.    --  with the surface as the target, using Create. 
  97.    -- 
  98.    --  There are different subtypes of Cairo_Surface for 
  99.    --  different drawing backends; for example, Cairo.Image_Surface.Create 
  100.    --  creates a bitmap image in memory. 
  101.    --  The type of a surface can be queried with Cairo.Surface.Get_Type. 
  102.    -- 
  103.    --  Memory management of Cairo_Surface is done with 
  104.    --  Cairo.Surface.Reference and Cairo.Surface.Destroy. 
  105.  
  106.    type Cairo_Matrix is record 
  107.       Xx : aliased Gdouble; 
  108.       Yx : aliased Gdouble; 
  109.       Xy : aliased Gdouble; 
  110.       Yy : aliased Gdouble; 
  111.       X0 : aliased Gdouble; 
  112.       Y0 : aliased Gdouble; 
  113.    end record; 
  114.    --  Xx: Xx component of the affine transformation 
  115.    --  Yx: Yx component of the affine transformation 
  116.    --  Xy: Xy component of the affine transformation 
  117.    --  Yy: Yy component of the affine transformation 
  118.    --  X0: X translation component of the affine transformation 
  119.    --  Y0: Y translation component of the affine transformation 
  120.    -- 
  121.    --  A Cairo_Matrix holds an affine transformation, such as a scale, 
  122.    --  rotation, shear, or a combination of those. The transformation of 
  123.    --  a point (X, Y) is given by: 
  124.    -- 
  125.    --      X_New = Xx * X + Xy * Y + X0; 
  126.    --      Y_New = Yx * X + Yy * Y + Y0; 
  127.    pragma Convention (C_Pass_By_Copy, Cairo_Matrix); 
  128.  
  129.    type Cairo_Matrix_Access is access Cairo_Matrix; 
  130.    procedure Unchecked_Free is new Ada.Unchecked_Deallocation 
  131.      (Cairo_Matrix, Cairo_Matrix_Access); 
  132.  
  133.    type Cairo_Pattern is private; 
  134.    --  A Cairo_Pattern represents a source when drawing onto a 
  135.    --  surface. There are different subtypes of Cairo_Pattern, 
  136.    --  for different types of sources; for example, 
  137.    --  Cairo.Pattern.Create_Rgb creates a pattern for a solid 
  138.    --  opaque color. 
  139.    -- 
  140.    --  Other than various Cairo.Pattern.Create_<type> 
  141.    --  functions, some of the pattern types can be implicitly created 
  142.    --  using various Set_Source_<type> functions; for example Set_Source_Rgb. 
  143.    -- 
  144.    --  The type of a pattern can be queried with Cairo.Pattern.Get_Type. 
  145.    -- 
  146.    --  Memory management of Cairo_Pattern is done with 
  147.    --  Cairo.Pattern.Reference and Cairo.Pattern.Destroy. 
  148.  
  149.    type Cairo_Destroy_Func is access procedure (Arg1 : System.Address); 
  150.    --  Data: The Data element being destroyed. 
  151.    -- 
  152.    --  Cairo_destroy_func the type of function which is called when a 
  153.    --  data element is destroyed. It is passed the pointer to the data 
  154.    --  element and should free any memory and resources allocated for it. 
  155.  
  156.    type Cairo_User_Data_Key is record 
  157.       Unused : aliased Gint; 
  158.    end record; 
  159.    --  Unused: not used; ignore. 
  160.    -- 
  161.    --  Cairo_User_Data_Key is used for attaching user data to cairo 
  162.    --  data structures.  The actual contents of the struct is never used, 
  163.    --  and there is no need to initialize the object; only the unique 
  164.    --  address of a Cairo_User_Data_Key object is used.  Typically, you 
  165.    --  would just use the address of a static Cairo_User_Data_Key object. 
  166.  
  167.    pragma Convention (C_Pass_By_Copy, Cairo_User_Data_Key); 
  168.  
  169.    --  Cairo_Status is used to indicate errors that can occur when 
  170.    --  using Cairo. In some cases it is returned directly by functions. 
  171.    --  but when using Cairo_T, the last error, if any, is stored in 
  172.    --  the context and can be retrieved with Cairo_Status. 
  173.    -- 
  174.    --  New entries may be added in future versions.  Use 
  175.    --  Cairo_Status_To_String 
  176.    --  to get a human-readable representation of an error message. 
  177.    type Cairo_Status is 
  178.      ( 
  179.       Cairo_Status_Success, 
  180.       --  no error has occurred 
  181.  
  182.       Cairo_Status_No_Memory, 
  183.       --  out of memory 
  184.  
  185.       Cairo_Status_Invalid_Restore, 
  186.       --  Cairo_Restore called without matching Cairo_Save 
  187.  
  188.       Cairo_Status_Invalid_Pop_Group, 
  189.       --  no saved group to pop 
  190.  
  191.       Cairo_Status_No_Current_Point, 
  192.       --  no current point defined 
  193.  
  194.       Cairo_Status_Invalid_Matrix, 
  195.       --  invalid matrix (not invertible) 
  196.  
  197.       Cairo_Status_Invalid_Status, 
  198.       --  invalid value for an input Cairo_status 
  199.  
  200.       Cairo_Status_Null_Pointer, 
  201.       --  NULL pointer 
  202.  
  203.       Cairo_Status_Invalid_String, 
  204.       --  input string not valid UTF-8 
  205.  
  206.       Cairo_Status_Invalid_Path_Data, 
  207.       --  input path data not valid 
  208.  
  209.       Cairo_Status_Read_Error, 
  210.       --  error while reading from input stream 
  211.  
  212.       Cairo_Status_Write_Error, 
  213.       --  error while writing to output stream 
  214.  
  215.       Cairo_Status_Surface_Finished, 
  216.       --  target surface has been finished 
  217.  
  218.       Cairo_Status_Surface_Type_Mismatch, 
  219.       --  the surface type is not appropriate for the operation 
  220.  
  221.       Cairo_Status_Pattern_Type_Mismatch, 
  222.       --  the pattern type is not appropriate for the operation 
  223.  
  224.       Cairo_Status_Invalid_Content, 
  225.       --  invalid value for an input Cairo_content 
  226.  
  227.       Cairo_Status_Invalid_Format, 
  228.       --  invalid value for an input Cairo_format 
  229.  
  230.       Cairo_Status_Invalid_Visual, 
  231.       --  invalid value for an input Visual* 
  232.  
  233.       Cairo_Status_File_Not_Found, 
  234.       --  file not found 
  235.  
  236.       Cairo_Status_Invalid_Dash, 
  237.       --  invalid value for a dash setting 
  238.  
  239.       Cairo_Status_Invalid_Dsc_Comment, 
  240.       --  invalid value for a DSC comment (Since 1.2) 
  241.  
  242.       Cairo_Status_Invalid_Index, 
  243.       --  invalid index passed to getter (Since 1.4) 
  244.  
  245.       Cairo_Status_Clip_Not_Representable, 
  246.       --  clip region not representable in desired format (Since 1.4) 
  247.  
  248.       Cairo_Status_Temp_File_Error, 
  249.       --  error creating or writing to a temporary file (Since 1.6) 
  250.  
  251.       Cairo_Status_Invalid_Stride, 
  252.       --  invalid value for stride (Since 1.6) 
  253.  
  254.       Cairo_Status_Font_Type_Mismatch, 
  255.       --  the font type is not appropriate for the operation (Since 1.8) 
  256.  
  257.       Cairo_Status_User_Font_Immutable, 
  258.       --  the user-font is immutable (Since 1.8) 
  259.  
  260.       Cairo_Status_User_Font_Error, 
  261.       --  error occurred in a user-font callback function (Since 1.8) 
  262.  
  263.       Cairo_Status_Negative_Count, 
  264.       --  negative number used where it is not allowed (Since 1.8) 
  265.  
  266.       Cairo_Status_Invalid_Clusters, 
  267.       --  input clusters do not represent the accompanying text and glyph 
  268.       --  array (Since 1.8) 
  269.  
  270.       Cairo_Status_Invalid_Slant, 
  271.       --  invalid value for an input Cairo_Font_Slant (Since 1.8) 
  272.  
  273.       Cairo_Status_Invalid_Weight 
  274.       --  invalid value for an input Cairo_Font_Weight (Since 1.8) 
  275.      ); 
  276.  
  277.    subtype Cairo_Content is Guint; 
  278.    --  Cairo_content is used to describe the content that a surface will 
  279.    --  contain, whether color information, alpha information (translucence 
  280.    --  vs. opacity), or both. 
  281.    -- 
  282.    --  Note: The large values here are designed to keep Cairo_Content 
  283.    --  values distinct from Cairo_Format values so that the 
  284.    --  implementation can detect the error if users confuse the two types. 
  285.  
  286.    Cairo_Content_Color       : constant Cairo_Content := 4096; 
  287.    --  The surface will hold color content only. 
  288.  
  289.    Cairo_Content_Alpha       : constant Cairo_Content := 8192; 
  290.    --  CAIRO_CONTENT_ALPHA: The surface will hold alpha content only. 
  291.  
  292.    Cairo_Content_Color_Alpha : constant Cairo_Content := 12288; 
  293.    --  CAIRO_CONTENT_COLOR_ALPHA: The surface will hold color and alpha 
  294.    --  content. 
  295.  
  296.    function Create (Target : Cairo_Surface) return Cairo_Context; 
  297.    --  Target: Target surface for the context 
  298.    -- 
  299.    --  Creates a new Cairo_Context with all graphics state parameters set to 
  300.    --  default values and with target as a target surface. The target 
  301.    --  surface should be constructed with a backend-specific function such 
  302.    --  as Cairo.Image_Surface.Create. 
  303.    -- 
  304.    --  This function references target, so you can immediately 
  305.    --  call Cairo.Surface.Destroy on it if you don't need to 
  306.    --  maintain a separate reference to it. 
  307.    -- 
  308.    --  Return value: a newly allocated Cairo_Context with a reference 
  309.    --  count of 1. The initial reference count should be released 
  310.    --  with Destroy when you are done using the Cairo_Context. 
  311.    --  This function never returns NULL. If memory cannot be 
  312.    --  allocated, a special Cairo_Context object will be returned on 
  313.    --  which Status returns Cairo_Status_No_Memory. 
  314.    --  You can use this object normally, but no drawing will 
  315.    --  be done. 
  316.  
  317.    function Reference (Cr : Cairo_Context) return Cairo_Context; 
  318.    --  Cr: a Cairo_Context 
  319.    -- 
  320.    --  Increases the reference count on cr by one. This prevents 
  321.    --  cr from being destroyed until a matching call to Destroy 
  322.    --  is made. 
  323.    -- 
  324.    --  The number of references to a Cairo_Context can be retrieved using 
  325.    --  Get_Reference_Count. 
  326.    -- 
  327.    --  Return value: the referenced Cairo_Context. 
  328.  
  329.    procedure Destroy (Cr : Cairo_Context); 
  330.    pragma Import (C, Destroy, "cairo_destroy"); 
  331.    --  Cr: a Cairo_Context 
  332.    -- 
  333.    --  Decreases the reference count on cr by one. If the result 
  334.    --  is zero, then cr and all associated resources are freed. 
  335.    --  See Reference. 
  336.  
  337.    procedure Surface_Destroy (Surface : Cairo_Surface); 
  338.    pragma Import (C, Surface_Destroy, "cairo_surface_destroy"); 
  339.    --  Free the memory used by the surface 
  340.  
  341.    function Get_Reference_Count (Cr : Cairo_Context) return Guint; 
  342.    --  Cr: a Cairo_Context 
  343.    -- 
  344.    --  Returns the current reference count of cr. 
  345.    -- 
  346.    --  Return value: the current reference count of cr.  If the 
  347.    --  object is a nil object, 0 will be returned. 
  348.    -- 
  349.    --  Since: 1.4 
  350.  
  351.    function Get_User_Data 
  352.      (Cr   : Cairo_Context; 
  353.       Key  : access Cairo_User_Data_Key) 
  354.       return System.Address; 
  355.    --  Cr: a Cairo_Context 
  356.    --  Key: the address of the Cairo_User_Data_Key the user data was 
  357.    --  attached to 
  358.    -- 
  359.    --  Return user data previously attached to cr using the specified 
  360.    --  key.  If no user data has been attached with the given key this 
  361.    --  function returns NULL. 
  362.    -- 
  363.    --  Return value: the user data previously attached or NULL. 
  364.    -- 
  365.    --  Since: 1.4 
  366.  
  367.    function Set_User_Data 
  368.      (Cr        : Cairo_Context; 
  369.       Key       : access Cairo_User_Data_Key; 
  370.       User_Data : System.Address; 
  371.       Destroy   : Cairo_Destroy_Func) 
  372.       return      Cairo_Status; 
  373.    --  Cr: a Cairo_Context 
  374.    --  Key: the address of a Cairo_User_Data_Key to attach the user data to 
  375.    --  User_Data: the user data to attach to the Cairo_Context 
  376.    --  Destroy: a Cairo_Destroy_Func which will be called when the 
  377.    --  Cairo_Context is destroyed or when new user data is attached using the 
  378.    --  same key. 
  379.    -- 
  380.    --  Attach user data to cr.  To remove user data from a surface, 
  381.    --  call this function with the key that was used to set it and NULL 
  382.    --  for data. 
  383.    -- 
  384.    --  Return value: CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a 
  385.    --  slot could not be allocated for the user data. 
  386.    -- 
  387.    --  Since: 1.4 
  388.  
  389.    procedure Save (Cr : Cairo_Context); 
  390.    --  Cr: a Cairo_Context 
  391.    -- 
  392.    --  Makes a copy of the current state of cr and saves it 
  393.    --  on an internal stack of saved states for cr. When 
  394.    --  Cairo_Restore is called, cr will be restored to 
  395.    --  the saved state. Multiple calls to Cairo_Save and 
  396.    --  Cairo_Restore can be nested; each call to Cairo_Restore 
  397.    --  restores the state from the matching paired Cairo_Save. 
  398.    -- 
  399.    --  It isn't necessary to clear all saved states before 
  400.    --  a Cairo_Context is freed. If the reference count of a Cairo_Context 
  401.    --  drops to zero in response to a call to Cairo_Destroy, 
  402.    --  any saved states will be freed along with the Cairo_Context. 
  403.  
  404.    procedure Restore (Cr : Cairo_Context); 
  405.    --  Cr: a Cairo_Context 
  406.    -- 
  407.    --  Restores cr to the state saved by a preceding call to 
  408.    --  Cairo_Save and removes that state from the stack of 
  409.    --  saved states. 
  410.  
  411.    procedure Push_Group (Cr : Cairo_Context); 
  412.    --  Cr: a cairo context 
  413.    -- 
  414.    --  Temporarily redirects drawing to an intermediate surface known as a 
  415.    --  group. The redirection lasts until the group is completed by a call 
  416.    --  to Pop_Group or Pop_Group_To_Source. 
  417.    -- 
  418.    --  These calls provide the result of any drawing to the group as a pattern, 
  419.    --  (either as an explicit object, or set as the source pattern). 
  420.    -- 
  421.    --  This group functionality can be convenient for performing 
  422.    --  intermediate compositing. One common use of a group is to render 
  423.    --  objects as opaque within the group, (so that they occlude each 
  424.    --  other), and then blend the result with translucence onto the 
  425.    --  destination. 
  426.    -- 
  427.    --  Groups can be nested arbitrarily deep by making balanced calls to 
  428.    --  Push_Group/Pop_Group. Each call pushes/pops the new target group 
  429.    --  onto/from a stack. 
  430.    -- 
  431.    --  The Push_Group function calls Save so that any changes to the graphics 
  432.    --  state will not be visible outside the group, (the pop_group functions 
  433.    --  call Restore). 
  434.    -- 
  435.    --  By default the intermediate group will have a content type of 
  436.    --  Cairo_Content_Color_Alphe. Other content types can be chosen for 
  437.    --  the group by using Push_Group_With_Content instead. 
  438.    -- 
  439.    --  As an example, here is how one might fill and stroke a path with 
  440.    --  translucence, but without any portion of the fill being visible 
  441.    --  under the stroke: 
  442.    -- 
  443.    --      Push_Group (Cr); 
  444.    --      Set_Source (Cr, Fill_Pattern); 
  445.    --      Fill_Preserve (Cr); 
  446.    --      Set_Source (Cr, Stroke_Pattern); 
  447.    --      Stroke (Cr); 
  448.    --      Pop_Group_To_Source (Cr); 
  449.    --      Paint_With_Alpha (Cr, Alpha); 
  450.    -- 
  451.    --  Since: 1.2 
  452.  
  453.    procedure Push_Group_With_Content 
  454.      (Cr      : Cairo_Context; 
  455.       Content : Cairo_Content); 
  456.    --  Cr: a cairo context 
  457.    --  Content: a Cairo_Content indicating the type of group that 
  458.    --            will be created 
  459.    -- 
  460.    --  Temporarily redirects drawing to an intermediate surface known as a 
  461.    --  group. The redirection lasts until the group is completed by a call to 
  462.    --  Pop_Group or Pop_Group_To_Source. These calls provide the result of any 
  463.    --  drawing to the group as a pattern, (either as an explicit object, or set 
  464.    --  as the source pattern). 
  465.    -- 
  466.    --  The group will have a content type of content. The ability to control 
  467.    --  this content type is the only distinction between this function and 
  468.    --  Push_Group which you should see for a more detailed description of group 
  469.    --  rendering. 
  470.    -- 
  471.    --  Since: 1.2 
  472.  
  473.    function Pop_Group (Cr : Cairo_Context) return Cairo_Pattern; 
  474.    --  Cr: a cairo context 
  475.    -- 
  476.    --  Terminates the redirection begun by a call to Push_Group or 
  477.    --  Push_Group_With_Content and returns a new pattern containing the results 
  478.    --  of all drawing operations performed to the group. 
  479.    -- 
  480.    --  The Pop_Group function calls Restore, (balancing a call to Save by the 
  481.    --  Push_Group function), so that any changes to the graphics state will not 
  482.    --  be visible outside the group. 
  483.    -- 
  484.    --  Return value: a newly created (surface) pattern containing the 
  485.    --  results of all drawing operations performed to the group. The 
  486.    --  caller owns the returned object and should call 
  487.    --  Cairo.Pattern.Destroy when finished with it. 
  488.    -- 
  489.    --  Since: 1.2 
  490.  
  491.    procedure Pop_Group_To_Source (Cr : Cairo_Context); 
  492.    --  Cr: a cairo context 
  493.    -- 
  494.    --  Terminates the redirection begun by a call to Push_Group or 
  495.    --  Push_Group_With_Content and installs the resulting pattern as the source 
  496.    --  pattern in the given cairo context. 
  497.    -- 
  498.    --  The behavior of this function is equivalent to the sequence of 
  499.    --  operations: 
  500.    -- 
  501.    --  declare 
  502.    --     Group: Cairo_Pattern := Pop_Group (Cr); 
  503.    --  begin 
  504.    --     Set_Source (Cr, Group); 
  505.    --     Cairo.Pattern.Destroy (Group); 
  506.    --  end; 
  507.    -- 
  508.    --  but is more convenient as their is no need for a variable to store 
  509.    --  the short-lived pointer to the pattern. 
  510.    -- 
  511.    --  The Pop_Group function calls Restore, (balancing a call to Save by the 
  512.    --  push_group function), so that any changes to the graphics state will not 
  513.    --  be visible outside the group. 
  514.    -- 
  515.    --  Since: 1.2 
  516.  
  517.    --  Cairo_operator is used to set the compositing operator for all cairo 
  518.    --  drawing operations. 
  519.    -- 
  520.    --  The default operator is Cairo_Operator_Over. 
  521.    -- 
  522.    --  The operators marked as "unbounded" modify their destination even 
  523.    --  outside of the mask layer (that is, their effect is not bound by the 
  524.    --  mask layer). However, their effect can still be limited by way of 
  525.    --  clipping. 
  526.    -- 
  527.    --  To keep things simple, the operator descriptions here document the 
  528.    --  behavior for when both source and destination are either fully 
  529.    --  transparent or fully opaque. The actual implementation works for 
  530.    --  translucent layers too. 
  531.    -- 
  532.    --  For a more detailed explanation of the effects of each operator, 
  533.    --  including the mathematical definitions, see 
  534.    --  http://cairographics.org/operators/ 
  535.    type Cairo_Operator is 
  536.      (Cairo_Operator_Clear, 
  537.       --  clear destination layer (bounded) 
  538.  
  539.       Cairo_Operator_Source, 
  540.       --  replace destination layer (bounded) 
  541.  
  542.       Cairo_Operator_Over, 
  543.       --  draw source layer on top of destination layer (bounded) 
  544.  
  545.       Cairo_Operator_In, 
  546.       --  draw source where there was destination content (unbounded) 
  547.  
  548.       Cairo_Operator_Out, 
  549.       --  draw source where there was no destination content (unbounded) 
  550.  
  551.       Cairo_Operator_Atop, 
  552.       --  draw source on top of destination content and only there 
  553.  
  554.       Cairo_Operator_Dest, 
  555.       --  ignore the source 
  556.  
  557.       Cairo_Operator_Dest_Over, 
  558.       --  draw destination on top of source 
  559.  
  560.       Cairo_Operator_Dest_In, 
  561.       --  leave destination only where there was source content (unbounded) 
  562.  
  563.       Cairo_Operator_Dest_Out, 
  564.       --  leave destination only where there was no source content 
  565.  
  566.       Cairo_Operator_Dest_Atop, 
  567.       --  leave destination on top of source content and only there (unbounded) 
  568.  
  569.       Cairo_Operator_Xor, 
  570.       --  source and destination are shown where there is only one of them 
  571.  
  572.       Cairo_Operator_Add, 
  573.       --  source and destination layers are accumulated 
  574.  
  575.       Cairo_Operator_Saturate 
  576.       --  like over, but assuming source and dest are disjoint geometries 
  577.      ); 
  578.  
  579.    procedure Set_Operator (Cr : Cairo_Context; Op : Cairo_Operator); 
  580.    --  Cr: a Cairo_Context 
  581.    --  Op: a compositing Operator, specified as a Cairo_Operator 
  582.    -- 
  583.    --  Sets the compositing operator to be used for all drawing 
  584.    --  operations. See Cairo_Operator for details on the semantics of 
  585.    --  each available compositing operator. 
  586.    -- 
  587.    --  The default operator is Cairo_Operator_Over. 
  588.  
  589.    function Pattern_Create_Rgb 
  590.      (Red, Green, Blue : Gdouble) return Cairo_Pattern; 
  591.    pragma Import (C, Pattern_Create_Rgb, "cairo_pattern_create_rgb"); 
  592.  
  593.    function Pattern_Create_Rgba 
  594.      (Red, Green, Blue, Alpha : Gdouble) return Cairo_Pattern; 
  595.    pragma Import (C, Pattern_Create_Rgba, "cairo_pattern_create_rgba"); 
  596.  
  597.    function Pattern_Create_For_Surface 
  598.      (Surface : Cairo_Surface) return Cairo_Pattern; 
  599.    pragma Import (C, Pattern_Create_For_Surface, 
  600.                   "cairo_pattern_create_for_surface"); 
  601.  
  602.    function Pattern_Create_Linear 
  603.      (X0, Y0, X1, Y1 : Gdouble) return Cairo_Pattern; 
  604.    pragma Import (C, Pattern_Create_Linear, "cairo_pattern_create_linear"); 
  605.    --  See Pattern_Add_Color_Stop to specify the colors 
  606.  
  607.    function Pattern_Create_Radial 
  608.      (Cx0, Cy0, Radius0, Cx1, Cy1, Radius1 : Gdouble) return Cairo_Pattern; 
  609.    pragma Import (C, Pattern_Create_Radial, "cairo_pattern_create_radial"); 
  610.  
  611.    procedure Pattern_Destroy (Pattern : Cairo_Pattern); 
  612.    pragma Import (C, Pattern_Destroy, "cairo_pattern_destroy"); 
  613.  
  614.    procedure Pattern_Add_Color_Stop_Rgb 
  615.      (Pattern : Cairo_Pattern; 
  616.       Offset  : Gdouble; 
  617.       Red, Green, Blue : Gdouble); 
  618.    pragma Import 
  619.      (C, Pattern_Add_Color_Stop_Rgb, "cairo_pattern_add_color_stop_rgb"); 
  620.  
  621.    procedure Pattern_Add_Color_Stop_Rgba 
  622.      (Pattern : Cairo_Pattern; 
  623.       Offset  : Gdouble; 
  624.       Red, Green, Blue, Alpha : Gdouble); 
  625.    pragma Import 
  626.      (C, Pattern_Add_Color_Stop_Rgba, "cairo_pattern_add_color_stop_rgba"); 
  627.  
  628.    procedure Set_Source (Cr : Cairo_Context; Source : Cairo_Pattern); 
  629.    --  Cr: a cairo context 
  630.    --  Source: a Cairo_Pattern to be used as the Source for 
  631.    --  subsequent drawing operations. 
  632.    -- 
  633.    --  Sets the source pattern within Cr to source. This pattern 
  634.    --  will then be used for any subsequent drawing operation until a new 
  635.    --  source pattern is set. 
  636.    -- 
  637.    --  Note: The pattern's transformation matrix will be locked to the user 
  638.    --  space in effect at the time of Set_Source. This means that further 
  639.    --  modifications of the current transformation matrix will not affect the 
  640.    --  source pattern. See Cairo.Pattern.Set_Matrix. 
  641.    -- 
  642.    --  The default source pattern is a solid pattern that is opaque black, 
  643.    --  (that is, it is equivalent to Set_Source_Rgb (Cr, 0.0, 0.0, 0.0)). 
  644.  
  645.    subtype Color_Range is Gdouble range 0.0 .. 1.0; 
  646.  
  647.    procedure Set_Source_Rgb 
  648.      (Cr    : Cairo_Context; 
  649.       Red   : Color_Range; 
  650.       Green : Color_Range; 
  651.       Blue  : Color_Range); 
  652.    --  Cr    : a cairo context 
  653.    --  Red   : Red component of color 
  654.    --  Green : Green component of color 
  655.    --  Blue  : Blue component of color 
  656.    -- 
  657.    --  Sets the source pattern within Cr to an opaque color. This opaque 
  658.    --  color will then be used for any subsequent drawing operation until 
  659.    --  a new source pattern is set. 
  660.    -- 
  661.    --  The color components are floating point numbers in the range 0 to 
  662.    --  1. If the values passed in are outside that range, they will be 
  663.    --  clamped. 
  664.    -- 
  665.    --  The default source pattern is opaque black, (that is, it is 
  666.    --  equivalent to Set_Source_Rgb (Cr, 0.0, 0.0, 0.0)). 
  667.  
  668.    procedure Set_Source_Rgba 
  669.      (Cr    : Cairo_Context; 
  670.       Red   : Color_Range; 
  671.       Green : Color_Range; 
  672.       Blue  : Color_Range; 
  673.       Alpha : Color_Range); 
  674.    --  Cr    : a cairo context 
  675.    --  Red   : Red component of color 
  676.    --  Green : Green component of color 
  677.    --  Blue  : Blue component of color 
  678.    --  Alpha : Alpha component of color 
  679.    -- 
  680.    --  Sets the source pattern within Cr to a translucent color. This 
  681.    --  color will then be used for any subsequent drawing operation until 
  682.    --  a new source pattern is set. 
  683.    -- 
  684.    --  The color and alpha components are floating point numbers in the 
  685.    --  range 0 to 1. If the values passed in are outside that range, they 
  686.    --  will be clamped. 
  687.    -- 
  688.    --  The default source pattern is opaque black, (that is, it is 
  689.    --  equivalent to Set_Source_Rgba (Cr, 0.0, 0.0, 0.0, 1.0)). 
  690.  
  691.    procedure Set_Source_Surface 
  692.      (Cr      : Cairo_Context; 
  693.       Surface : Cairo_Surface; 
  694.       X       : Gdouble; 
  695.       Y       : Gdouble); 
  696.    --  Cr      : a cairo context 
  697.    --  Surface : a Surface to be used to set the source pattern 
  698.    --  X       : User-space X coordinate for surface origin 
  699.    --  Y       : User-space Y coordinate for surface origin 
  700.    -- 
  701.    --  This is a convenience function for creating a pattern from surface 
  702.    --  and setting it as the source in Cr with Set_Source. 
  703.    -- 
  704.    --  The X and Y parameters give the user-space coordinate at which 
  705.    --  the surface origin should appear. (The surface origin is its 
  706.    --  upper-left corner before any transformation has been applied.) The 
  707.    --  X and Y patterns are negated and then set as translation values 
  708.    --  in the pattern matrix. 
  709.    -- 
  710.    --  Other than the initial translation pattern matrix, as described 
  711.    --  above, all other pattern attributes, (such as its extend mode), are 
  712.    --  set to the default values as in Cairo.Pattern.Create_For_Surface. 
  713.    --  The resulting pattern can be queried with Get_Source so that these 
  714.    --  attributes can be modified if desired, (eg. to create a 
  715.    --  repeating pattern with Cairo.Pattern.Set_Extend). 
  716.  
  717.    procedure Set_Tolerance (Cr : Cairo_Context; Tolerance : Gdouble); 
  718.    --  Cr: a Cairo_Context 
  719.    --  Tolerance: the Tolerance, in device units (typically pixels) 
  720.    -- 
  721.    --  Sets the tolerance used when converting paths into trapezoids. 
  722.    --  Curved segments of the path will be subdivided until the maximum 
  723.    --  deviation between the original path and the polygonal approximation 
  724.    --  is less than tolerance. The default value is 0.1. A larger 
  725.    --  value will give better performance, a smaller value, better 
  726.    --  appearance. (Reducing the value from the default value of 0.1 
  727.    --  is unlikely to improve appearance significantly.)  The accuracy of paths 
  728.    --  within Cairo is limited by the precision of its internal arithmetic, and 
  729.    --  the prescribed tolerance is restricted to the smallest 
  730.    --  representable internal value. 
  731.  
  732.    --  Specifies the type of antialiasing to do when rendering text or shapes. 
  733.    type Cairo_Antialias is 
  734.      ( 
  735.       Cairo_Antialias_Default, 
  736.       --  Use the default antialiasing for the subsystem and target device 
  737.  
  738.       Cairo_Antialias_None, 
  739.       --  Use a bilevel alpha mask 
  740.  
  741.       Cairo_Antialias_Gray, 
  742.       --  Perform single-color antialiasing (using shades of gray for black 
  743.       --  text on a white background, for example). 
  744.  
  745.       Cairo_Antialias_Subpixel 
  746.       --  Perform antialiasing by taking advantage of the order of subpixel 
  747.       --  elements on devices such as LCD panels 
  748.      ); 
  749.  
  750.    procedure Set_Antialias 
  751.      (Cr        : Cairo_Context; 
  752.       Antialias : Cairo_Antialias); 
  753.    --  Cr: a Cairo_Context 
  754.    --  Antialias: the new Antialiasing mode 
  755.    -- 
  756.    --  Set the antialiasing mode of the rasterizer used for drawing shapes. 
  757.    --  This value is a hint, and a particular backend may or may not support 
  758.    --  a particular value.  At the current time, no backend supports 
  759.    --  Cairo_Antialias_Subpixel when drawing shapes. 
  760.    -- 
  761.    --  Note that this option does not affect text rendering, instead see 
  762.    --  Cairo.Font_Options.Set_Antialias. 
  763.  
  764.    --  Cairo_Fill_Rule is used to select how paths are filled. For both 
  765.    --  fill rules, whether or not a point is included in the fill is 
  766.    --  determined by taking a ray from that point to infinity and looking 
  767.    --  at intersections with the path. The ray can be in any direction, 
  768.    --  as long as it doesn't pass through the end point of a segment 
  769.    --  or have a tricky intersection such as intersecting tangent to the path. 
  770.    --  (Note that filling is not actually implemented in this way. This 
  771.    --  is just a description of the rule that is applied.) 
  772.    -- 
  773.    --  The default fill rule is Cairo_Fill_Rule_Winding. 
  774.    -- 
  775.    --  New entries may be added in future versions. 
  776.    type Cairo_Fill_Rule is 
  777.      (Cairo_Fill_Rule_Winding, 
  778.       --  If the path crosses the ray from left-to-right, counts +1. If the 
  779.       --  path crosses the ray from right to left, counts -1. (Left and right 
  780.       --  are determined from the perspective of looking along the ray from 
  781.       --  the starting point). If the total count is non-zero, the point will 
  782.       --  be filled. 
  783.  
  784.       Cairo_Fill_Rule_Even_Odd 
  785.       --  Counts the total number of 
  786.       --  intersections, without regard to the orientation of the contour. If 
  787.       --  the total number of intersections is odd, the point will be filled. 
  788.      ); 
  789.  
  790.    procedure Set_Fill_Rule 
  791.      (Cr        : Cairo_Context; 
  792.       Fill_Rule : Cairo_Fill_Rule); 
  793.    --  Cr: a Cairo_Context 
  794.    --  Fill_Rule: a fill rule 
  795.    -- 
  796.    --  Set the current fill rule within the cairo context. The fill rule is 
  797.    --  used to determine which regions are inside or outside a complex 
  798.    --  (potentially self-intersecting) path. The current fill rule affects both 
  799.    --  Fill and Clip. See Cairo_Fill_Rule for details on the semantics of each 
  800.    --  available fill rule. 
  801.    -- 
  802.    --  The default fill rule is Cairo_Fill_Rule_Winding. 
  803.  
  804.    procedure Set_Line_Width (Cr : Cairo_Context; Width : Gdouble); 
  805.    --  Cr: a Cairo_Context 
  806.    --  Width: a line Width 
  807.    -- 
  808.    --  Sets the current line width within the cairo context. The line 
  809.    --  width value specifies the diameter of a pen that is circular in 
  810.    --  user space, (though device-space pen may be an ellipse in general 
  811.    --  due to scaling/shear/rotation of the CTM). 
  812.    -- 
  813.    --  Note: When the description above refers to user space and CTM it 
  814.    --  refers to the user space and CTM in effect at the time of the 
  815.    --  stroking operation, not the user space and CTM in effect at the 
  816.    --  time of the call to Set_Line_Width. The simplest usage 
  817.    --  makes both of these spaces identical. That is, if there is no 
  818.    --  change to the CTM between a call to Set_Line_Width and the 
  819.    --  stroking operation, then one can just pass user-space values to 
  820.    --  Set_Line_Width and ignore this note. 
  821.    -- 
  822.    --  As with the other stroke parameters, the current line width is examined 
  823.    --  by Stroke, Stroke_Extents, and Stroke_To_Path, but does not have any 
  824.    --  effect during path construction. 
  825.    -- 
  826.    --  The default line width value is 2.0. 
  827.  
  828.    type Cairo_Line_Cap is 
  829.      (Cairo_Line_Cap_Butt, 
  830.       --  start(stop) the line exactly at the start(end) point 
  831.  
  832.       Cairo_Line_Cap_Round, 
  833.       --  use a round ending, the center of the circle is the end point 
  834.  
  835.       Cairo_Line_Cap_Square 
  836.       --  use squared ending, the center of the square is the end point 
  837.      ); 
  838.    --  Specifies how to render the endpoints of the path when stroking. 
  839.    -- 
  840.    --  The default line cap style is Cairo_Line_Cap_Butt. 
  841.  
  842.    procedure Set_Line_Cap (Cr : Cairo_Context; Line_Cap : Cairo_Line_Cap); 
  843.    --  Cr: a cairo context 
  844.    --  Line_Cap: a line cap style 
  845.    -- 
  846.    --  Sets the current line cap style within the cairo context. See 
  847.    --  Cairo_Line_Cap for details about how the available line cap 
  848.    --  styles are drawn. 
  849.    -- 
  850.    --  As with the other stroke parameters, the current line cap style is 
  851.    --  examined by Stroke, Stroke_Extents, and Stroke_To_Path, but does not 
  852.    --  have any effect during path construction. 
  853.    -- 
  854.    --  The default line cap style is Cairo_Line_Cap_Butt. 
  855.  
  856.    type Cairo_Line_Join is 
  857.      (Cairo_Line_Join_Miter, 
  858.       --  use a sharp (angled) corner, see Set_Miter_Limit 
  859.  
  860.       Cairo_Line_Join_Round, 
  861.       --  use a rounded join, the center of the circle is the joint point 
  862.  
  863.       Cairo_Line_Join_Bevel 
  864.       --  use a cut-off join, the join is cut off at half the line width from 
  865.       --  the joint point 
  866.      ); 
  867.    --  Specifies how to render the junction of two lines when stroking. 
  868.    -- 
  869.    --  The default line join style is Cairo_Line_Join_Miter. 
  870.  
  871.    procedure Set_Line_Join 
  872.      (Cr        : Cairo_Context; 
  873.       Line_Join : Cairo_Line_Join); 
  874.    --  Cr: a cairo context 
  875.    --  Line_Join: a line join style 
  876.    -- 
  877.    --  Sets the current line join style within the cairo context. See 
  878.    --  Cairo_Line_Join for details about how the available line join styles are 
  879.    --  drawn. 
  880.    -- 
  881.    --  As with the other stroke parameters, the current line join style is 
  882.    --  examined by Stroke, Stroke_Extents, and Stroke_To_Path, but does 
  883.    --  not have any effect during path construction. 
  884.    -- 
  885.    --  The default line join style is Cairo_Line_Join_Miter. 
  886.  
  887.    type Dash_Array is array (Natural range <>) of Gdouble; 
  888.  
  889.    No_Dashes : constant Dash_Array (1 .. 0) := (others => 0.0); 
  890.  
  891.    procedure Set_Dash 
  892.      (Cr         : Cairo_Context; 
  893.       Dashes     : Dash_Array; 
  894.       Offset     : Gdouble); 
  895.    --  Cr: a cairo context 
  896.    --  Dashes: an array specifying alternate lengths of on and off stroke 
  897.    --  portions 
  898.    --  Offset: an Offset into the dash pattern at which the stroke should start 
  899.    -- 
  900.    --  Sets the dash pattern to be used by Stroke. A dash pattern 
  901.    --  is specified by dashes, an array of positive values. Each value 
  902.    --  provides the length of alternate "on" and "off" portions of the 
  903.    --  stroke. The offset specifies an offset into the pattern at which 
  904.    --  the stroke begins. 
  905.    -- 
  906.    --  Each "on" segment will have caps applied as if the segment were a 
  907.    --  separate sub-path. In particular, it is valid to use an "on" length 
  908.    --  of 0.0 with Cairo_Line_Cap_Round or Cairo_Line_Cap_Square in order 
  909.    --  to distributed dots or squares along a path. 
  910.    -- 
  911.    --  Note: The length values are in user-space units as evaluated at the 
  912.    --  time of stroking. This is not necessarily the same as the user 
  913.    --  space at the time of Set_Dash. 
  914.    -- 
  915.    --  If the array is No_Dashes, dashing is disabled. 
  916.    -- 
  917.    --  If the array contains only one element symmetric pattern is assumed with 
  918.    --  alternating on and off portions of the size specified by the single 
  919.    --  value in dashes. 
  920.    -- 
  921.    --  If any value in dashes is negative, or if all values are 0, then 
  922.    --  cr will be put into an error state with a status of 
  923.    --  Cairo_Status_Invalid_Dash. 
  924.  
  925.    procedure Set_Miter_Limit (Cr : Cairo_Context; Limit : Gdouble); 
  926.    --  Cr: a cairo context 
  927.    --  Limit: miter Limit to set 
  928.    -- 
  929.    --  Sets the current miter limit within the cairo context. 
  930.    -- 
  931.    --  If the current line join style is set to Cairo_Line_Join_Miter 
  932.    --  (see Cairo_Set_Line_Join), the miter limit is used to determine 
  933.    --  whether the lines should be joined with a bevel instead of a miter. 
  934.    --  Cairo divides the length of the miter by the line width. 
  935.    --  If the result is greater than the miter limit, the style is 
  936.    --  converted to a bevel. 
  937.    -- 
  938.    --  As with the other stroke parameters, the current line miter limit is 
  939.    --  examined by Stroke, Stroke_Extents, and Stroke_To_Path, but does not 
  940.    --  have any effect during path construction. 
  941.    -- 
  942.    --  The default miter limit value is 10.0, which will convert joins 
  943.    --  with interior angles less than 11 degrees to bevels instead of 
  944.    --  miters. For reference, a miter limit of 2.0 makes the miter cutoff 
  945.    --  at 60 degrees, and a miter limit of 1.414 makes the cutoff at 90 
  946.    --  degrees. 
  947.    -- 
  948.    --  A miter limit for a desired angle can be computed as: miter limit = 
  949.    --  1/sin(angle/2) 
  950.  
  951.    procedure Translate (Cr : Cairo_Context; Tx : Gdouble; Ty : Gdouble); 
  952.    --  Cr: a cairo context 
  953.    --  Tx: amount to translate in the X direction 
  954.    --  Ty: amount to translate in the Y direction 
  955.    -- 
  956.    --  Modifies the current transformation matrix (CTM) by translating the 
  957.    --  user-space origin by (tx, ty). This offset is interpreted as a 
  958.    --  user-space coordinate according to the CTM in place before the new 
  959.    --  call to Translate. In other words, the translation of the 
  960.    --  user-space origin takes place after any existing transformation. 
  961.  
  962.    procedure Scale (Cr : Cairo_Context; Sx : Gdouble; Sy : Gdouble); 
  963.    --  Cr: a cairo context 
  964.    --  Sx: scale factor for the X dimension 
  965.    --  Sy: scale factor for the Y dimension 
  966.    -- 
  967.    --  Modifies the current transformation matrix (CTM) by scaling the X 
  968.    --  and Y user-space axes by sx and sy respectively. The scaling of 
  969.    --  the axes takes place after any existing transformation of user 
  970.    --  space. 
  971.  
  972.    procedure Rotate (Cr : Cairo_Context; Angle : Gdouble); 
  973.    --  Cr: a cairo context 
  974.    --  Angle: Angle (in radians) by which the user-space axes will be 
  975.    --  rotated 
  976.    -- 
  977.    --  Modifies the current transformation matrix (CTM) by rotating the 
  978.    --  user-space axes by angle radians. The rotation of the axes takes 
  979.    --  places after any existing transformation of user space. The 
  980.    --  rotation direction for positive angles is from the positive X axis 
  981.    --  toward the positive Y axis. 
  982.  
  983.    procedure Transform 
  984.      (Cr     : Cairo_Context; 
  985.       Matrix : access Cairo_Matrix); 
  986.    --  Cr: a cairo context 
  987.    --  Matrix: a transformation to be applied to the user-space axes 
  988.    -- 
  989.    --  Modifies the current transformation matrix (CTM) by applying 
  990.    --  matrix as an additional transformation. The new transformation of 
  991.    --  user space takes place after any existing transformation. 
  992.  
  993.    procedure Set_Matrix 
  994.      (Cr     : Cairo_Context; 
  995.       Matrix : access Cairo_Matrix); 
  996.    --  Cr: a cairo context 
  997.    --  Matrix: a transformation Matrix from user space to device space 
  998.    -- 
  999.    --  Modifies the current transformation matrix (CTM) by setting it 
  1000.    --  equal to matrix. 
  1001.  
  1002.    procedure Identity_Matrix (Cr : Cairo_Context); 
  1003.    --  Cr: a cairo context 
  1004.    -- 
  1005.    --  Resets the current transformation matrix (CTM) by setting it equal 
  1006.    --  to the identity matrix. That is, the user-space and device-space 
  1007.    --  axes will be aligned and one user-space unit will transform to one 
  1008.    --  device-space unit. 
  1009.  
  1010.    procedure User_To_Device 
  1011.      (Cr : Cairo_Context; 
  1012.       X  : access Gdouble; 
  1013.       Y  : access Gdouble); 
  1014.    --  Cr: a cairo context 
  1015.    --  X: X value of coordinate (in/out parameter) 
  1016.    --  Y: Y value of coordinate (in/out parameter) 
  1017.    -- 
  1018.    --  Transform a coordinate from user space to device space by 
  1019.    --  multiplying the given point by the current transformation matrix 
  1020.    --  (CTM). 
  1021.  
  1022.    procedure User_To_Device_Distance 
  1023.      (Cr : Cairo_Context; 
  1024.       Dx : access Gdouble; 
  1025.       Dy : access Gdouble); 
  1026.    --  Cr: a cairo context 
  1027.    --  Dx: X component of a distance vector (in/out parameter) 
  1028.    --  Dy: Y component of a distance vector (in/out parameter) 
  1029.    -- 
  1030.    --  Transform a distance vector from user space to device space. This 
  1031.    --  function is similar to User_To_Device except that the translation 
  1032.    --  components of the CTM will be ignored when transforming (Dx,Dy). 
  1033.  
  1034.    procedure Device_To_User 
  1035.      (Cr : Cairo_Context; 
  1036.       X  : access Gdouble; 
  1037.       Y  : access Gdouble); 
  1038.    --  Cr: a cairo 
  1039.    --  X: X value of coordinate (in/out parameter) 
  1040.    --  Y: Y value of coordinate (in/out parameter) 
  1041.    -- 
  1042.    --  Transform a coordinate from device space to user space by 
  1043.    --  multiplying the given point by the inverse of the current 
  1044.    --  transformation matrix (CTM). 
  1045.  
  1046.    procedure Device_To_User_Distance 
  1047.      (Cr : Cairo_Context; 
  1048.       Dx : access Gdouble; 
  1049.       Dy : access Gdouble); 
  1050.    --  Cr: a cairo context 
  1051.    --  Dx: X component of a distance vector (in/out parameter) 
  1052.    --  Dy: Y component of a distance vector (in/out parameter) 
  1053.    -- 
  1054.    --  Transform a distance vector from device space to user space. This 
  1055.    --  function is similar to Device_To_User except that the 
  1056.    --  translation components of the inverse CTM will be ignored when 
  1057.    --  transforming (Dx,dy). 
  1058.  
  1059.    ------------------- 
  1060.    -- Path creation -- 
  1061.    ------------------- 
  1062.  
  1063.    procedure New_Path (Cr : Cairo_Context); 
  1064.    --  Cr: a cairo context 
  1065.    -- 
  1066.    --  Clears the current path. After this call there will be no path and 
  1067.    --  no current point. 
  1068.  
  1069.    procedure Move_To (Cr : Cairo_Context; X : Gdouble; Y : Gdouble); 
  1070.    --  Cr: a cairo context 
  1071.    --  X: the X coordinate of the new position 
  1072.    --  Y: the Y coordinate of the new position 
  1073.    -- 
  1074.    --  Begin a new sub-path. After this call the current point will be (X, Y). 
  1075.  
  1076.    procedure New_Sub_Path (Cr : Cairo_Context); 
  1077.    --  Cr: a cairo context 
  1078.    -- 
  1079.    --  Begin a new sub-path. Note that the existing path is not 
  1080.    --  affected. After this call there will be no current point. 
  1081.    -- 
  1082.    --  In many cases, this call is not needed since new sub-paths are 
  1083.    --  frequently started with Move_To. 
  1084.    -- 
  1085.    --  A call to New_Sub_Path is particularly useful when 
  1086.    --  beginning a new sub-path with one of the Arc calls. This 
  1087.    --  makes things easier as it is no longer necessary to manually 
  1088.    --  compute the arc's initial coordinates for a call to 
  1089.    --  Move_To. 
  1090.    -- 
  1091.    --  Since: 1.2 
  1092.  
  1093.    procedure Line_To (Cr : Cairo_Context; X : Gdouble; Y : Gdouble); 
  1094.    --  Cr: a cairo context 
  1095.    --  X: the X coordinate of the end of the new line 
  1096.    --  Y: the Y coordinate of the end of the new line 
  1097.    -- 
  1098.    --  Adds a line to the path from the current point to position (X, Y) 
  1099.    --  in user-space coordinates. After this call the current point 
  1100.    --  will be (X, Y). 
  1101.    -- 
  1102.    --  If there is no current point before the call to Line_To 
  1103.    --  this function will behave as Move_To (Cr, X, Y). 
  1104.  
  1105.    procedure Curve_To 
  1106.      (Cr : Cairo_Context; 
  1107.       X1 : Gdouble; 
  1108.       Y1 : Gdouble; 
  1109.       X2 : Gdouble; 
  1110.       Y2 : Gdouble; 
  1111.       X3 : Gdouble; 
  1112.       Y3 : Gdouble); 
  1113.    --  Cr: a cairo context 
  1114.    --  X1: the X coordinate of the first control point 
  1115.    --  Y1: the Y coordinate of the first control point 
  1116.    --  X2: the X coordinate of the second control point 
  1117.    --  Y2: the Y coordinate of the second control point 
  1118.    --  X3: the X coordinate of the end of the curve 
  1119.    --  Y3: the Y coordinate of the end of the curve 
  1120.    -- 
  1121.    --  Adds a cubic Bézier spline to the path from the current point to 
  1122.    --  position (X3, Y3) in user-space coordinates, using (X1, Y1) and 
  1123.    --  (X2, Y2) as the control points. After this call the current point 
  1124.    --  will be (X3, Y3). 
  1125.    -- 
  1126.    --  If there is no current point before the call to Curve_To 
  1127.    --  this function will behave as if preceded by a call to 
  1128.    --  Move_To (Cr, X1, Y1). 
  1129.  
  1130.    procedure Arc 
  1131.      (Cr     : Cairo_Context; 
  1132.       Xc     : Gdouble; 
  1133.       Yc     : Gdouble; 
  1134.       Radius : Gdouble; 
  1135.       Angle1 : Gdouble; 
  1136.       Angle2 : Gdouble); 
  1137.    --  Cr: a cairo context 
  1138.    --  Xc: X position of the center of the arc 
  1139.    --  Yc: Y position of the center of the arc 
  1140.    --  Radius: the Radius of the arc 
  1141.    --  Angle1: the start angle, in radians 
  1142.    --  Angle2: the end angle, in radians 
  1143.    -- 
  1144.    --  Adds a circular arc of the given radius to the current path.  The 
  1145.    --  arc is centered at (Xc, Yc), begins at Angle1 and proceeds in 
  1146.    --  the direction of increasing angles to end at Angle2. If Angle2 is 
  1147.    --  less than Angle1 it will be progressively increased by 2*M_PI 
  1148.    --  until it is greater than Angle1. 
  1149.    -- 
  1150.    --  If there is a current point, an initial line segment will be added 
  1151.    --  to the path to connect the current point to the beginning of the 
  1152.    --  arc. If this initial line is undesired, it can be avoided by 
  1153.    --  calling New_Sub_Path before calling Arc. 
  1154.    -- 
  1155.    --  Angles are measured in radians. An angle of 0.0 is in the direction 
  1156.    --  of the positive X axis (in user space). An angle of M_PI/2.0 radians 
  1157.    --  (90 degrees) is in the direction of the positive Y axis (in 
  1158.    --  user space). Angles increase in the direction from the positive X 
  1159.    --  axis toward the positive Y axis. So with the default transformation 
  1160.    --  matrix, angles increase in a clockwise direction. 
  1161.    -- 
  1162.    --  (To convert from degrees to radians, use degrees * (Pi / 180.0)) 
  1163.    -- 
  1164.    --  This function gives the arc in the direction of increasing angles; 
  1165.    --  see Cairo_Arc_Negative to get the arc in the direction of 
  1166.    --  decreasing angles. 
  1167.    -- 
  1168.    --  The arc is circular in user space. To achieve an elliptical arc, 
  1169.    --  you can scale the current transformation matrix by different 
  1170.    --  amounts in the X and Y directions. For example, to draw an ellipse 
  1171.    --  in the box given by X, Y, Width, Height: 
  1172.    -- 
  1173.    --  Cairo_Save (Cr); 
  1174.    --  Cairo_Translate (Cr, X + Width / 2.0, Y + Height / 2.0); 
  1175.    --  Cairo_Scale (Cr, Width / 2.0, Height / 2.0); 
  1176.    --  Cairo_Arc (Cr, 0.0, 0.0, 1.0, 0.0, 2 * Pi); 
  1177.    --  Cairo_Restore (Cr); 
  1178.  
  1179.    procedure Arc_Negative 
  1180.      (Cr     : Cairo_Context; 
  1181.       Xc     : Gdouble; 
  1182.       Yc     : Gdouble; 
  1183.       Radius : Gdouble; 
  1184.       Angle1 : Gdouble; 
  1185.       Angle2 : Gdouble); 
  1186.    --  Cr: a cairo context 
  1187.    --  Xc: X position of the center of the arc 
  1188.    --  Yc: Y position of the center of the arc 
  1189.    --  Radius: the Radius of the arc 
  1190.    --  Angle1: the start angle, in radians 
  1191.    --  Angle2: the end angle, in radians 
  1192.    -- 
  1193.    --  Adds a circular arc of the given radius to the current path.  The 
  1194.    --  arc is centered at (Xc, Yc), begins at Angle1 and proceeds in 
  1195.    --  the direction of decreasing angles to end at Angle2. If Angle2 is 
  1196.    --  greater than Angle1 it will be progressively decreased by 2*Pi 
  1197.    --  until it is less than Angle1. 
  1198.    -- 
  1199.    --  See Arc for more details. This function differs only in the 
  1200.    --  direction of the arc between the two angles. 
  1201.  
  1202.    procedure Rel_Move_To (Cr : Cairo_Context; Dx : Gdouble; Dy : Gdouble); 
  1203.    --  Cr: a cairo context 
  1204.    --  Dx: the X offset 
  1205.    --  Dy: the Y offset 
  1206.    -- 
  1207.    --  Begin a new sub-path. After this call the current point will offset 
  1208.    --  by (X, Y). 
  1209.    -- 
  1210.    --  Given a current point of (X, Y), Rel_Move_To (Cr, Dx, Dy) 
  1211.    --  is logically equivalent to Move_To (Cr, X + Dx, Y + Dy). 
  1212.    -- 
  1213.    --  It is an error to call this function with no current point. Doing 
  1214.    --  so will cause cr to shutdown with a status of 
  1215.    --  Cairo_Status_No_Current_Point. 
  1216.  
  1217.    procedure Rel_Line_To (Cr : Cairo_Context; Dx : Gdouble; Dy : Gdouble); 
  1218.    --  Cr: a cairo context 
  1219.    --  Dx: the X offset to the end of the new line 
  1220.    --  Dy: the Y offset to the end of the new line 
  1221.    -- 
  1222.    --  Relative-coordinate version of Line_To. Adds a line to the 
  1223.    --  path from the current point to a point that is offset from the 
  1224.    --  current point by (Dx, Dy) in user space. After this call the 
  1225.    --  current point will be offset by (Dx, Dy). 
  1226.    -- 
  1227.    --  Given a current point of (X, Y), Rel_Line_To (Cr, Dx, Dy) 
  1228.    --  is logically equivalent to Cairo_Line_To(Cr, X + Dx, Y + Dy). 
  1229.    -- 
  1230.    --  It is an error to call this function with no current point. Doing 
  1231.    --  so will cause cr to shutdown with a status of 
  1232.    --  Cairo_Status_No_Current_Point. 
  1233.  
  1234.    procedure Rel_Curve_To 
  1235.      (Cr  : Cairo_Context; 
  1236.       Dx1 : Gdouble; 
  1237.       Dy1 : Gdouble; 
  1238.       Dx2 : Gdouble; 
  1239.       Dy2 : Gdouble; 
  1240.       Dx3 : Gdouble; 
  1241.       Dy3 : Gdouble); 
  1242.    --  Cr: a cairo context 
  1243.    --  Dx1: the X offset to the first control point 
  1244.    --  Dy1: the Y offset to the first control point 
  1245.    --  Dx2: the X offset to the second control point 
  1246.    --  Dy2: the Y offset to the second control point 
  1247.    --  Dx3: the X offset to the end of the curve 
  1248.    --  Dy3: the Y offset to the end of the curve 
  1249.    -- 
  1250.    --  Relative-coordinate version of Cairo_Curve_To. All offsets are 
  1251.    --  relative to the current point. Adds a cubic Bézier spline to the 
  1252.    --  path from the current point to a point offset from the current 
  1253.    --  point by (Dx3, Dy3), using points offset by (Dx1, Dy1) and 
  1254.    --  (Dx2, Dy2) as the control points. After this call the current 
  1255.    --  point will be offset by (Dx3, Dy3). 
  1256.    -- 
  1257.    --  Given a current point of (X, Y), Cairo_Rel_Curve_To(Cr, Dx1, 
  1258.    --  Dy1, Dx2, Dy2, Dx3, Dy3) is logically equivalent to 
  1259.    --  Cairo_Curve_To(Cr, X+Dx1, Y+Dy1, X+Dx2, Y+Dy2, X+Dx3, Y+Dy3). 
  1260.    -- 
  1261.    --  It is an error to call this function with no current point. Doing 
  1262.    --  so will cause cr to shutdown with a status of 
  1263.    --  Cairo_Status_No_Current_Point. 
  1264.  
  1265.    procedure Rectangle 
  1266.      (Cr     : Cairo_Context; 
  1267.       X      : Gdouble; 
  1268.       Y      : Gdouble; 
  1269.       Width  : Gdouble; 
  1270.       Height : Gdouble); 
  1271.    --  Cr: a cairo context 
  1272.    --  X: the X coordinate of the top left corner of the rectangle 
  1273.    --  Y: the Y coordinate to the top left corner of the rectangle 
  1274.    --  Width: the Width of the rectangle 
  1275.    --  Height: the Height of the rectangle 
  1276.    -- 
  1277.    --  Adds a closed sub-path rectangle of the given size to the current 
  1278.    --  path at position (X, Y) in user-space coordinates. 
  1279.    -- 
  1280.    --  This function is logically equivalent to: 
  1281.    -- 
  1282.    --  Move_To (Cr, x, Y); 
  1283.    --  Rel_Line_To (Cr, Width, 0); 
  1284.    --  Rel_Line_To (Cr, 0, Height); 
  1285.    --  Rel_Line_To (Cr, -Width, 0); 
  1286.    --  Close_Path (Cr); 
  1287.  
  1288.    procedure Close_Path (Cr : Cairo_Context); 
  1289.    --  Cr: a cairo context 
  1290.    -- 
  1291.    --  Adds a line segment to the path from the current point to the 
  1292.    --  beginning of the current sub-path, (the most recent point passed to 
  1293.    --  Move_To), and closes this sub-path. After this call the 
  1294.    --  current point will be at the joined endpoint of the sub-path. 
  1295.    -- 
  1296.    --  The behavior of Close_Path is distinct from simply calling 
  1297.    --  Line_To with the equivalent coordinate in the case of 
  1298.    --  stroking. When a closed sub-path is stroked, there are no caps on 
  1299.    --  the ends of the sub-path. Instead, there is a line join connecting 
  1300.    --  the final and initial segments of the sub-path. 
  1301.    -- 
  1302.    --  If there is no current point before the call to Close_Path, 
  1303.    --  this function will have no effect. 
  1304.    -- 
  1305.    --  Note: As of cairo version 1.2.4 any call to Close_Path will 
  1306.    --  place an explicit MOVE_TO element into the path immediately after 
  1307.    --  the CLOSE_PATH element, (which can be seen in Copy_Path for 
  1308.    --  example). This can simplify path processing in some cases as it may 
  1309.    --  not be necessary to save the "last move_to point" during processing 
  1310.    --  as the MOVE_TO immediately after the CLOSE_PATH will provide that 
  1311.    --  point. 
  1312.  
  1313.    procedure Path_Extents 
  1314.      (Cr : Cairo_Context; 
  1315.       X1 : access Gdouble; 
  1316.       Y1 : access Gdouble; 
  1317.       X2 : access Gdouble; 
  1318.       Y2 : access Gdouble); 
  1319.    --  Cr: a cairo context 
  1320.    --  X1: left of the resulting extents 
  1321.    --  Y1: top of the resulting extents 
  1322.    --  X2: right of the resulting extents 
  1323.    --  Y2: bottom of the resulting extents 
  1324.    -- 
  1325.    --  Computes a bounding box in user-space coordinates covering the 
  1326.    --  points on the current path. If the current path is empty, returns 
  1327.    --  an empty rectangle ((0,0), (0,0)). Stroke parameters, fill rule, 
  1328.    --  surface dimensions and clipping are not taken into account. 
  1329.    -- 
  1330.    --  Contrast with Fill_Extents and Stroke_Extents which 
  1331.    --  return the extents of only the area that would be "inked" by 
  1332.    --  the corresponding drawing operations. 
  1333.    -- 
  1334.    --  The result of Path_Extents is defined as equivalent to the 
  1335.    --  limit of Stroke_Extents with Cairo_Line_Cap_Round as the 
  1336.    --  line width approaches 0.0, (but never reaching the empty-rectangle 
  1337.    --  returned by Cairo_Stroke_Extents for a line width of 0.0). 
  1338.    -- 
  1339.    --  Specifically, this means that zero-area sub-paths such as 
  1340.    --  Move_To;Line_To segments, (even degenerate cases where the coordinates 
  1341.    --  to both calls are identical), will be considered as contributing to the 
  1342.    --  extents. However, a lone Move_To will not contribute to the results of 
  1343.    --  Path_Extents. 
  1344.    -- 
  1345.    --  Since: 1.6 
  1346.  
  1347.    -------------- 
  1348.    -- Painting -- 
  1349.    -------------- 
  1350.  
  1351.    procedure Paint (Cr : Cairo_Context); 
  1352.    --  Cr: a cairo context 
  1353.    -- 
  1354.    --  A drawing operator that paints the current source everywhere within 
  1355.    --  the current clip region. 
  1356.  
  1357.    procedure Paint_With_Alpha (Cr : Cairo_Context; Alpha : Gdouble); 
  1358.    --  Cr: a cairo context 
  1359.    --  Alpha: Alpha value, between 0 (transparent) and 1 (opaque) 
  1360.    -- 
  1361.    --  A drawing operator that paints the current source everywhere within the 
  1362.    --  current clip region using a mask of constant alpha value alpha. The 
  1363.    --  effect is similar to Paint, but the drawing is faded out using the alpha 
  1364.    --  value. 
  1365.  
  1366.    procedure Mask (Cr : Cairo_Context; Pattern : Cairo_Pattern); 
  1367.    --  Cr: a cairo context 
  1368.    --  Pattern: a Cairo_Pattern 
  1369.    -- 
  1370.    --  A drawing operator that paints the current source using the alpha 
  1371.    --  channel of pattern as a mask. (Opaque areas of pattern are painted with 
  1372.    --  the source, transparent areas are not painted.) 
  1373.  
  1374.    procedure Mask_Surface 
  1375.      (Cr        : Cairo_Context; 
  1376.       Surface   : Cairo_Surface; 
  1377.       Surface_X : Gdouble; 
  1378.       Surface_Y : Gdouble); 
  1379.    --  Cr: a cairo context 
  1380.    --  Surface: a Cairo_Surface 
  1381.    --  Surface_X: X coordinate at which to place the origin of surface 
  1382.    --  Surface_Y: Y coordinate at which to place the origin of surface 
  1383.    -- 
  1384.    --  A drawing operator that paints the current source 
  1385.    --  using the alpha channel of surface as a mask. (Opaque 
  1386.    --  areas of surface are painted with the source, transparent 
  1387.    --  areas are not painted.) 
  1388.  
  1389.    procedure Stroke (Cr : Cairo_Context); 
  1390.    --  Cr: a cairo context 
  1391.    -- 
  1392.    --  A drawing operator that strokes the current path according to the 
  1393.    --  current line width, line join, line cap, and dash settings. After 
  1394.    --  Cairo_Stroke, the current path will be cleared from the cairo 
  1395.    --  context. See Set_Line_Width, Set_Line_Join, Set_Line_Cap, Set_Dash, 
  1396.    --  and Stroke_Preserve. 
  1397.    -- 
  1398.    --  Note: Degenerate segments and sub-paths are treated specially and 
  1399.    --  provide a useful result. These can result in two different 
  1400.    --  situations: 
  1401.    -- 
  1402.    --  1. Zero-length "on" segments set in Set_Dash. If the cap 
  1403.    --  style is Cairo_Line_Cap_Round or Cairo_Line_Cap_Square then these 
  1404.    --  segments will be drawn as circular dots or squares respectively. In 
  1405.    --  the case of Cairo_Line_Cap_Square, the orientation of the squares 
  1406.    --  is determined by the direction of the underlying path. 
  1407.    -- 
  1408.    --  2. A sub-path created by Cairo_Move_To followed by either a 
  1409.    --  Cairo_Close_Path or one or more calls to Cairo_Line_To to the 
  1410.    --  same coordinate as the Cairo_Move_To. If the cap style is 
  1411.    --  Cairo_Line_Cap_Round then these sub-paths will be drawn as circular 
  1412.    --  dots. Note that in the case of Cairo_Line_Cap_Square a degenerate 
  1413.    --  sub-path will not be drawn at all, (since the correct orientation 
  1414.    --  is indeterminate). 
  1415.    -- 
  1416.    --  In no case will a cap style of Cairo_Line_Cap_Butt cause anything 
  1417.    --  to be drawn in the case of either degenerate segments or sub-paths. 
  1418.  
  1419.    procedure Stroke_Preserve (Cr : Cairo_Context); 
  1420.    --  Cr: a cairo context 
  1421.    -- 
  1422.    --  A drawing operator that strokes the current path according to the 
  1423.    --  current line width, line join, line cap, and dash settings. Unlike 
  1424.    --  Cairo_Stroke, Cairo_Stroke_Preserve preserves the path within the 
  1425.    --  cairo context. 
  1426.    -- 
  1427.    --  See Set_Line_Width, Set_Line_Join, Set_Line_Cap, Set_Dash, and 
  1428.    --  Stroke_Preserve. 
  1429.  
  1430.    procedure Fill (Cr : Cairo_Context); 
  1431.    --  Cr: a cairo context 
  1432.    -- 
  1433.    --  A drawing operator that fills the current path according to the 
  1434.    --  current fill rule, (each sub-path is implicitly closed before being 
  1435.    --  filled). After Fill, the current path will be cleared from 
  1436.    --  the cairo context. See Set_Fill_Rule and Fill_Preserve. 
  1437.  
  1438.    procedure Fill_Preserve (Cr : Cairo_Context); 
  1439.    --  Cr: a cairo context 
  1440.    -- 
  1441.    --  A drawing operator that fills the current path according to the 
  1442.    --  current fill rule, (each sub-path is implicitly closed before being 
  1443.    --  filled). Unlike Fill, Fill_Preserve preserves the path within the 
  1444.    --  cairo context. 
  1445.    -- 
  1446.    --  See Set_Fill_Rule and Fill. 
  1447.  
  1448.    procedure Copy_Page (Cr : Cairo_Context); 
  1449.    --  Cr: a cairo context 
  1450.    -- 
  1451.    --  Emits the current page for backends that support multiple pages, but 
  1452.    --  doesn't clear it, so, the contents of the current page will be retained 
  1453.    --  for the next page too.  Use Show_Page if you want to get an 
  1454.    --  empty page after the emission. 
  1455.    -- 
  1456.    --  This is a convenience function that simply calls 
  1457.    --  Cairo.Surface.Copy_Page on Cr's target. 
  1458.  
  1459.    procedure Show_Page (Cr : Cairo_Context); 
  1460.    --  Cr: a cairo context 
  1461.    -- 
  1462.    --  Emits and clears the current page for backends that support multiple 
  1463.    --  pages.  Use Copy_Page if you don't want to clear the page. 
  1464.    -- 
  1465.    --  This is a convenience function that simply calls 
  1466.    --  Cairo.Surface.Show_Page on cr's target. 
  1467.  
  1468.    ------------------------ 
  1469.    -- Insideness testing -- 
  1470.    ------------------------ 
  1471.  
  1472.    function In_Stroke 
  1473.      (Cr   : Cairo_Context; 
  1474.       X    : Gdouble; 
  1475.       Y    : Gdouble) 
  1476.       return Boolean; 
  1477.    --  Cr: a cairo context 
  1478.    --  X: X coordinate of the point to test 
  1479.    --  Y: Y coordinate of the point to test 
  1480.    -- 
  1481.    --  Tests whether the given point is inside the area that would be 
  1482.    --  affected by a Stroke operation given the current path and 
  1483.    --  stroking parameters. Surface dimensions and clipping are not taken 
  1484.    --  into account. 
  1485.    -- 
  1486.    --  See Stroke, Set_Line_Width, Set_Line_Join, 
  1487.    --  Set_Line_Cap, Set_Dash, and Stroke_Preserve. 
  1488.    -- 
  1489.    --  Return value: A non-zero value if the point is inside, or zero if 
  1490.    --  outside. 
  1491.  
  1492.    function In_Fill 
  1493.      (Cr   : Cairo_Context; 
  1494.       X    : Gdouble; 
  1495.       Y    : Gdouble) 
  1496.       return Boolean; 
  1497.    --  Cr: a cairo context 
  1498.    --  X: X coordinate of the point to test 
  1499.    --  Y: Y coordinate of the point to test 
  1500.    -- 
  1501.    --  Tests whether the given point is inside the area that would be 
  1502.    --  affected by a Fill operation given the current path and 
  1503.    --  filling parameters. Surface dimensions and clipping are not taken 
  1504.    --  into account. 
  1505.    -- 
  1506.    --  See Fill, Set_Fill_Rule and Fill_Preserve. 
  1507.    -- 
  1508.    --  Return value: A non-zero value if the point is inside, or zero if 
  1509.    --  outside. 
  1510.  
  1511.    ------------------------- 
  1512.    -- Rectangular extents -- 
  1513.    ------------------------- 
  1514.  
  1515.    procedure Stroke_Extents 
  1516.      (Cr : Cairo_Context; 
  1517.       X1 : access Gdouble; 
  1518.       Y1 : access Gdouble; 
  1519.       X2 : access Gdouble; 
  1520.       Y2 : access Gdouble); 
  1521.    --  Cr: a cairo context 
  1522.    --  X1: left of the resulting extents 
  1523.    --  Y1: top of the resulting extents 
  1524.    --  X2: right of the resulting extents 
  1525.    --  Y2: bottom of the resulting extents 
  1526.    -- 
  1527.    --  Computes a bounding box in user coordinates covering the area that 
  1528.    --  would be affected, (the "inked" area), by a Stroke 
  1529.    --  operation given the current path and stroke parameters. 
  1530.    --  If the current path is empty, returns an empty rectangle ((0,0), (0,0)). 
  1531.    --  Surface dimensions and clipping are not taken into account. 
  1532.    -- 
  1533.    --  Note that if the line width is set to exactly zero, then 
  1534.    --  Stroke_Extents will return an empty rectangle. Contrast with 
  1535.    --  Path_Extents which can be used to compute the non-empty 
  1536.    --  bounds as the line width approaches zero. 
  1537.    -- 
  1538.    --  Note that Stroke_Extents must necessarily do more work to 
  1539.    --  compute the precise inked areas in light of the stroke parameters, 
  1540.    --  so Path_Extents may be more desirable for sake of 
  1541.    --  performance if non-inked path extents are desired. 
  1542.    -- 
  1543.    --  See Stroke, Set_Line_Width, Set_Line_Join, Set_Line_Cap, Set_Dash, and 
  1544.    --  Stroke_Preserve. 
  1545.  
  1546.    procedure Fill_Extents 
  1547.      (Cr : Cairo_Context; 
  1548.       X1 : access Gdouble; 
  1549.       Y1 : access Gdouble; 
  1550.       X2 : access Gdouble; 
  1551.       Y2 : access Gdouble); 
  1552.    --  Cr: a cairo context 
  1553.    --  X1: left of the resulting extents 
  1554.    --  Y1: top of the resulting extents 
  1555.    --  X2: right of the resulting extents 
  1556.    --  Y2: bottom of the resulting extents 
  1557.    -- 
  1558.    --  Computes a bounding box in user coordinates covering the area that 
  1559.    --  would be affected, (the "inked" area), by a Fill operation 
  1560.    --  given the current path and fill parameters. If the current path is 
  1561.    --  empty, returns an empty rectangle ((0,0), (0,0)). Surface 
  1562.    --  dimensions and clipping are not taken into account. 
  1563.    -- 
  1564.    --  Contrast with Path_Extents, which is similar, but returns 
  1565.    --  non-zero extents for some paths with no inked area, (such as a 
  1566.    --  simple line segment). 
  1567.    -- 
  1568.    --  Note that Fill_Extents must necessarily do more work to 
  1569.    --  compute the precise inked areas in light of the fill rule, so 
  1570.    --  Path_Extents may be more desirable for sake of performance 
  1571.    --  if the non-inked path extents are desired. 
  1572.    -- 
  1573.    --  See Fill, Set_Fill_Rule and Fill_Preserve. 
  1574.  
  1575.    -------------- 
  1576.    -- Clipping -- 
  1577.    -------------- 
  1578.  
  1579.    procedure Reset_Clip (Cr : Cairo_Context); 
  1580.    --  Cr: a cairo context 
  1581.    -- 
  1582.    --  Reset the current clip region to its original, unrestricted 
  1583.    --  state. That is, set the clip region to an infinitely large shape 
  1584.    --  containing the target surface. Equivalently, if infinity is too 
  1585.    --  hard to grasp, one can imagine the clip region being reset to the 
  1586.    --  exact bounds of the target surface. 
  1587.    -- 
  1588.    --  Note that code meant to be reusable should not call 
  1589.    --  Reset_Clip as it will cause results unexpected by higher-level code 
  1590.    --  which calls Clip. Consider using Save and Restore around Clip as a more 
  1591.    --  robust means of temporarily restricting the clip region. 
  1592.  
  1593.    procedure Clip (Cr : Cairo_Context); 
  1594.    --  Cr: a cairo context 
  1595.    -- 
  1596.    --  Establishes a new clip region by intersecting the current clip 
  1597.    --  region with the current path as it would be filled by Fill 
  1598.    --  and according to the current fill rule (see Set_Fill_Rule). 
  1599.    -- 
  1600.    --  After Clip, the current path will be cleared from the cairo 
  1601.    --  context. 
  1602.    -- 
  1603.    --  The current clip region affects all drawing operations by 
  1604.    --  effectively masking out any changes to the surface that are outside 
  1605.    --  the current clip region. 
  1606.    -- 
  1607.    --  Calling Clip can only make the clip region smaller, never 
  1608.    --  larger. But the current clip is part of the graphics state, so a 
  1609.    --  temporary restriction of the clip region can be achieved by 
  1610.    --  calling Clip within a Save/Restore 
  1611.    --  pair. The only other means of increasing the size of the clip 
  1612.    --  region is Reset_Clip. 
  1613.  
  1614.    procedure Clip_Preserve (Cr : Cairo_Context); 
  1615.    --  Cr: a cairo context 
  1616.    -- 
  1617.    --  Establishes a new clip region by intersecting the current clip 
  1618.    --  region with the current path as it would be filled by Fill 
  1619.    --  and according to the current fill rule (see Set_Fill_Rule). 
  1620.    -- 
  1621.    --  Unlike Clip, Clip_Preserve preserves the path within 
  1622.    --  the cairo context. 
  1623.    -- 
  1624.    --  The current clip region affects all drawing operations by 
  1625.    --  effectively masking out any changes to the surface that are outside 
  1626.    --  the current clip region. 
  1627.    -- 
  1628.    --  Calling Clip_Preserve can only make the clip region smaller, never 
  1629.    --  larger. But the current clip is part of the graphics state, so a 
  1630.    --  temporary restriction of the clip region can be achieved by 
  1631.    --  calling Clip_Preserve within a Save/Restore 
  1632.    --  pair. The only other means of increasing the size of the clip 
  1633.    --  region is Reset_Clip. 
  1634.  
  1635.    procedure Clip_Extents 
  1636.      (Cr : Cairo_Context; 
  1637.       X1 : out Gdouble; 
  1638.       Y1 : out Gdouble; 
  1639.       X2 : out Gdouble; 
  1640.       Y2 : out Gdouble); 
  1641.    --  Cr: a cairo context 
  1642.    --  X1: left of the resulting extents 
  1643.    --  Y1: top of the resulting extents 
  1644.    --  X2: right of the resulting extents 
  1645.    --  Y2: bottom of the resulting extents 
  1646.    -- 
  1647.    --  Computes a bounding box in user coordinates covering the area inside the 
  1648.    --  current clip. 
  1649.    -- 
  1650.    --  Since: 1.4 
  1651.  
  1652.    type Cairo_Rectangle is record 
  1653.       X      : aliased Gdouble; 
  1654.       Y      : aliased Gdouble; 
  1655.       Width  : aliased Gdouble; 
  1656.       Height : aliased Gdouble; 
  1657.    end record; 
  1658.    --  X: X coordinate of the left side of the rectangle 
  1659.    --  Y: Y coordinate of the the top side of the rectangle 
  1660.    --  Width: Width of the rectangle 
  1661.    --  Height: Height of the rectangle 
  1662.    -- 
  1663.    --  A data structure for holding a rectangle. 
  1664.    -- 
  1665.    --  Since: 1.4 
  1666.  
  1667.    type Cairo_Rectangle_Array is array (Natural) of Cairo_Rectangle; 
  1668.    type Cairo_Rectangle_Array_Access is access all Cairo_Rectangle_Array; 
  1669.  
  1670.    type Cairo_Rectangle_List is record 
  1671.       Status         : aliased Cairo_Status; 
  1672.       Rectangles     : Cairo_Rectangle_Array_Access; 
  1673.       --  Warning: for efficiency reasons, Rectangles is a direct mapping to 
  1674.       --  the C structure. Therefore, there is no bounds checking on this 
  1675.       --  array, user needs to make sure only to access data between indexes 0 
  1676.       --  and Num_Rectanges-1. 
  1677.       Num_Rectangles : aliased Gint; 
  1678.    end record; 
  1679.    --  Status: Error Status of the rectangle list 
  1680.    --  Rectangles: Array containing the Rectangles 
  1681.    --  Num_Rectangles: Number of rectangles in this list 
  1682.    -- 
  1683.    --  A data structure for holding a Dynamically allocated 
  1684.    --  array of rectangles. 
  1685.    -- 
  1686.    --  Since: 1.4 
  1687.    pragma Convention (C_Pass_By_Copy, Cairo_Rectangle_List); 
  1688.  
  1689.    type Cairo_Rectangle_List_Access is access all Cairo_Rectangle_List; 
  1690.  
  1691.    function Copy_Clip_Rectangle_List 
  1692.      (Cr   : Cairo_Context) 
  1693.       return Cairo_Rectangle_List_Access; 
  1694.    --  Cr: a cairo context 
  1695.    -- 
  1696.    --  Gets the current clip region as a list of rectangles in user 
  1697.    --  coordinates. 
  1698.    --  Never returns NULL. 
  1699.    -- 
  1700.    --  The status in the list may be Cairo_Status_Clip_Not_Representable to 
  1701.    --  indicate that the clip region cannot be represented as a list of 
  1702.    --  user-space rectangles. The status may have other values to indicate 
  1703.    --  other errors. 
  1704.    -- 
  1705.    --  Returns: the current clip region as a list of rectangles in user 
  1706.    --  coordinates, 
  1707.    --  which should be destroyed using Rectangle_List_Destroy. 
  1708.    -- 
  1709.    --  Since: 1.4 
  1710.  
  1711.    procedure Rectangle_List_Destroy 
  1712.      (Rectangle_List : access Cairo_Rectangle_List); 
  1713.    --  Rectangle_List: a rectangle list, as obtained from Copy_Clip_Rectangles 
  1714.    -- 
  1715.    --  Unconditionally frees Rectangle_List and all associated 
  1716.    --  references. After this call, the Rectangle_List pointer must not 
  1717.    --  be dereferenced. 
  1718.    -- 
  1719.    --  Since: 1.4 
  1720.  
  1721.    ------------------------- 
  1722.    -- Font/Text functions -- 
  1723.    ------------------------- 
  1724.  
  1725.    type Cairo_Scaled_Font is private; 
  1726.    --  A Cairo_Scaled_Font is a font scaled to a particular size and device 
  1727.    --  resolution. A Cairo_Scaled_Font is most useful for low-level font 
  1728.    --  usage where a library or application wants to cache a reference 
  1729.    --  to a scaled font to speed up the computation of metrics. 
  1730.    -- 
  1731.    --  There are various types of scaled fonts, depending on the font backend 
  1732.    --  they use. The type of a scaled font can be queried using 
  1733.    --  Cairo.Scaled_Font.Get_Type. 
  1734.    -- 
  1735.    --  Memory management of Cairo_Scaled_Font is done with 
  1736.    --  Cairo.Scaled_Font.Reference and Cairo.Scaled_Font.Destroy. 
  1737.  
  1738.    type Cairo_Font_Face is private; 
  1739.    --  A Cairo_Font_Face specifies all aspects of a font other 
  1740.    --  than the size or font matrix (a font matrix is used to distort 
  1741.    --  a font by sheering it or scaling it unequally in the two 
  1742.    --  directions) . A font face can be set on a Cairo_Context by using 
  1743.    --  Set_Font_Face; the size and font matrix are set with 
  1744.    --  Set_Font_Size and Set_Font_Matrix. 
  1745.    -- 
  1746.    --  There are various types of font faces, depending on the font backend 
  1747.    --  they use. The type of a font face can be queried using 
  1748.    --  Cairo.Font_Face.Get_Type. 
  1749.    -- 
  1750.    --  Memory management of Cairo_Font_Face is done with 
  1751.    --  Cairo.Font_Face.Reference and Cairo.Font_Face.Destroy. 
  1752.    -- 
  1753.    --  The Cairo_glyph structure holds information about a single glyph when 
  1754.    --  drawing or measuring text. A font is (in simple terms) a collection of 
  1755.    --  shapes used to draw text. A glyph is one of these shapes. There can be 
  1756.    --  multiple glyphs for a single character (alternates to be used in 
  1757.    --  different contexts, for example), or a glyph can be a ligature of 
  1758.    --  multiple characters. Cairo doesn't expose any way of converting input 
  1759.    --  text into glyphs, so in order to use the Cairo interfaces that take 
  1760.    --  arrays of glyphs, you must directly access the appropriate underlying 
  1761.    --  font system. 
  1762.    -- 
  1763.    --  Note that the offsets given by X and Y are not cumulative. When 
  1764.    --  drawing or measuring text, each glyph is individually positioned 
  1765.    --  with respect to the overall origin 
  1766.    type Cairo_Glyph is record 
  1767.       Index : aliased Gulong; 
  1768.       --  Glyph Index in the font. The exact interpretation of the 
  1769.       --  glyph index depends on the font technology being used. 
  1770.  
  1771.       X     : aliased Gdouble; 
  1772.       --  The offset in the X direction between the origin used for 
  1773.       --  drawing or measuring the string and the origin of this glyph. 
  1774.  
  1775.       Y     : aliased Gdouble; 
  1776.       --  The offset in the Y direction between the origin used for drawing or 
  1777.       --  measuring the string and the origin of this glyph. 
  1778.    end record; 
  1779.    pragma Convention (C_Pass_By_Copy, Cairo_Glyph); 
  1780.  
  1781.    type Cairo_Text_Cluster is record 
  1782.       Num_Bytes  : aliased Gint; 
  1783.       --  The number of bytes of UTF-8 text covered by cluster 
  1784.  
  1785.       Num_Glyphs : aliased Gint; 
  1786.       --  The number of glyphs covered by cluster 
  1787.    end record; 
  1788.    --  The Cairo_text_cluster structure holds information about a single text 
  1789.    --  cluster. A text cluster is a minimal mapping of some glyphs 
  1790.    --  corresponding to some UTF-8 text. 
  1791.    -- 
  1792.    --  For a cluster to be valid, both num_bytes and num_glyphs should 
  1793.    --  be non-negative, and at least one should be non-zero. 
  1794.    --  Note that clusters with zero glyphs are not as well supported as 
  1795.    --  normal clusters.  For example, PDF rendering applications typically 
  1796.    --  ignore those clusters when PDF text is being selected. 
  1797.    -- 
  1798.    --  See Show_Text_Glyphs for how clusters are used in advanced 
  1799.    --  text operations. 
  1800.    -- 
  1801.    --  Since: 1.8 
  1802.    pragma Convention (C_Pass_By_Copy, Cairo_Text_Cluster); 
  1803.  
  1804.    subtype Cairo_Text_Cluster_Flags is Guint; 
  1805.    --  Specifies properties of a text cluster mapping. 
  1806.    -- 
  1807.    --  Since: 1.8 
  1808.  
  1809.    Cairo_Text_Cluster_Flag_Backward : constant Cairo_Text_Cluster_Flags := 1; 
  1810.    --  The clusters in the cluster array map to glyphs in the glyph array from 
  1811.    --  end to start. 
  1812.  
  1813.    type Cairo_Text_Extents is record 
  1814.       X_Bearing : aliased Gdouble; 
  1815.       --  The horizontal distance from the origin to the 
  1816.       --  leftmost part of the glyphs as drawn. Positive if the 
  1817.       --  glyphs lie entirely to the right of the origin. 
  1818.  
  1819.       Y_Bearing : aliased Gdouble; 
  1820.       --  The vertical distance from the origin to the 
  1821.       --  topmost part of the glyphs as drawn. Positive only if the 
  1822.       --  glyphs lie completely below the origin; will usually be 
  1823.       --  negative. 
  1824.  
  1825.       Width     : aliased Gdouble; 
  1826.       --  Width of the glyphs as drawn 
  1827.  
  1828.       Height    : aliased Gdouble; 
  1829.       --  Height of the glyphs as drawn 
  1830.  
  1831.       X_Advance : aliased Gdouble; 
  1832.       --  Distance to advance in the X direction after drawing these glyphs 
  1833.  
  1834.       Y_Advance : aliased Gdouble; 
  1835.       --  Distance to advance in the Y direction 
  1836.       --  after drawing these glyphs. Will typically be zero except 
  1837.       --  for vertical text layout as found in East-Asian languages. 
  1838.    end record; 
  1839.    --  The Cairo_text_extents structure stores the extents of a single glyph 
  1840.    --  or a string of glyphs in user-space coordinates. Because text extents 
  1841.    --  are in user-space coordinates, they are mostly, but not entirely, 
  1842.    --  independent of the current transformation matrix. If you call 
  1843.    --  Scale (Cr, 2.0, 2.0), text will be drawn twice as big, but the reported 
  1844.    --  text extents will not be doubled. They will change slightly due to 
  1845.    --  hinting (so you can't assume that metrics are independent of the 
  1846.    --  transformation matrix), but otherwise will remain unchanged. 
  1847.    pragma Convention (C_Pass_By_Copy, Cairo_Text_Extents); 
  1848.  
  1849.    type Cairo_Font_Extents is record 
  1850.       Ascent        : aliased Gdouble; 
  1851.       --  The distance that the font extends above the baseline. 
  1852.       --  Note that this is not always exactly equal to the maximum 
  1853.       --  of the extents of all the glyphs in the font, but rather 
  1854.       --  is picked to express the font designer's intent as to 
  1855.       --  how the font should align with elements above it. 
  1856.  
  1857.       Descent       : aliased Gdouble; 
  1858.       --  The distance that the font extends below the baseline. 
  1859.       --  This value is positive for typical fonts that include 
  1860.       --  portions below the baseline. Note that this is not always 
  1861.       --  exactly equal to the maximum of the extents of all the 
  1862.       --  glyphs in the font, but rather is picked to express the 
  1863.       --  font designer's intent as to how the the font should 
  1864.       --  align with elements below it. 
  1865.  
  1866.       Height        : aliased Gdouble; 
  1867.       --  The recommended vertical distance between baselines when 
  1868.       --  setting consecutive lines of text with the font. This 
  1869.       --  is greater than ascent+descent by a 
  1870.       --  quantity known as the line spacing or external leading. When space is 
  1871.       --  at a premium, most fonts can be set with only a distance of 
  1872.       --  ascent+descent between lines. 
  1873.  
  1874.       Max_X_Advance : aliased Gdouble; 
  1875.       --  The maximum distance in the X direction that 
  1876.       --  the the origin is advanced for any glyph in the font. 
  1877.  
  1878.       Max_Y_Advance : aliased Gdouble; 
  1879.       --  The maximum distance in the Y direction that 
  1880.       --  the the origin is advanced for any glyph in the font. 
  1881.       --  this will be zero for normal fonts used for horizontal 
  1882.       --  writing. (The scripts of East Asia are sometimes written 
  1883.       --  vertically.) 
  1884.    end record; 
  1885.    --  The Cairo_font_extents structure stores metric information for 
  1886.    --  a font. Values are given in the current user-space coordinate 
  1887.    --  system. 
  1888.    -- 
  1889.    --  Because font metrics are in user-space coordinates, they are 
  1890.    --  mostly, but not entirely, independent of the current transformation 
  1891.    --  matrix. If you call Scale (Cr, 2.0, 2.0), text will be drawn twice as 
  1892.    --  big, but the reported text extents will not be doubled. They will 
  1893.    --  change slightly due to hinting (so you can't assume that metrics are 
  1894.    --  independent of the transformation matrix), but otherwise will remain 
  1895.    --  unchanged. 
  1896.    pragma Convention (C_Pass_By_Copy, Cairo_Font_Extents); 
  1897.  
  1898.    type Cairo_Font_Slant is ( 
  1899.                              Cairo_Font_Slant_Normal, 
  1900.                              Cairo_Font_Slant_Italic, 
  1901.                              Cairo_Font_Slant_Oblique); 
  1902.    --  Specifies variants of a font face based on their slant. 
  1903.    pragma Convention (C, Cairo_Font_Slant); 
  1904.  
  1905.    type Cairo_Font_Weight is ( 
  1906.                               Cairo_Font_Weight_Normal, 
  1907.                               Cairo_Font_Weight_Bold); 
  1908.    --  Specifies variants of a font face based on their weight. 
  1909.    pragma Convention (C, Cairo_Font_Weight); 
  1910.  
  1911.    type Cairo_Subpixel_Order is 
  1912.      (Cairo_Subpixel_Order_Default, 
  1913.       --  Use the default subpixel order for the target device 
  1914.  
  1915.       Cairo_Subpixel_Order_Rgb, 
  1916.       --  Subpixel elements are arranged horizontally with red at the left 
  1917.  
  1918.       Cairo_Subpixel_Order_Bgr, 
  1919.       --  Subpixel elements are arranged horizontally with blue at the left 
  1920.  
  1921.       Cairo_Subpixel_Order_Vrgb, 
  1922.       --  Subpixel elements are arranged vertically with red at the top 
  1923.  
  1924.       Cairo_Subpixel_Order_Vbgr 
  1925.       --  Subpixel elements are arranged vertically with blue at the top 
  1926.      ); 
  1927.    --  The subpixel order specifies the order of color elements within 
  1928.    --  each pixel on the display device when rendering with an 
  1929.    --  antialiasing mode of CAIRO_ANTIALIAS_SUBPIXEL. 
  1930.    pragma Convention (C, Cairo_Subpixel_Order); 
  1931.  
  1932.    type Cairo_Hint_Style is 
  1933.      (Cairo_Hint_Style_Default, 
  1934.       --  Use the default hint style for font backend and target device 
  1935.  
  1936.       Cairo_Hint_Style_None, 
  1937.       --  Do not hint outlines 
  1938.  
  1939.       Cairo_Hint_Style_Slight, 
  1940.       --  Hint outlines slightly to improve contrast while retaining good 
  1941.       --  fidelity to the original shapes. 
  1942.  
  1943.       Cairo_Hint_Style_Medium, 
  1944.       --  Hint outlines with medium strength giving a compromise between 
  1945.       --  fidelity to the original shapes and contrast 
  1946.  
  1947.       Cairo_Hint_Style_Full 
  1948.       --  Hint outlines to maximize contrast 
  1949.      ); 
  1950.    --  Specifies the type of hinting to do on font outlines. Hinting 
  1951.    --  is the process of fitting outlines to the pixel grid in order 
  1952.    --  to improve the appearance of the result. Since hinting outlines 
  1953.    --  involves distorting them, it also reduces the faithfulness 
  1954.    --  to the original outline shapes. Not all of the outline hinting 
  1955.    --  styles are supported by all font backends. 
  1956.    -- 
  1957.    --  New entries may be added in future versions. 
  1958.    pragma Convention (C, Cairo_Hint_Style); 
  1959.  
  1960.    type Cairo_Hint_Metrics is 
  1961.      (Cairo_Hint_Metrics_Default, 
  1962.       --  Hint metrics in the default manner for the font backend and target 
  1963.       --  device 
  1964.  
  1965.       Cairo_Hint_Metrics_Off, 
  1966.       --  Do not hint font metrics 
  1967.  
  1968.       Cairo_Hint_Metrics_On 
  1969.       --  Hint font metrics 
  1970.      ); 
  1971.    --  Specifies whether to hint font metrics; hinting font metrics 
  1972.    --  means quantizing them so that they are integer values in 
  1973.    --  device space. Doing this improves the consistency of 
  1974.    --  letter and line spacing, however it also means that text 
  1975.    --  will be laid out differently at different zoom factors. 
  1976.    pragma Convention (C, Cairo_Hint_Metrics); 
  1977.  
  1978.    type Cairo_Font_Options is private; 
  1979.    --  An opaque structure holding all options that are used when 
  1980.    --  rendering fonts. 
  1981.    -- 
  1982.    --  Individual features of a Cairo_Font_Options can be set or 
  1983.    --  accessed using functions named 
  1984.    --  Cairo.Font_Options.Set_<feature_Name> and 
  1985.    --  Cairo.Font_Options.Get_<feature_Name>, like 
  1986.    --  Cairo.Font_Options.Set_Antialias and 
  1987.    --  Cairo.Font_Options.Get_Antialias. 
  1988.    -- 
  1989.    --  New features may be added to a Cairo_font_options in the 
  1990.    --  future.  For this reason, Cairo.Font_Options.Copy, 
  1991.    --  Cairo.Font_Options.Equal, Cairo.Font_Options.Merge, and 
  1992.    --  Cairo.Font_Options.Hash should be used to copy, check 
  1993.    --  for equality, merge, or compute a hash value of 
  1994.    --  Cairo_Font_Options objects. 
  1995.  
  1996.    --  This interface is for dealing with text as text, not caring about the 
  1997.    --  font object inside the the Cairo_Context. 
  1998.  
  1999.    procedure Select_Font_Face 
  2000.      (Cr     : Cairo_Context; 
  2001.       Family : String; 
  2002.       Slant  : Cairo_Font_Slant; 
  2003.       Weight : Cairo_Font_Weight); 
  2004.    --  Cr: a Cairo_Context 
  2005.    --  Family: a font Family name, encoded in UTF-8 
  2006.    --  Slant: the Slant for the font 
  2007.    --  Weight: the Weight for the font 
  2008.    -- 
  2009.    --  Note: The Select_Font_Face function call is part of what 
  2010.    --  the cairo designers call the "toy" text API. It is convenient for 
  2011.    --  short demos and simple programs, but it is not expected to be 
  2012.    --  adequate for serious text-using applications. 
  2013.    -- 
  2014.    --  Selects a family and style of font from a simplified description as 
  2015.    --  a family name, slant and weight. Cairo provides no operation to 
  2016.    --  list available family names on the system (this is a "toy", 
  2017.    --  remember), but the standard CSS2 generic family names, ("serif", 
  2018.    --  "sans-serif", "cursive", "fantasy", "monospace"), are likely to 
  2019.    --  work as expected. 
  2020.    -- 
  2021.    --  It is expected that most applications will need to use a more 
  2022.    --  comprehensive font handling and text layout library, (for example, 
  2023.    --  pango), in conjunction with cairo. 
  2024.    -- 
  2025.    --  If text is drawn without a call to Select_Font_Face, (nor 
  2026.    --  Set_Font_Face nor Set_Scaled_Font), the default 
  2027.    --  family is platform-specific, but is essentially "sans-serif". 
  2028.    --  Default slant is Cairo_Font_Slant_Normal, and default weight is 
  2029.    --  Cairo_Font_Weight_Normal. 
  2030.    -- 
  2031.    --  This function is equivalent to a call to 
  2032.    --  Cairo.Font_Face.Toy_Font_Face_Create followed by Set_Font_Face. 
  2033.  
  2034.    procedure Set_Font_Size (Cr : Cairo_Context; Size : Gdouble); 
  2035.    --  Cr: a Cairo_Context 
  2036.    --  Size: the new font Size, in user space units 
  2037.    -- 
  2038.    --  Sets the current font matrix to a scale by a factor of size, replacing 
  2039.    --  any font matrix previously set with Set_Font_Size or 
  2040.    --  Set_Font_Matrix. This results in a font size of size user space 
  2041.    --  units. (More precisely, this matrix will result in the font's 
  2042.    --  em-square being a size by size square in user space.) 
  2043.    -- 
  2044.    --  If text is drawn without a call to Set_Font_Size, (nor Set_Font_Matrix 
  2045.    --  nor Set_Scaled_Font), the default font size is 10.0. 
  2046.  
  2047.    procedure Set_Font_Matrix 
  2048.      (Cr     : Cairo_Context; 
  2049.       Matrix : access Cairo_Matrix); 
  2050.    --  Cr: a Cairo_Context 
  2051.    --  Matrix: a Cairo_Matrix describing a transform to be applied to 
  2052.    --  the current font. 
  2053.    -- 
  2054.    --  Sets the current font matrix to matrix. The font matrix gives a 
  2055.    --  transformation from the design space of the font (in this space, 
  2056.    --  the em-square is 1 unit by 1 unit) to user space. Normally, a 
  2057.    --  simple scale is used (see Set_Font_Size), but a more 
  2058.    --  complex font matrix can be used to shear the font 
  2059.    --  or stretch it unequally along the two axes 
  2060.  
  2061.    procedure Get_Font_Matrix 
  2062.      (Cr     : Cairo_Context; 
  2063.       Matrix : access Cairo_Matrix); 
  2064.    --  Cr: a Cairo_Context 
  2065.    --  Matrix: return value for the Matrix 
  2066.    -- 
  2067.    --  Stores the current font matrix into matrix. See Set_Font_Matrix. 
  2068.  
  2069.    procedure Set_Font_Options 
  2070.      (Cr      : Cairo_Context; 
  2071.       Options : Cairo_Font_Options); 
  2072.    --  Cr: a Cairo_Context 
  2073.    --  Options: font Options to use 
  2074.    -- 
  2075.    --  Sets a set of custom font rendering options for the Cairo_Context. 
  2076.    --  Rendering options are derived by merging these options with the 
  2077.    --  options derived from underlying surface; if the value in options 
  2078.    --  has a default value (like Cairo_Antialias_Default), then the value 
  2079.    --  from the surface is used. 
  2080.  
  2081.    procedure Get_Font_Options 
  2082.      (Cr      : Cairo_Context; 
  2083.       Options : Cairo_Font_Options); 
  2084.    --  Cr: a Cairo_Context 
  2085.    --  Options: a Cairo_Font_Options object into which to store 
  2086.    --    the retrieved options. All existing values are overwritten 
  2087.    -- 
  2088.    --  Retrieves font rendering options set via Set_Font_Options. 
  2089.    --  Note that the returned options do not include any options derived 
  2090.    --  from the underlying surface; they are literally the options 
  2091.    --  passed to Set_Font_Options. 
  2092.  
  2093.    procedure Set_Font_Face 
  2094.      (Cr        : Cairo_Context; 
  2095.       Font_Face : Cairo_Font_Face); 
  2096.    --  Cr: a Cairo_Context 
  2097.    --  Font_Face: a Cairo_Font_Face, or Null_Font_Face to restore to the 
  2098.    --  default font 
  2099.    -- 
  2100.    --  Replaces the current Cairo_Font_Face object in the Cairo_Context with 
  2101.    --  font_face. The replaced font face in the Cairo_Context will be 
  2102.    --  destroyed if there are no other references to it. 
  2103.  
  2104.    function Get_Font_Face (Cr : Cairo_Context) return Cairo_Font_Face; 
  2105.    --  Cr: a Cairo_Context 
  2106.    -- 
  2107.    --  Gets the current font face for a Cairo_Context. 
  2108.    -- 
  2109.    --  Return value: the current font face.  This object is owned by 
  2110.    --  cairo. To keep a reference to it, you must call 
  2111.    --  Cairo.Font_Face.Reference. 
  2112.    -- 
  2113.    --  This function never returns Null_Font_Face. If memory cannot be 
  2114.    --  allocated, a special "nil" Cairo_Font_Face object will be returned on 
  2115.    --  which Cairo.Font_Face.Status returns Cairo_Status_No_Memory. Using this 
  2116.    --  nil object will cause its error state to propagate to other objects it 
  2117.    --  is passed to, (for example, calling Set_Font_Face with a nil font 
  2118.    --  will trigger an error that will shutdown the Cairo_Context object). 
  2119.  
  2120.    procedure Set_Scaled_Font 
  2121.      (Cr          : Cairo_Context; 
  2122.       Scaled_Font : access Cairo_Scaled_Font); 
  2123.    --  Cr: a Cairo_Context 
  2124.    --  Scaled_Font: a Cairo_Scaled_Font 
  2125.    -- 
  2126.    --  Replaces the current font face, font matrix, and font options in 
  2127.    --  the Cairo_Context with those of the Cairo_Scaled_Font.  Except for 
  2128.    --  some translation, the current CTM of the Cairo_Context should be the 
  2129.    --  same as that of the Cairo_Scaled_Font, which can be accessed 
  2130.    --  using Cairo.Scaled_Font.Get_Ctm. 
  2131.    -- 
  2132.    --  Since: 1.2 
  2133.  
  2134.    function Get_Scaled_Font (Cr : Cairo_Context) return Cairo_Scaled_Font; 
  2135.    --  Cr: a Cairo_Context 
  2136.    -- 
  2137.    --  Gets the current scaled font for a Cairo_Context. 
  2138.    -- 
  2139.    --  Return value: the current scaled font. This object is owned by 
  2140.    --  cairo. To keep a reference to it, you must call 
  2141.    --  Cairo.Scaled_Font.Reference. 
  2142.    -- 
  2143.    --  This function never returns Null_Font_Face. If memory cannot be 
  2144.    --  allocated, a special "nil" Cairo_Scaled_Font object will be returned on 
  2145.    --  which Cairo.Font_Face.Status returns Cairo_Status_No_Memory. Using this 
  2146.    --  nil object will cause its error state to propagate to other objects it 
  2147.    --  is passed to, (for example, calling Set_Font_Face with a nil font 
  2148.    --  will trigger an error that will shutdown the Cairo_Context object). 
  2149.    -- 
  2150.    --  Since: 1.4 
  2151.  
  2152.    procedure Show_Text 
  2153.      (Cr   : Cairo_Context; 
  2154.       Utf8 : String); 
  2155.    --  Cr: a cairo context 
  2156.    --  Utf8: a NUL-terminated string of text encoded in UTF-8, or Null_Ptr 
  2157.    -- 
  2158.    --  A drawing operator that generates the shape from a string of UTF-8 
  2159.    --  characters, rendered according to the current Font_Face, Font_Size 
  2160.    --  (Font_Matrix), and Font_Options. 
  2161.    -- 
  2162.    --  This function first computes a set of glyphs for the string of 
  2163.    --  text. The first glyph is placed so that its origin is at the 
  2164.    --  current point. The origin of each subsequent glyph is offset from 
  2165.    --  that of the previous glyph by the advance values of the previous 
  2166.    --  glyph. 
  2167.    -- 
  2168.    --  After this call the current point is moved to the origin of where 
  2169.    --  the next glyph would be placed in this same progression. That is, 
  2170.    --  the current point will be at the origin of the final glyph offset 
  2171.    --  by its advance values. This allows for easy display of a single 
  2172.    --  logical string with multiple calls to Show_Text. 
  2173.    -- 
  2174.    --  Note: The Show_Text function call is part of what the cairo 
  2175.    --  designers call the "toy" text API. It is convenient for short demos 
  2176.    --  and simple programs, but it is not expected to be adequate for 
  2177.    --  serious text-using applications. See Show_Glyphs for the 
  2178.    --  "real" text display API in cairo. 
  2179.  
  2180.    procedure Show_Glyphs 
  2181.      (Cr         : Cairo_Context; 
  2182.       Glyphs     : access Cairo_Glyph; 
  2183.       Num_Glyphs : Gint); 
  2184.    --  Cr: a cairo context 
  2185.    --  Glyphs: array of Glyphs to show 
  2186.    --  Num_Glyphs: number of glyphs to show 
  2187.    -- 
  2188.    --  A drawing operator that generates the shape from an array of glyphs, 
  2189.    --  rendered according to the current font face, font size 
  2190.    --  (font matrix), and font options. 
  2191.  
  2192.    procedure Text_Path 
  2193.      (Cr   : Cairo_Context; 
  2194.       Utf8 : String); 
  2195.    --  Cr: a cairo context 
  2196.    --  Utf8: a NUL-terminated string of text encoded in UTF-8, or Null_Ptr 
  2197.    -- 
  2198.    --  Adds closed paths for text to the current path.  The generated 
  2199.    --  path if filled, achieves an effect similar to that of 
  2200.    --  Show_Text. 
  2201.    -- 
  2202.    --  Text conversion and positioning is done similar to Show_Text. 
  2203.    -- 
  2204.    --  Like Show_Text, After this call the current point is 
  2205.    --  moved to the origin of where the next glyph would be placed in 
  2206.    --  this same progression.  That is, the current point will be at 
  2207.    --  the origin of the final glyph offset by its advance values. 
  2208.    --  This allows for chaining multiple calls to to Cairo_Text_Path 
  2209.    --  without having to set current point in between. 
  2210.    -- 
  2211.    --  Note: The Text_Path function call is part of what the cairo 
  2212.    --  designers call the "toy" text API. It is convenient for short demos 
  2213.    --  and simple programs, but it is not expected to be adequate for 
  2214.    --  serious text-using applications. See Glyph_Path for the 
  2215.    --  "real" text path API in cairo. 
  2216.  
  2217.    procedure Text_Extents 
  2218.      (Cr      : Cairo_Context; 
  2219.       Utf8    : Interfaces.C.Strings.chars_ptr; 
  2220.       Extents : access Cairo_Text_Extents); 
  2221.    --  Cr: a Cairo_Context 
  2222.    --  Utf8: a NUL-terminated string of text encoded in UTF-8, or Null_Ptr 
  2223.    --  Extents: a Cairo_Text_Extents object into which the results 
  2224.    --  will be stored 
  2225.    -- 
  2226.    --  Gets the extents for a string of text. The extents describe a 
  2227.    --  user-space rectangle that encloses the "inked" portion of the text, 
  2228.    --  (as it would be drawn by Show_Text). Additionally, the 
  2229.    --  x_advance and y_advance values indicate the amount by which the 
  2230.    --  current point would be advanced by Cairo_Show_Text. 
  2231.    -- 
  2232.    --  Note that whitespace characters do not directly contribute to the 
  2233.    --  size of the rectangle (extents.width and extents.height). They do 
  2234.    --  contribute indirectly by changing the position of non-whitespace 
  2235.    --  characters. In particular, trailing whitespace characters are 
  2236.    --  likely to not affect the size of the rectangle, though they will 
  2237.    --  affect the x_advance and y_advance values. 
  2238.  
  2239.    procedure Glyph_Extents 
  2240.      (Cr         : Cairo_Context; 
  2241.       Glyphs     : access Cairo_Glyph; 
  2242.       Num_Glyphs : Gint; 
  2243.       Extents    : access Cairo_Text_Extents); 
  2244.    --  Cr: a Cairo_Context 
  2245.    --  Glyphs: an array of Cairo_Glyph objects 
  2246.    --  Num_Glyphs: the number of elements in glyphs 
  2247.    --  Extents: a Cairo_Text_Extents object into which the results 
  2248.    --  will be stored 
  2249.    -- 
  2250.    --  Gets the extents for an array of glyphs. The extents describe a 
  2251.    --  user-space rectangle that encloses the "inked" portion of the 
  2252.    --  glyphs, (as they would be drawn by Show_Glyphs). 
  2253.    --  Additionally, the X_Advance and Y_Advance values indicate the 
  2254.    --  amount by which the current point would be advanced by 
  2255.    --  Show_Glyphs. 
  2256.    -- 
  2257.    --  Note that whitespace glyphs do not contribute to the size of the 
  2258.    --  rectangle (Extents.Width and Extents.Height). 
  2259.  
  2260.    procedure Font_Extents 
  2261.      (Cr      : Cairo_Context; 
  2262.       Extents : access Cairo_Font_Extents); 
  2263.    --  Cr: a Cairo_Context 
  2264.    --  Extents: a Cairo_Font_Extents object into which the results 
  2265.    --  will be stored. 
  2266.    -- 
  2267.    --  Gets the font extents for the currently selected font. 
  2268.  
  2269.    type Cairo_Font_Type is 
  2270.      (Cairo_Font_Type_Toy, 
  2271.       --  The font was created using cairo's toy font api (Since: 1.8) 
  2272.  
  2273.       Cairo_Font_Type_Ft, 
  2274.       --  The font is of type FreeType 
  2275.  
  2276.       Cairo_Font_Type_Win32, 
  2277.       --  The font is of type Win32 
  2278.  
  2279.       Cairo_Font_Type_Quartz, 
  2280.       --  The font is of type Quartz (Since: 1.6) 
  2281.  
  2282.       Cairo_Font_Type_User 
  2283.       --  The font was create using cairo's user font api 
  2284.      ); 
  2285.    --  Cairo_font_type is used to describe the type of a given font 
  2286.    --  face or scaled font. The font types are also known as "font 
  2287.    --  backends" within Cairo. 
  2288.    -- 
  2289.    --  The type of a font face is determined by the function used to 
  2290.    --  create it, which will generally be of the form 
  2291.    --  <type>_Font_Face_Create. The font face type 
  2292.    --  can be queried 
  2293.    --  with Cairo.Font_Face.Get_Type 
  2294.    -- 
  2295.    --  The various Cairo_Font_Face functions can be used with a font face 
  2296.    --  of any type. 
  2297.    -- 
  2298.    --  The type of a scaled font is determined by the type of the font 
  2299.    --  face passed to Cairo.Scaled_Font.Create. The scaled font type can 
  2300.    --  be queried with Cairo.Scaled_Font.Get_Type 
  2301.    -- 
  2302.    --  The various Cairo_scaled_font functions can be used with scaled 
  2303.    --  fonts of any type, but some font backends also provide 
  2304.    --  type-specific functions that must only be called with a scaled font 
  2305.    --  of the appropriate type. These functions have names that begin with 
  2306.    --  <type>_Scaled_Font such as Ft_Scaled_Font_Lock_Face. 
  2307.    -- 
  2308.    --  The behavior of calling a type-specific function with a scaled font 
  2309.    --  of the wrong type is undefined. 
  2310.    -- 
  2311.    --  New entries may be added in future versions. 
  2312.    -- 
  2313.    --  Since: 1.2 
  2314.    pragma Convention (C, Cairo_Font_Type); 
  2315.  
  2316.    --------------------- 
  2317.    -- Query functions -- 
  2318.    --------------------- 
  2319.  
  2320.    function Get_Operator (Cr : Cairo_Context) return Cairo_Operator; 
  2321.    --  Cr: a cairo context 
  2322.    -- 
  2323.    --  Gets the current compositing operator for a cairo context. 
  2324.    -- 
  2325.    --  Return value: the current compositing operator. 
  2326.  
  2327.    function Get_Source (Cr : Cairo_Context) return Cairo_Pattern; 
  2328.    --  Cr: a cairo context 
  2329.    -- 
  2330.    --  Gets the current source pattern for Cr. 
  2331.    -- 
  2332.    --  Return value: the current source pattern. This object is owned by 
  2333.    --  cairo. To keep a reference to it, you must call 
  2334.    --  Cairo.Pattern.Reference. 
  2335.  
  2336.    function Get_Tolerance (Cr : Cairo_Context) return Gdouble; 
  2337.    --  Cr: a cairo context 
  2338.    -- 
  2339.    --  Gets the current tolerance value, as set by Set_Tolerance. 
  2340.    -- 
  2341.    --  Return value: the current tolerance value. 
  2342.  
  2343.    function Get_Antialias (Cr : Cairo_Context) return Cairo_Antialias; 
  2344.    --  Cr: a cairo context 
  2345.    -- 
  2346.    --  Gets the current shape antialiasing mode, as set by Set_Antialias. 
  2347.    -- 
  2348.    --  Return value: the current shape antialiasing mode. 
  2349.  
  2350.    function Has_Current_Point (Cr : Cairo_Context) return Boolean; 
  2351.    --  Cr: a cairo context 
  2352.    -- 
  2353.    --  Returns whether a current point is defined on the current path. 
  2354.    --  See Get_Current_Point for details on the current point. 
  2355.    -- 
  2356.    --  Return value: whether a current point is defined. 
  2357.    -- 
  2358.    --  Since: 1.6 
  2359.  
  2360.    procedure Get_Current_Point 
  2361.      (Cr : Cairo_Context; 
  2362.       X  : access Gdouble; 
  2363.       Y  : access Gdouble); 
  2364.    --  Cr: a cairo context 
  2365.    --  X: return value for X coordinate of the current point 
  2366.    --  Y: return value for Y coordinate of the current point 
  2367.    -- 
  2368.    --  Gets the current point of the current path, which is 
  2369.    --  conceptually the final point reached by the path so far. 
  2370.    -- 
  2371.    --  The current point is returned in the user-space coordinate 
  2372.    --  system. If there is no defined current point or if cr is in an 
  2373.    --  error status, X and Y will both be set to 0.0. It is possible to 
  2374.    --  check this in advance with Has_Current_Point. 
  2375.    -- 
  2376.    --  Most path construction functions alter the current point. See the 
  2377.    --  following for details on how they affect the current point: 
  2378.    --  New_Path, New_Sub_Path, Append_Path, Close_Path, Move_To, Line_To, 
  2379.    --  Curve_To, Rel_Move_To, Rel_Line_To, Rel_Curve_To, Arc, Arc_Negative, 
  2380.    --  Rectangle, Text_Path, Glyph_Path, Stroke_To_Path. 
  2381.    -- 
  2382.    --  Some functions use and alter the current point but do not otherwise 
  2383.    --  change current path: Show_Text. 
  2384.    -- 
  2385.    --  Some functions unset the current path and as a result, current point: 
  2386.    --  Fill, Stroke. 
  2387.  
  2388.    function Get_Fill_Rule (Cr : Cairo_Context) return Cairo_Fill_Rule; 
  2389.    --  Cr: a cairo context 
  2390.    -- 
  2391.    --  Gets the current fill rule, as set by Set_Fill_Rule. 
  2392.    -- 
  2393.    --  Return value: the current fill rule. 
  2394.  
  2395.    function Get_Line_Width (Cr : Cairo_Context) return Gdouble; 
  2396.    --  Cr: a cairo context 
  2397.    -- 
  2398.    --  This function returns the current line width value exactly as set by 
  2399.    --  Set_Line_Width. Note that the value is unchanged even if 
  2400.    --  the CTM has changed between the calls to Set_Line_Width and 
  2401.    --  Get_Line_Width. 
  2402.    -- 
  2403.    --  Return value: the current line width. 
  2404.  
  2405.    function Get_Line_Cap (Cr : Cairo_Context) return Cairo_Line_Cap; 
  2406.    --  Cr: a cairo context 
  2407.    -- 
  2408.    --  Gets the current line cap style, as set by Set_Line_Cap. 
  2409.    -- 
  2410.    --  Return value: the current line cap style. 
  2411.  
  2412.    function Get_Line_Join (Cr : Cairo_Context) return Cairo_Line_Join; 
  2413.    --  Cr: a cairo context 
  2414.    -- 
  2415.    --  Gets the current line join style, as set by Set_Line_Join. 
  2416.    -- 
  2417.    --  Return value: the current line join style. 
  2418.  
  2419.    function Get_Miter_Limit (Cr : Cairo_Context) return Gdouble; 
  2420.    --  Cr: a cairo context 
  2421.    -- 
  2422.    --  Gets the current miter limit, as set by Set_Miter_Limit. 
  2423.    -- 
  2424.    --  Return value: the current miter limit. 
  2425.  
  2426.    function Get_Dash_Count (Cr : Cairo_Context) return Gint; 
  2427.    --  Cr: a Cairo_Context 
  2428.    -- 
  2429.    --  This function returns the length of the dash array in cr (0 if dashing 
  2430.    --  is not currently in effect). 
  2431.    -- 
  2432.    --  See also Set_Dash and Get_Dash. 
  2433.    -- 
  2434.    --  Return value: the length of the dash array, or 0 if no dash array set. 
  2435.    -- 
  2436.    --  Since: 1.4 
  2437.  
  2438.    type Dash_Array_Access is access all Dash_Array; 
  2439.  
  2440.    procedure Get_Dash 
  2441.      (Cr     : Cairo_Context; 
  2442.       Dashes : out Dash_Array_Access; 
  2443.       Offset : out Gdouble); 
  2444.    --  Cr: a Cairo_Context 
  2445.    --  Dashes: return value for the dash array, or null 
  2446.    --  Offset: return value for the current dash Offset, or null 
  2447.    -- 
  2448.    --  Gets the current dash array. 
  2449.    -- 
  2450.    --  Since: 1.4 
  2451.  
  2452.    procedure Get_Matrix (Cr : Cairo_Context; Matrix : access Cairo_Matrix); 
  2453.    --  Cr: a cairo context 
  2454.    --  Matrix: return value for the Matrix 
  2455.    -- 
  2456.    --  Stores the current transformation matrix (CTM) into matrix. 
  2457.  
  2458.    function Get_Target (Cr : Cairo_Context) return Cairo_Surface; 
  2459.    --  Cr: a cairo context 
  2460.    -- 
  2461.    --  Gets the target surface for the cairo context as passed to Create. 
  2462.    -- 
  2463.    --  This function will always return a valid pointer, but the result 
  2464.    --  can be a "nil" surface if cr is already in an error state, 
  2465.    --  (ie. Cairo_Status /= Cairo_Status_Success). 
  2466.    --  A nil surface is indicated by 
  2467.    --  Cairo.Surface.Status/= Cairo_Status_Success. 
  2468.    -- 
  2469.    --  Return value: the target surface. This object is owned by cairo. To 
  2470.    --  keep a reference to it, you must call Cairo.Surface.Reference. 
  2471.  
  2472.    function Get_Group_Target (Cr : Cairo_Context) return Cairo_Surface; 
  2473.    --  Cr: a cairo context 
  2474.    -- 
  2475.    --  Gets the current destination surface for the context. This is either 
  2476.    --  the original target surface as passed to Create or the target 
  2477.    --  surface for the current group as started by the most recent call to 
  2478.    --  Push_Group or Push_Group_With_Content. 
  2479.    -- 
  2480.    --  This function will always return a valid pointer, but the result 
  2481.    --  can be a "nil" surface if cr is already in an error state, 
  2482.    --  (ie. Cairo_Status /= Cairo_Status_Success). 
  2483.    --  A nil surface is indicated by Cairo_Status /= Cairo_Status_Success. 
  2484.    -- 
  2485.    --  Return value: the target surface. This object is owned by cairo. To 
  2486.    --  keep a reference to it, you must call Cairo.Surface.Reference. 
  2487.    -- 
  2488.    --  Since: 1.2 
  2489.  
  2490.    type Cairo_Path_Data_Type is 
  2491.      (Cairo_Path_Move_To,    --  A move-to operation 
  2492.       Cairo_Path_Line_To,    --  A line-to operation 
  2493.       Cairo_Path_Curve_To,   --  A curve-to operation 
  2494.       Cairo_Path_Close_Path  --  A close-path operation 
  2495.      ); 
  2496.    --  Cairo_path_data is used to describe the type of one portion 
  2497.    --  of a path when represented as a Cairo_Path. 
  2498.    --  See Cairo_Path_Data for details. 
  2499.    pragma Convention (C, Cairo_Path_Data_Type); 
  2500.  
  2501.    type Header_Type is record 
  2502.       Path_Type : aliased Cairo_Path_Data_Type; 
  2503.       Length    : aliased Gint; 
  2504.    end record; 
  2505.    --  A Path header. See Cairo_Path_Data for details. 
  2506.  
  2507.    type Point_Type is record 
  2508.       X : aliased Gdouble; 
  2509.       Y : aliased Gdouble; 
  2510.    end record; 
  2511.    --  A geometrical point. See Cairo_Path_Data for details. 
  2512.  
  2513.    type Cairo_Path_Data (Discr : Guint := 0) is record 
  2514.       case Discr is 
  2515.          when 0 => 
  2516.             Header : aliased Header_Type; 
  2517.          when others => 
  2518.             Point : aliased Point_Type; 
  2519.       end case; 
  2520.    end record; 
  2521.    --  Cairo_path_data is used to represent the path data inside a 
  2522.    --  Cairo_path. 
  2523.    -- 
  2524.    --  The data structure is designed to try to balance the demands of 
  2525.    --  efficiency and ease-of-use. A path is represented as an array of 
  2526.    --  Cairo_Path_Data, which is a union of headers and points. 
  2527.    -- 
  2528.    --  Each portion of the path is represented by one or more elements in 
  2529.    --  the array, (one header followed by 0 or more points). The length 
  2530.    --  value of the header is the number of array elements for the current 
  2531.    --  portion including the header, (ie. length == 1 +  of points), and 
  2532.    --  where the number of points for each element type is as follows: 
  2533.    -- 
  2534.    --      Cairo_Path_Move_To:     1 point 
  2535.    --      Cairo_Path_Line_To:     1 point 
  2536.    --      Cairo_Path_Curve_To:    3 points 
  2537.    --      Cairo_Path_Close_Path:  0 points 
  2538.    -- 
  2539.    --  The semantics and ordering of the coordinate values are consistent 
  2540.    --  with Move_To, Line_To, Curve_To, and Close_Path. 
  2541.    -- 
  2542.    --  Here is sample code for iterating through a Cairo_Path: 
  2543.    -- 
  2544.    --    declare 
  2545.    --       J    : Gint; 
  2546.    --       Path : Cairo_Path; 
  2547.    --       Data : Cairo_Path_Data; 
  2548.    --     begin 
  2549.    --       Path = Copy_Path (Cr); 
  2550.    -- 
  2551.    --       J := 0; 
  2552.    --       while J < Path.Num_Data loop 
  2553.    --          Data := Path.Data(J); 
  2554.    -- 
  2555.    --          case Data.Header.Path_Type is 
  2556.    -- 
  2557.    --              when Cairo_Path_Move_To => 
  2558.    --                 Do_Move_To_Things (Data(1).Point.X, Data(1).Point.Y); 
  2559.    -- 
  2560.    --              when Cairo_Path_Line_To => 
  2561.    --                 Do_Line_To_Things (Data(1).Point.X, Data(1).Point.Y); 
  2562.    -- 
  2563.    --              when Cairo_Path_Curve_To => 
  2564.    --                 Do_Curve_To_Things (Data(1).Point.X, Data(1).Point.Y, 
  2565.    --                                     Data(2).Point.X, Data(2).Point.Y, 
  2566.    --                                     Data(3).Point.X, Data(3).Point.Y); 
  2567.    -- 
  2568.    --              when Cairo_Path_Curve_To => 
  2569.    --                 Do_Close_Path_Things; 
  2570.    --          end case; 
  2571.    -- 
  2572.    --          J := J + Path.Data[J].Header.Length; 
  2573.    --       end loop; 
  2574.    -- 
  2575.    --       Path_Destroy (Path); 
  2576.    --    end; 
  2577.    -- 
  2578.    --  As of cairo 1.4, cairo does not mind if there are more elements in 
  2579.    --  a portion of the path than needed.  Such elements can be used by 
  2580.    --  users of the cairo API to hold extra values in the path data 
  2581.    --  structure.  For this reason, it is recommended that applications 
  2582.    --  always use Data.Header.Length to iterate over the path data, instead of 
  2583.    --  hardcoding the number of elements for each element type. 
  2584.  
  2585.    type Path_Data_Array is array (Natural) of Cairo_Path_Data; 
  2586.    type Path_Data_Array_Access is access all Path_Data_Array; 
  2587.  
  2588.    type Cairo_Path is record 
  2589.       Status   : aliased Cairo_Status; 
  2590.       Data     : Path_Data_Array_Access; 
  2591.       --  Warning: for efficiency reasons, Data is a direct mapping to the C 
  2592.       --  structure. Therefore, there is no bounds checking on this array, 
  2593.       --  the user needs to make sure only to access data between indexes 
  2594.       --  0 and Num_Data-1. 
  2595.       Num_Data : aliased Gint; 
  2596.    end record; 
  2597.    type Cairo_Path_Access is access all Cairo_Path; 
  2598.    --  Status: the current error Status 
  2599.    --  Data: the elements in the path 
  2600.    --  Num_Data: the number of elements in the data array 
  2601.    -- 
  2602.    --  A data structure for holding a path. This data structure serves as the 
  2603.    --  return value for Copy_Path and Copy_Path_Flat as well the input value 
  2604.    --  for Append_Path. 
  2605.    -- 
  2606.    --  See Cairo_Path_Data for hints on how to iterate over the 
  2607.    --  actual data within the path. 
  2608.    -- 
  2609.    --  The num_data member gives the number of elements in the data 
  2610.    --  array. This number is larger than the number of independent path 
  2611.    --  portions (defined in Cairo_Path_Data_Type), since the data 
  2612.    --  includes both headers and coordinates for each portion. 
  2613.  
  2614.    function Copy_Path (Cr : Cairo_Context) return Cairo_Path_Access; 
  2615.    --  Cr: a cairo context 
  2616.    -- 
  2617.    --  Creates a copy of the current path and returns it to the user as a 
  2618.    --  Cairo_Path. See Cairo_Path_Data for hints on how to iterate 
  2619.    --  over the returned data structure. 
  2620.    -- 
  2621.    --  This function will always return a valid pointer, but the result 
  2622.    --  will have no data (Data = null and Num_Data = 0), if 
  2623.    --  either of the following conditions hold: 
  2624.    -- 
  2625.    --  -> If there is insufficient memory to copy the path. In this 
  2626.    --      case Path.Status will be set to Cairo_Status_No_Memory 
  2627.    -- 
  2628.    --  -> If Cr is already in an error state. In this case 
  2629.    --     Path.Status will contain the same status that 
  2630.    --     would be returned by Status. 
  2631.    -- 
  2632.    --  Return value: the copy of the current path. The caller owns the 
  2633.    --  returned object and should call Path_Destroy when finished with it. 
  2634.  
  2635.    function Copy_Path_Flat (Cr : Cairo_Context) return Cairo_Path_Access; 
  2636.    --  Cr: a cairo context 
  2637.    -- 
  2638.    --  Gets a flattened copy of the current path and returns it to the 
  2639.    --  user as a Cairo_Path. See Cairo_Path_Data for hints on 
  2640.    --  how to iterate over the returned data structure. 
  2641.    -- 
  2642.    --  This function is like Copy_Path except that any curves 
  2643.    --  in the path will be approximated with piecewise-linear 
  2644.    --  approximations, (accurate to within the current tolerance 
  2645.    --  value). That is, the result is guaranteed to not have any elements 
  2646.    --  of type Cairo_Path_Curve_To which will instead be replaced by a 
  2647.    --  series of Cairo_Path_Line_To elements. 
  2648.    -- 
  2649.    --  This function will always return a valid pointer, but the result will 
  2650.    --  have no data (Data = null and Num_Data = 0), if either of the following 
  2651.    --  conditions hold: 
  2652.    -- 
  2653.    --  -> If there is insufficient memory to copy the path. In this 
  2654.    --      case Path.Status will be set to Cairo_Status_No_Memory 
  2655.    -- 
  2656.    --  -> If Cr is already in an error state. In this case 
  2657.    --     Path.Status will contain the same status that 
  2658.    --     would be returned by Status. 
  2659.    -- 
  2660.    --  Return value: the copy of the current path. The caller owns the 
  2661.    --  returned object and should call Path_Destroy when finished 
  2662.    --  with it. 
  2663.  
  2664.    procedure Append_Path 
  2665.      (Cr   : Cairo_Context; 
  2666.       Path : access Cairo_Path); 
  2667.    --  Cr: a cairo context 
  2668.    --  Path: Path to be appended 
  2669.    -- 
  2670.    --  Append the path onto the current path. The path may be either the return 
  2671.    --  value from one of Copy_Path or Copy_Path_Flat or it may be constructed 
  2672.    --  manually. See Cairo_Path for details on how the path data structure 
  2673.    --  should be initialized, and note that Path.Status must be initialized to 
  2674.    --  Cairo_Status_Success. 
  2675.  
  2676.    procedure Path_Destroy (Path : access Cairo_Path); 
  2677.    --  Path: a path previously returned by either Copy_Path or Copy_Path_Flat. 
  2678.    -- 
  2679.    --  Immediately releases all memory associated with Path. After a call 
  2680.    --  to Path_Destroy the Path pointer is no longer valid and should not be 
  2681.    --  used further. 
  2682.    -- 
  2683.    --  Note: Path_Destroy should only be called with an access to a 
  2684.    --  Cairo_Path returned by a cairo function. Any path that is created 
  2685.    --  manually (ie. outside of cairo) should be destroyed manually as well. 
  2686.  
  2687.    -------------------------- 
  2688.    -- Error status queries -- 
  2689.    -------------------------- 
  2690.  
  2691.    function Status (Cr : Cairo_Context) return Cairo_Status; 
  2692.    --  Cr: a cairo context 
  2693.    -- 
  2694.    --  Checks whether an error has previously occurred for this context. 
  2695.    -- 
  2696.    --  Returns: the current status of this context, see Cairo_Status 
  2697.  
  2698.    Null_Context      : constant Cairo_Context; 
  2699.    Null_Surface      : constant Cairo_Surface; 
  2700.    Null_Pattern      : constant Cairo_Pattern; 
  2701.    Null_Scaled_Font  : constant Cairo_Scaled_Font; 
  2702.    Null_Font_Face    : constant Cairo_Font_Face; 
  2703.    Null_Font_Options : constant Cairo_Font_Options; 
  2704.  
  2705. private 
  2706.  
  2707.    pragma Convention (C, Cairo_Destroy_Func); 
  2708.    pragma Convention (C, Cairo_Status); 
  2709.    pragma Convention (C, Cairo_Operator); 
  2710.    pragma Convention (C, Cairo_Antialias); 
  2711.    pragma Convention (C, Cairo_Fill_Rule); 
  2712.    pragma Convention (C, Cairo_Line_Cap); 
  2713.    pragma Convention (C, Cairo_Line_Join); 
  2714.    pragma Convention (C, Path_Data_Array_Access); 
  2715.    pragma Convention (C_Pass_By_Copy, Cairo_Path); 
  2716.    pragma Convention (C_Pass_By_Copy, Cairo_Rectangle); 
  2717.    pragma Convention (C, Cairo_Rectangle_Array_Access); 
  2718.  
  2719.    pragma Convention (C_Pass_By_Copy, Header_Type); 
  2720.    pragma Convention (C_Pass_By_Copy, Point_Type); 
  2721.    pragma Convention (C_Pass_By_Copy, Cairo_Path_Data); 
  2722.    pragma Unchecked_Union (Cairo_Path_Data); 
  2723.  
  2724.    type Cairo_Context is new System.Address; 
  2725.    Null_Context : constant Cairo_Context := 
  2726.      Cairo_Context (System.Null_Address); 
  2727.    type Cairo_Surface is new System.Address; 
  2728.    Null_Surface : constant Cairo_Surface := 
  2729.      Cairo_Surface (System.Null_Address); 
  2730.    type Cairo_Pattern is new System.Address; 
  2731.    Null_Pattern : constant Cairo_Pattern := 
  2732.      Cairo_Pattern (System.Null_Address); 
  2733.    type Cairo_Scaled_Font is new System.Address; 
  2734.    Null_Scaled_Font : constant Cairo_Scaled_Font := 
  2735.      Cairo_Scaled_Font (System.Null_Address); 
  2736.    type Cairo_Font_Face is new System.Address; 
  2737.    Null_Font_Face : constant Cairo_Font_Face := 
  2738.      Cairo_Font_Face (System.Null_Address); 
  2739.    type Cairo_Font_Options is new System.Address; 
  2740.    Null_Font_Options : constant Cairo_Font_Options := 
  2741.      Cairo_Font_Options (System.Null_Address); 
  2742.    pragma Import (C, Create, "cairo_create"); 
  2743.    pragma Import (C, Reference, "cairo_reference"); 
  2744.    pragma Import (C, Get_Reference_Count, "cairo_get_reference_count"); 
  2745.    pragma Import (C, Get_User_Data, "cairo_get_user_data"); 
  2746.    pragma Import (C, Set_User_Data, "cairo_set_user_data"); 
  2747.    pragma Import (C, Save, "cairo_save"); 
  2748.    pragma Import (C, Restore, "cairo_restore"); 
  2749.    pragma Import (C, Push_Group, "cairo_push_group"); 
  2750.    pragma Import 
  2751.      (C, 
  2752.       Push_Group_With_Content, 
  2753.       "cairo_push_group_with_content"); 
  2754.    pragma Import (C, Pop_Group, "cairo_pop_group"); 
  2755.    pragma Import (C, Pop_Group_To_Source, "cairo_pop_group_to_source"); 
  2756.    pragma Import (C, Set_Operator, "cairo_set_operator"); 
  2757.    pragma Import (C, Set_Source, "cairo_set_source"); 
  2758.    pragma Import (C, Set_Source_Rgb, "cairo_set_source_rgb"); 
  2759.    pragma Import (C, Set_Source_Rgba, "cairo_set_source_rgba"); 
  2760.    pragma Import (C, Set_Source_Surface, "cairo_set_source_surface"); 
  2761.    pragma Import (C, Set_Tolerance, "cairo_set_tolerance"); 
  2762.    pragma Import (C, Set_Antialias, "cairo_set_antialias"); 
  2763.    pragma Import (C, Set_Fill_Rule, "cairo_set_fill_rule"); 
  2764.    pragma Import (C, Set_Line_Width, "cairo_set_line_width"); 
  2765.    pragma Import (C, Set_Line_Cap, "cairo_set_line_cap"); 
  2766.    pragma Import (C, Set_Line_Join, "cairo_set_line_join"); 
  2767.    pragma Import (C, Set_Miter_Limit, "cairo_set_miter_limit"); 
  2768.    pragma Import (C, Translate, "cairo_translate"); 
  2769.    pragma Import (C, Scale, "cairo_scale"); 
  2770.    pragma Import (C, Rotate, "cairo_rotate"); 
  2771.    pragma Import (C, Transform, "cairo_transform"); 
  2772.    pragma Import (C, Set_Matrix, "cairo_set_matrix"); 
  2773.    pragma Import (C, Identity_Matrix, "cairo_identity_matrix"); 
  2774.    pragma Import (C, User_To_Device, "cairo_user_to_device"); 
  2775.    pragma Import 
  2776.      (C, 
  2777.       User_To_Device_Distance, 
  2778.       "cairo_user_to_device_distance"); 
  2779.    pragma Import (C, Device_To_User, "cairo_device_to_user"); 
  2780.    pragma Import 
  2781.      (C, 
  2782.       Device_To_User_Distance, 
  2783.       "cairo_device_to_user_distance"); 
  2784.    pragma Import (C, New_Path, "cairo_new_path"); 
  2785.    pragma Import (C, Move_To, "cairo_move_to"); 
  2786.    pragma Import (C, New_Sub_Path, "cairo_new_sub_path"); 
  2787.    pragma Import (C, Line_To, "cairo_line_to"); 
  2788.    pragma Import (C, Curve_To, "cairo_curve_to"); 
  2789.    pragma Import (C, Arc, "cairo_arc"); 
  2790.    pragma Import (C, Arc_Negative, "cairo_arc_negative"); 
  2791.    pragma Import (C, Rel_Move_To, "cairo_rel_move_to"); 
  2792.    pragma Import (C, Rel_Line_To, "cairo_rel_line_to"); 
  2793.    pragma Import (C, Rel_Curve_To, "cairo_rel_curve_to"); 
  2794.    pragma Import (C, Rectangle, "cairo_rectangle"); 
  2795.    pragma Import (C, Close_Path, "cairo_close_path"); 
  2796.    pragma Import (C, Path_Extents, "cairo_path_extents"); 
  2797.    pragma Import (C, Paint, "cairo_paint"); 
  2798.    pragma Import (C, Paint_With_Alpha, "cairo_paint_with_alpha"); 
  2799.    pragma Import (C, Mask, "cairo_mask"); 
  2800.    pragma Import (C, Mask_Surface, "cairo_mask_surface"); 
  2801.    pragma Import (C, Stroke, "cairo_stroke"); 
  2802.    pragma Import (C, Stroke_Preserve, "cairo_stroke_preserve"); 
  2803.    pragma Import (C, Fill, "cairo_fill"); 
  2804.    pragma Import (C, Fill_Preserve, "cairo_fill_preserve"); 
  2805.    pragma Import (C, Copy_Page, "cairo_copy_page"); 
  2806.    pragma Import (C, Show_Page, "cairo_show_page"); 
  2807.    pragma Import (C, Stroke_Extents, "cairo_stroke_extents"); 
  2808.    pragma Import (C, Fill_Extents, "cairo_fill_extents"); 
  2809.    pragma Import (C, Reset_Clip, "cairo_reset_clip"); 
  2810.    pragma Import (C, Clip, "cairo_clip"); 
  2811.    pragma Import (C, Clip_Preserve, "cairo_clip_preserve"); 
  2812.    pragma Import (C, Clip_Extents, "cairo_clip_extents"); 
  2813.    pragma Import 
  2814.      (C, 
  2815.       Copy_Clip_Rectangle_List, 
  2816.       "cairo_copy_clip_rectangle_list"); 
  2817.    pragma Import (C, Rectangle_List_Destroy, "cairo_rectangle_list_destroy"); 
  2818.    pragma Import (C, Set_Font_Size, "cairo_set_font_size"); 
  2819.    pragma Import (C, Set_Font_Matrix, "cairo_set_font_matrix"); 
  2820.    pragma Import (C, Get_Font_Matrix, "cairo_get_font_matrix"); 
  2821.    pragma Import (C, Set_Font_Options, "cairo_set_font_options"); 
  2822.    pragma Import (C, Get_Font_Options, "cairo_get_font_options"); 
  2823.    pragma Import (C, Set_Font_Face, "cairo_set_font_face"); 
  2824.    pragma Import (C, Get_Font_Face, "cairo_get_font_face"); 
  2825.    pragma Import (C, Set_Scaled_Font, "cairo_set_scaled_font"); 
  2826.    pragma Import (C, Get_Scaled_Font, "cairo_get_scaled_font"); 
  2827.    pragma Import (C, Show_Glyphs, "cairo_show_glyphs"); 
  2828.    --     pragma Import (C, Show_Text_Glyphs, "cairo_show_text_glyphs"); 
  2829.    --     pragma Import (C, Glyph_Path, "cairo_glyph_path"); 
  2830.    pragma Import (C, Text_Extents, "cairo_text_extents"); 
  2831.    pragma Import (C, Glyph_Extents, "cairo_glyph_extents"); 
  2832.    pragma Import (C, Font_Extents, "cairo_font_extents"); 
  2833.    pragma Import (C, Get_Operator, "cairo_get_operator"); 
  2834.    pragma Import (C, Get_Source, "cairo_get_source"); 
  2835.    pragma Import (C, Get_Tolerance, "cairo_get_tolerance"); 
  2836.    pragma Import (C, Get_Antialias, "cairo_get_antialias"); 
  2837.    pragma Import (C, Get_Current_Point, "cairo_get_current_point"); 
  2838.    pragma Import (C, Get_Fill_Rule, "cairo_get_fill_rule"); 
  2839.    pragma Import (C, Get_Line_Width, "cairo_get_line_width"); 
  2840.    pragma Import (C, Get_Line_Cap, "cairo_get_line_cap"); 
  2841.    pragma Import (C, Get_Line_Join, "cairo_get_line_join"); 
  2842.    pragma Import (C, Get_Miter_Limit, "cairo_get_miter_limit"); 
  2843.    pragma Import (C, Get_Dash_Count, "cairo_get_dash_count"); 
  2844.    pragma Import (C, Get_Matrix, "cairo_get_matrix"); 
  2845.    pragma Import (C, Get_Target, "cairo_get_target"); 
  2846.    pragma Import (C, Get_Group_Target, "cairo_get_group_target"); 
  2847.    pragma Import (C, Copy_Path, "cairo_copy_path"); 
  2848.    pragma Import (C, Copy_Path_Flat, "cairo_copy_path_flat"); 
  2849.    pragma Import (C, Append_Path, "cairo_append_path"); 
  2850.    pragma Import (C, Path_Destroy, "cairo_path_destroy"); 
  2851.    pragma Import (C, Status, "cairo_status"); 
  2852.  
  2853. end Cairo;