1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-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. --  A structure specifying a transformation between user-space coordinates and 
  26. --  device coordinates. The transformation is given by 
  27. -- 
  28. --    x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0; 
  29. --    y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0; 
  30. -- 
  31. --  </description> 
  32. pragma Ada_2005; 
  33.  
  34. pragma Warnings (Off, "*is already use-visible*"); 
  35. with Glib; use Glib; 
  36.  
  37. package Pango.Matrix is 
  38.  
  39.    type Pango_Matrix is record 
  40.       Xx : Gdouble; 
  41.       Xy : Gdouble; 
  42.       Yx : Gdouble; 
  43.       Yy : Gdouble; 
  44.       X0 : Gdouble; 
  45.       Y0 : Gdouble; 
  46.    end record; 
  47.    pragma Convention (C, Pango_Matrix); 
  48.  
  49.    function From_Object_Free (B : access Pango_Matrix) return Pango_Matrix; 
  50.    pragma Inline (From_Object_Free); 
  51.    --  A structure specifying a transformation between user-space coordinates 
  52.    --  and device coordinates. The transformation is given by 
  53.    -- 
  54.    --    x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0; 
  55.    --    y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0; 
  56.  
  57.    ------------------ 
  58.    -- Constructors -- 
  59.    ------------------ 
  60.  
  61.    function Get_Type return Glib.GType; 
  62.    pragma Import (C, Get_Type, "pango_matrix_get_type"); 
  63.  
  64.    ------------- 
  65.    -- Methods -- 
  66.    ------------- 
  67.  
  68.    procedure Concat (Self : Pango_Matrix; New_Matrix : Pango_Matrix); 
  69.    pragma Import (C, Concat, "pango_matrix_concat"); 
  70.    --  Changes the transformation represented by Matrix to be the 
  71.    --  transformation given by first applying transformation given by 
  72.    --  New_Matrix then applying the original transformation. 
  73.    --  Since: gtk+ 1.6 
  74.    --  "new_matrix": a Pango.Matrix.Pango_Matrix 
  75.  
  76.    function Copy (Self : Pango_Matrix) return Pango_Matrix; 
  77.    pragma Import (C, Copy, "pango_matrix_copy"); 
  78.    --  Copies a Pango.Matrix.Pango_Matrix. 
  79.    --  Since: gtk+ 1.6 
  80.  
  81.    procedure Free (Self : Pango_Matrix); 
  82.    pragma Import (C, Free, "pango_matrix_free"); 
  83.    --  Free a Pango.Matrix.Pango_Matrix created with Pango.Matrix.Copy. 
  84.    --  Since: gtk+ 1.6 
  85.  
  86.    function Get_Font_Scale_Factor (Self : Pango_Matrix) return Gdouble; 
  87.    pragma Import (C, Get_Font_Scale_Factor, "pango_matrix_get_font_scale_factor"); 
  88.    --  Returns the scale factor of a matrix on the height of the font. That 
  89.    --  is, the scale factor in the direction perpendicular to the vector that 
  90.    --  the X coordinate is mapped to. 
  91.    --  Since: gtk+ 1.12 
  92.  
  93.    procedure Rotate (Self : in out Pango_Matrix; Degrees : Gdouble); 
  94.    pragma Import (C, Rotate, "pango_matrix_rotate"); 
  95.    --  Changes the transformation represented by Matrix to be the 
  96.    --  transformation given by first rotating by Degrees degrees 
  97.    --  counter-clockwise then applying the original transformation. 
  98.    --  Since: gtk+ 1.6 
  99.    --  "degrees": degrees to rotate counter-clockwise 
  100.  
  101.    procedure Scale 
  102.       (Self    : in out Pango_Matrix; 
  103.        Scale_X : Gdouble; 
  104.        Scale_Y : Gdouble); 
  105.    pragma Import (C, Scale, "pango_matrix_scale"); 
  106.    --  Changes the transformation represented by Matrix to be the 
  107.    --  transformation given by first scaling by Sx in the X direction and Sy in 
  108.    --  the Y direction then applying the original transformation. 
  109.    --  Since: gtk+ 1.6 
  110.    --  "scale_x": amount to scale by in X direction 
  111.    --  "scale_y": amount to scale by in Y direction 
  112.  
  113.    procedure Transform_Distance 
  114.       (Self : Pango_Matrix; 
  115.        Dx   : in out Gdouble; 
  116.        Dy   : in out Gdouble); 
  117.    pragma Import (C, Transform_Distance, "pango_matrix_transform_distance"); 
  118.    --  Transforms the distance vector (Dx,Dy) by Matrix. This is similar to 
  119.    --  Pango.Matrix.Transform_Point except that the translation components of 
  120.    --  the transformation are ignored. The calculation of the returned vector 
  121.    --  is as follows: 
  122.    --    dx2 = dx1 * xx + dy1 * xy; 
  123.    --    dy2 = dx1 * yx + dy1 * yy; 
  124.    --  Affine transformations are position invariant, so the same vector 
  125.    --  always transforms to the same vector. If (X1,Y1) transforms to (X2,Y2) 
  126.    --  then (X1+Dx1,Y1+Dy1) will transform to (X1+Dx2,Y1+Dy2) for all values of 
  127.    --  X1 and X2. 
  128.    --  Since: gtk+ 1.16 
  129.    --  "dx": in/out X component of a distance vector 
  130.    --  "dy": in/out Y component of a distance vector 
  131.  
  132.    procedure Transform_Pixel_Rectangle 
  133.       (Self : Pango_Matrix; 
  134.        Rect : in out Pango_Rectangle); 
  135.    pragma Import (C, Transform_Pixel_Rectangle, "pango_matrix_transform_pixel_rectangle"); 
  136.    --  First transforms the Rect using Matrix, then calculates the bounding 
  137.    --  box of the transformed rectangle. The rectangle should be in device 
  138.    --  units (pixels). 
  139.    --  This function is useful for example when you want to draw a rotated 
  140.    --  Pangolayout to an image buffer, and want to know how large the image 
  141.    --  should be and how much you should shift the layout when rendering. 
  142.    --  For better accuracy, you should use Pango.Matrix.Transform_Rectangle on 
  143.    --  original rectangle in Pango units and convert to pixels afterward using 
  144.    --  pango_extents_to_pixels's first argument. 
  145.    --  Since: gtk+ 1.16 
  146.    --  "rect": in/out bounding box in device units, or null 
  147.  
  148.    procedure Transform_Point 
  149.       (Self : Pango_Matrix; 
  150.        X    : in out Gdouble; 
  151.        Y    : in out Gdouble); 
  152.    pragma Import (C, Transform_Point, "pango_matrix_transform_point"); 
  153.    --  Transforms the point (X, Y) by Matrix. 
  154.    --  Since: gtk+ 1.16 
  155.    --  "x": in/out X position 
  156.    --  "y": in/out Y position 
  157.  
  158.    procedure Transform_Rectangle 
  159.       (Self : Pango_Matrix; 
  160.        Rect : in out Pango_Rectangle); 
  161.    pragma Import (C, Transform_Rectangle, "pango_matrix_transform_rectangle"); 
  162.    --  First transforms Rect using Matrix, then calculates the bounding box of 
  163.    --  the transformed rectangle. The rectangle should be in Pango units. 
  164.    --  This function is useful for example when you want to draw a rotated 
  165.    --  Pangolayout to an image buffer, and want to know how large the image 
  166.    --  should be and how much you should shift the layout when rendering. 
  167.    --  If you have a rectangle in device units (pixels), use 
  168.    --  Pango.Matrix.Transform_Pixel_Rectangle. 
  169.    --  If you have the rectangle in Pango units and want to convert to 
  170.    --  transformed pixel bounding box, it is more accurate to transform it 
  171.    --  first (using this function) and pass the result to 
  172.    --  pango_extents_to_pixels, first argument, for an inclusive rounded 
  173.    --  rectangle. However, there are valid reasons that you may want to convert 
  174.    --  to pixels first and then transform, for example when the transformed 
  175.    --  coordinates may overflow in Pango units (large matrix translation for 
  176.    --  example). 
  177.    --  Since: gtk+ 1.16 
  178.    --  "rect": in/out bounding box in Pango units, or null 
  179.  
  180.    procedure Translate 
  181.       (Self : in out Pango_Matrix; 
  182.        Tx   : Gdouble; 
  183.        Ty   : Gdouble); 
  184.    pragma Import (C, Translate, "pango_matrix_translate"); 
  185.    --  Changes the transformation represented by Matrix to be the 
  186.    --  transformation given by first translating by (Tx, Ty) then applying the 
  187.    --  original transformation. 
  188.    --  Since: gtk+ 1.6 
  189.    --  "tx": amount to translate in the X direction 
  190.    --  "ty": amount to translate in the Y direction 
  191.  
  192. end Pango.Matrix;