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. --  Interfacing between Gdk and Cairo. 
  26. --  </description> 
  27. -- 
  28. --  <c_version>2.16.6</c_version> 
  29. --  <group>Cairo</group> 
  30.  
  31. with Glib;         use Glib; 
  32. with Cairo;        use Cairo; 
  33. with Gdk.Color;    use Gdk.Color; 
  34. with Gdk.Pixbuf;   use Gdk.Pixbuf; 
  35. with Gdk.RGBA;     use Gdk.RGBA; 
  36.  
  37. package Gdk.Cairo is 
  38.  
  39.    function Create (Window : Gdk.Gdk_Window) return Cairo_Context; 
  40.    --  Creates a Cairo context for drawing to Drawable. 
  41.    -- 
  42.    --  Note that due to double-buffering, Cairo contexts created 
  43.    --  in a GTK+ expose event handler cannot be cached and reused 
  44.    --  between different expose events. 
  45.    -- 
  46.    --  Returns a newly created Cairo context. The result should be freed with 
  47.    --  Cairo.Destroy. 
  48.  
  49.    procedure Set_Source_Pixbuf 
  50.      (Cr       : Cairo_Context; 
  51.       Pixbuf   : Gdk_Pixbuf; 
  52.       Pixbuf_X : Gdouble; 
  53.       Pixbuf_Y : Gdouble); 
  54.    --  Cr: a Cairo_Context 
  55.    --  Pixbuf: a Gdk_Pixbuf 
  56.    --  Pixbuf_X: X coordinate of location to place upper left corner of Pixbuf 
  57.    --  Pixbuf_Y: Y coordinate of location to place upper left corner of Pixbuf 
  58.    -- 
  59.    --  Sets the given pixbuf as the source pattern for the Cairo context. 
  60.    --  The pattern has an extend mode of CAIRO_EXTEND_NONE and is aligned 
  61.    --  so that the origin of Pixbuf is Pixbuf_X, Pixbuf_Y 
  62.  
  63.    procedure Set_Source_Color 
  64.      (Cr       : Cairo_Context; 
  65.       Color    : Gdk_Color); 
  66.    procedure Set_Source_RGBA 
  67.      (Cr       : Cairo_Context; 
  68.       Color    : Gdk.RGBA.Gdk_RGBA); 
  69.    --  Set the specified Color as the source of Cr. 
  70.  
  71. private 
  72.    pragma Import (C, Set_Source_Color, "gdk_cairo_set_source_color"); 
  73. end Gdk.Cairo;