home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adapm_15.zip / gpi.adb < prev    next >
Text File  |  1994-12-07  |  27KB  |  855 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                               PM Bindings                                --
  4. --                                                                          --
  5. --                                  GPI                                     --
  6. --                                                                          --
  7. --                                 B o d y                                  --
  8. --                                                                          --
  9. --                            $Revision: .14 $                              --
  10. --                                                                          --
  11. --     Copyright (c) 1994 Dimensional Media Systems, All Rights Reserved    --
  12. --                                                                          --
  13. --   The PM bindings are free software; you can redistribute them and/or    --
  14. --   modify them under terms of the GNU General Public License as published --
  15. --   by the Free Software Foundation; either version 2, or (at your         --
  16. --   option) any later version.  The PM bindings are distributed in the     --
  17. --   hope that they will be useful, but WITH OUT ANY WARRANTY; without even --
  18. --   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR    --
  19. --   PURPOSE.  See the GNU General Public License for more details.  You    --
  20. --   should have received a copy of the GNU General Public License          --
  21. --   distributed with The PM bindings; see file COPYING.  If not, write to  --
  22. --   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25. --                                                                          --
  26. --   For more information about these PM bindings and their usage with GNAT --
  27. --   you can contact Bill Yow at                                            --
  28. --                                                                          --  
  29. --      Dimensional Media Systems (DMS)                                     --
  30. --      1522 Festival Dr.                                                   --
  31. --      Houston TX, 77062                                                   --
  32. --      Phone - (713) 488-7050                                              --
  33. --      Email - byow@mci.com                                                --
  34. --                                                                          --
  35. ------------------------------------------------------------------------------
  36.  
  37. with Pm_Types;
  38. with Win;
  39. with System;
  40.  
  41. package body GPI is
  42.  
  43.    Background_Mix_Values : constant array (Background_Mix_Type)
  44.                                                      of Pm_Types.Long :=
  45.       (Bm_Error            => -1,
  46.        Bm_Default          => 0,
  47.        Bm_Or               => 1,
  48.        Bm_Overpaint        => 2,
  49.        Bm_Leave_Alone      => 5,
  50.        Bm_Xor              => 4,
  51.        Bm_And              => 6,
  52.        Bm_Subtract         => 7,
  53.        Bm_Mask_Src_Not     => 8,
  54.        Bm_Zero             => 9,
  55.        Bm_Not_Merge_Src    => 10,
  56.        Bm_Not_Xor_Src      => 11,
  57.        Bm_Invert           => 12,
  58.        Bm_Merge_Src_Not    => 13,
  59.        Bm_Not_Copy_Src     => 14,
  60.        Bm_Merge_Not_Src    => 15,
  61.        Bm_Not_Mask_Src     => 16,
  62.        Bm_One              => 17,
  63.        Bm_Src_Transparent  => 18, 
  64.        Bm_Dest_Transparent => 19);
  65.  
  66.   ---------------------------------------------------------
  67.  
  68.     Outline_Values : constant array (Outline_Style_Type) 
  69.                                                of Pm_Types.Long :=
  70.         (Dro_Fill         => 1,
  71.          Dro_Outline      => 2,
  72.          Dro_Outline_Fill => 3);
  73.  
  74.   ---------------------------------------------------------
  75.  
  76.     function Failed_To (Value : Boolean) return Boolean is
  77.       begin
  78.         return not Value;
  79.       end Failed_To;
  80.  
  81.   ---------------------------------------------------------
  82.  
  83.     function GPISetBackMix (
  84.                Ps  : Win.Ps_Type;
  85.                Mix : Pm_Types.Long) return Pm_Types.Long;
  86.  
  87.     pragma Import (Convention => C,
  88.                    Entity     => GpiSetBackMix,
  89.                    Link_Name  => "GpiSetBackMix");
  90.  
  91.   ---------------------------------------------------------
  92.  
  93.    function Set_Background_Mix (
  94.               Ps  : Win.Ps_Type;
  95.               Mix : Background_Mix_Type) return Boolean is
  96.      begin
  97.        return GPISetBackMix (Ps, Background_Mix_Values (Mix)) = 1;
  98.      end Set_Background_Mix;
  99.              
  100.   ---------------------------------------------------------
  101.  
  102.    procedure Set_Background_Mix (
  103.               Ps  : Win.Ps_Type;
  104.               Mix : Background_Mix_Type) is
  105.     begin
  106.      if not Set_Background_Mix (Ps, Mix) then
  107.        raise GPI_Error;
  108.      end if;
  109.     end Set_Background_Mix;      
  110.  
  111.   ---------------------------------------------------------
  112.  
  113.    function Set_Background_Color (
  114.                   Ps    : Win.Ps_Type;
  115.                   Color : Color_Type) return Boolean is
  116.        
  117.     function GpiSetBackColor (
  118.                Ps    : Win.Ps_Type;
  119.                Color : Color_Type) return Pm_Types.Long;
  120.  
  121.     pragma Import (Convention => C,
  122.                    Entity     => GpiSetBackColor,
  123.                    Link_Name  => "GpiSetBackColor");
  124.  
  125.    begin
  126.      return GpiSetBackColor (Ps, Color) = 1;
  127.    end Set_Background_Color;
  128.  
  129.   ---------------------------------------------------------
  130.  
  131.    procedure Set_Background_Color (
  132.                   Ps    : Win.Ps_Type;
  133.                   Color : Color_Type) is
  134.      begin
  135.        if not Set_Background_Color (Ps, Color) then
  136.          raise GPI_Error;
  137.        end if;
  138.      end Set_Background_Color;
  139.  
  140.   ---------------------------------------------------------
  141.  
  142.    function Set_Color (
  143.                   Ps    : Win.Ps_Type;
  144.                   Color : Color_Type) return Boolean is
  145.  
  146.     function GpiSetColor (
  147.                Ps    : Win.Ps_Type;
  148.                Color : Color_Type) return Pm_Types.Long;
  149.  
  150.     pragma Import (Convention => C,
  151.                    Entity     => GpiSetColor,
  152.                    Link_Name  => "GpiSetColor");
  153.  
  154.    begin
  155.      return GpiSetColor (Ps, Color) = 1;
  156.    end Set_Color;    
  157.        
  158.   ---------------------------------------------------------
  159.  
  160.    procedure Set_Color (
  161.                   Ps    : Win.Ps_Type;
  162.                   Color : Color_Type) is
  163.      begin
  164.        if not Set_Color (Ps, Color) then
  165.          raise GPI_Error;
  166.        end if;
  167.      end Set_Color;
  168.  
  169.   ---------------------------------------------------------
  170.  
  171.   function Status_Is (Value : Pm_Types.Long) return Status_Type is
  172.     begin
  173.  
  174.       case Value is
  175.         when 0      => return Error;
  176.         when 1      => return Okay;
  177.         when 2      => return Hits;
  178.         when others => null;              
  179.       end case;
  180.  
  181.       return Error;
  182.     end Status_Is;
  183.  
  184.   ---------------------------------------------------------
  185.  
  186.    function Char_String_At (
  187.                   Ps    : Win.Ps_Type;
  188.                   Point : Win.Point_Type;
  189.                   Text  : String) return Status_Type is
  190.  
  191.     function GPICharStringAt (
  192.                   Ps     : Win.Ps_Type;
  193.                   Point  : System.Address;
  194.                   Length : Pm_Types.Long;
  195.                   Str    : System.Address) return Pm_Types.Long;
  196.      
  197.     pragma Import (Convention => C,
  198.                    Entity     => GpiCharStringAt,
  199.                    Link_Name  => "GpiCharStringAt");
  200.                   
  201.      Result : Pm_Types.Long;
  202.    begin
  203.        
  204.      Result := GPICharStringAt (
  205.                  Ps     => Ps,
  206.                  Point  => Point'address,
  207.                  Length => Pm_Types.Long (Text'Length),
  208.                  Str    => Text (Text'first)'address);
  209.  
  210.      return Status_Is (Result);
  211.  
  212.   end Char_String_At;
  213.  
  214.   ---------------------------------------------------------
  215.  
  216.    procedure Char_String_At (
  217.                   Ps    : in Win.Ps_Type;
  218.                   Point : in Win.Point_Type;
  219.                   Text  : in String) is
  220.     begin
  221.  
  222.       if Error = Char_String_At (Ps, Point, Text) then
  223.          raise GPI_Error;
  224.       end if;
  225.  
  226.     end Char_String_At;
  227.  
  228.   ---------------------------------------------
  229.  
  230.    function Char_String (
  231.                   Ps    : Win.Ps_Type;
  232.                   Text  : String) return Status_Type is
  233.  
  234.     function GPICharString (
  235.                   Ps     : Win.Ps_Type;
  236.                   Length : Pm_Types.Long;
  237.                   Str    : System.Address) return Pm_Types.Long;
  238.      
  239.     pragma Import (Convention => C,
  240.                    Entity     => GpiCharString,
  241.                    Link_Name  => "GpiCharString");
  242.                   
  243.      Result : Pm_Types.Long;
  244.    begin
  245.        
  246.      Result := GPICharString (
  247.                  Ps     => Ps,
  248.                  Length => Pm_Types.Long (Text'Length),
  249.                  Str    => Text (Text'first)'address);
  250.  
  251.      return Status_Is (Result);
  252.  
  253.   end Char_String;
  254.  
  255.   ---------------------------------------------------------
  256.  
  257.    procedure Char_String (
  258.                   Ps    : in Win.Ps_Type;
  259.                   Text  : in String) is
  260.     begin
  261.  
  262.       if Error = Char_String (Ps, Text) then
  263.          raise GPI_Error;
  264.       end if;
  265.  
  266.     end Char_String;
  267.  
  268.   ---------------------------------------------
  269.  
  270.    function Set_Current_Position (
  271.               Ps    : Win.Ps_Type;
  272.               Point : Win.Point_Type) return Boolean is
  273.      
  274.      function GPISetCurrentPosition (
  275.               Ps    : Win.Ps_Type;
  276.               Point : System.Address) return Pm_Types.Long;
  277.      
  278.     pragma Import (Convention => C,
  279.                    Entity     => GpiSetCurrentPosition,
  280.                    Link_Name  => "GpiSetCurrentPosition");
  281.                   
  282.      Result : Pm_Types.Long;
  283.    begin
  284.  
  285.      Result := GpiSetCurrentPosition (
  286.                  Ps    => Ps,
  287.                  Point => Point'Address);
  288.  
  289.      return Result = 1;
  290.    end Set_Current_Position;
  291.  
  292.   ---------------------------------------------
  293.  
  294.    procedure Set_Current_Position (
  295.               Ps    : Win.Ps_Type;
  296.               Point : Win.Point_Type) is
  297.     begin
  298.       if not Set_Current_Position (Ps, Point) then
  299.         raise Gpi_Error;
  300.       end if;
  301.     end Set_Current_Position;
  302.  
  303.   ---------------------------------------------
  304.  
  305.    function Query_Current_Position (
  306.               Ps    : Win.Ps_Type;
  307.               Point : Win.Point_Pointer_Type) return Boolean is
  308.      
  309.      function GPIQueryCurrentPosition (
  310.               Ps    : Win.Ps_Type;
  311.               Point : Win.Point_Pointer_Type) return Pm_Types.Long;
  312.      
  313.     pragma Import (Convention => C,
  314.                    Entity     => GpiQueryCurrentPosition,
  315.                    Link_Name  => "GpiQueryCurrentPosition");
  316.                   
  317.      Result : Pm_Types.Long;
  318.    begin
  319.      Result := GpiQueryCurrentPosition (
  320.                  Ps    => Ps,
  321.                  Point => Point);
  322.  
  323.      return Result = 1;
  324.    end Query_Current_Position;
  325.  
  326.   ---------------------------------------------
  327.  
  328.    procedure Query_Current_Position (
  329.               Ps    : in     Win.Ps_Type;
  330.               Point :    out Win.Point_Type) is
  331.      
  332.      function GPIQueryCurrentPosition (
  333.               Ps    : Win.Ps_Type;
  334.               Point : System.Address) return Pm_Types.Long;
  335.      
  336.     pragma Import (Convention => C,
  337.                    Entity     => GpiQueryCurrentPosition,
  338.                    Link_Name  => "GpiQueryCurrentPosition");
  339.                   
  340.      Result : Pm_Types.Long;
  341.    begin
  342.      Result := GpiQueryCurrentPosition (
  343.                  Ps    => Ps,
  344.                  Point => Point'Address);
  345.  
  346.      if Result /= 1 then
  347.        raise GPI_Error;
  348.      end if;
  349.    end Query_Current_Position;
  350.  
  351.   ---------------------------------------------
  352.  
  353.    function Erase (Ps : Win.Ps_Type) return Boolean is
  354.      function GPIErase (
  355.               Ps    : Win.Ps_Type) return Pm_Types.Long;
  356.      
  357.     pragma Import (Convention => C,
  358.                    Entity     => GpiErase,
  359.                    Link_Name  => "GpiErase");
  360.                   
  361.      Result : Pm_Types.Long;
  362.    begin
  363.     
  364.      Result := GpiErase (Ps);
  365.  
  366.      return Result = 1;
  367.    end Erase;
  368.  
  369.   ---------------------------------------------
  370.  
  371.    procedure Erase (Ps : Win.Ps_Type) is
  372.      begin
  373.       if Failed_To (Erase (Ps)) then
  374.         raise GPI_Error;
  375.       end if;
  376.      end Erase;
  377.  
  378.   ---------------------------------------------
  379.  
  380.    function Destroy_Ps (Ps : Win.Ps_Type) return Boolean is
  381.  
  382.      function GpiDestroyPs (
  383.               Ps    : Win.Ps_Type) return Pm_Types.Long;
  384.      
  385.     pragma Import (Convention => C,
  386.                    Entity     => GpiDestroyPs,
  387.                    Link_Name  => "GpiDestroyPS");
  388.                   
  389.      Result : Pm_Types.Long;
  390.    begin
  391.     
  392.      Result := GpiDestroyPS (Ps);
  393.  
  394.      return Result = 1;
  395.    end Destroy_Ps;
  396.  
  397.   ---------------------------------------------
  398.  
  399.    procedure Destroy_Ps (Ps : in Win.Ps_Type) is
  400.      begin
  401.       if Failed_To (Destroy_Ps (Ps)) then
  402.         raise Gpi_Error;
  403.       end if;
  404.      end Destroy_Ps;
  405.  
  406.   ---------------------------------------------
  407.  
  408.    function Move (
  409.               Ps    : Win.Ps_Type;
  410.               Point : Win.Point_Type) return Boolean is
  411.      
  412.      function GPIMove (
  413.               Ps    : Win.Ps_Type;
  414.               Point : System.Address) return Pm_Types.Long;
  415.      
  416.     pragma Import (Convention => C,
  417.                    Entity     => GpiMove,
  418.                    Link_Name  => "GpiMove");
  419.                   
  420.      Result : Pm_Types.Long;
  421.    begin
  422.  
  423.      Result := GpiMove (
  424.                  Ps    => Ps,
  425.                  Point => Point'Address);
  426.  
  427.      return Result = 1;
  428.    end Move;
  429.  
  430.   ---------------------------------------------
  431.  
  432.    procedure Move (
  433.               Ps    : Win.Ps_Type;
  434.               Point : Win.Point_Type) is
  435.     begin
  436.       if not Move (Ps, Point) then
  437.         raise Gpi_Error;
  438.       end if;
  439.     end Move;
  440.  
  441.   ---------------------------------------------
  442.  
  443.    function Set_Line_End (
  444.               Ps        : Win.Ps_Type;
  445.               Style     : Line_End_Style_Type) return Boolean is
  446.      begin
  447.        return False;
  448.      end Set_Line_End;
  449.  
  450.   ---------------------------------------------
  451.  
  452.    procedure Set_Line_End (
  453.               Ps        : in Win.Ps_Type;
  454.               Style     : in Line_End_Style_Type) is
  455.     begin
  456.       null;
  457.     end Set_Line_End;
  458.  
  459.   ---------------------------------------------
  460.  
  461.    function Query_Line_End (Ps : Win.Ps_Type) 
  462.                                    return Line_End_Style_Type is
  463.      begin
  464.       return Line_End_Style_Type'first;
  465.      end Query_Line_End;
  466.  
  467.   ---------------------------------------------
  468.  
  469.    function Set_Line_Join (
  470.               Ps        : Win.Ps_Type;
  471.               Style     : Line_Join_Style_Type) return Boolean is
  472.      begin
  473.        return False;
  474.      end Set_Line_Join;
  475.  
  476.   ---------------------------------------------
  477.  
  478.    procedure Set_Line_Join (
  479.               Ps        : in Win.Ps_Type;
  480.               Style     : in Line_Join_Style_Type) is
  481.     begin
  482.       null;
  483.     end Set_Line_Join;
  484.  
  485.   ---------------------------------------------
  486.  
  487.    function Query_Line_Join (Ps : Win.Ps_Type) 
  488.                                      return Line_Join_Style_Type is
  489.      begin
  490.        return Line_Join_Style_Type'first;
  491.      end Query_Line_Join;
  492.  
  493.   ---------------------------------------------
  494.  
  495.    function Line (
  496.               Ps        : Win.Ps_Type;
  497.               End_Point : Win.Point_Type) return Status_Type is
  498.  
  499.      function GpiLine (
  500.                Ps        : Win.Ps_Type;
  501.                End_Point : System.Address) return Pm_Types.Long;
  502.  
  503.      pragma Import (Convention => C,
  504.                      Entity     => GpiLine,
  505.                      Link_Name  => "GpiLine");
  506.     
  507.      Result : Pm_Types.Long;
  508.    begin
  509.  
  510.      Result := GpiLine (Ps        => Ps,
  511.                         End_Point => End_Point'Address);
  512.  
  513.      return Status_Is (Result);
  514.    end Line;
  515.  
  516.   ---------------------------------------------
  517.  
  518.    procedure Line (
  519.               Ps        : Win.Ps_Type;
  520.               End_Point : Win.Point_Type) is
  521.     begin
  522.       if Error = Line (Ps, End_Point) then
  523.         raise Gpi_Error;
  524.       end if;
  525.     end Line;
  526.  
  527.   ---------------------------------------------
  528.  
  529.    procedure Line (
  530.               Ps          : Win.Ps_Type;
  531.               Start_Point : Win.Point_Type;
  532.               End_Point   : Win.Point_Type) is
  533.     begin
  534.       if Failed_To (Set_Current_Position (Ps, Start_Point)) or else
  535.              Error = Line (Ps, End_Point) then
  536.            raise Gpi_Error;
  537.       end if;
  538.     end Line;
  539.  
  540.   ---------------------------------------------
  541.  
  542.    function Box (
  543.               Ps            : Win.Ps_Type;
  544.               Corner_Point  : Win.Point_Type;
  545.               Outline_Style : Outline_Style_Type;
  546.               Horz_Rounding : Pm_Types.Long;
  547.               Vert_Rounding : Pm_Types.Long) return Status_Type is
  548.  
  549.      function GpiBox (
  550.                Ps            : Win.Ps_Type;
  551.                Outline_Style : Pm_Types.Long;
  552.                Corner_Point  : System.Address;
  553.                Horz_Rounding : Pm_Types.Long;
  554.                Vert_Rounding : Pm_Types.Long) return Pm_Types.Long;
  555.  
  556.      pragma Import (Convention => C,
  557.                      Entity     => GpiBox,
  558.                      Link_Name  => "GpiBox");
  559.     
  560.      Result : Pm_Types.Long;
  561.  
  562.    begin
  563.  
  564.      Result := GpiBox (
  565.                  Ps            => Ps,
  566.                  Corner_Point  => Corner_Point'Address,
  567.                  Outline_Style => Outline_Values (Outline_Style),
  568.                  Horz_Rounding => Horz_Rounding,
  569.                  Vert_Rounding => Vert_Rounding);      
  570.  
  571.      return Status_Is (Result);
  572.    end Box;
  573.  
  574.   ---------------------------------------------
  575.  
  576.    procedure Box (
  577.               Ps            : in Win.Ps_Type;
  578.               Corner_Point  : in Win.Point_Type;
  579.               Outline_Style : in Outline_Style_Type;
  580.               Horz_Rounding : in Pm_Types.Long;
  581.               Vert_Rounding : in Pm_Types.Long) is
  582.     begin
  583.      if Error = Box (Ps, 
  584.                      Corner_Point, 
  585.                      Outline_Style, 
  586.                      Horz_Rounding, 
  587.                      Vert_Rounding) then
  588.        raise Gpi_Error;
  589.      end if;
  590.     end Box;
  591.  
  592.   ---------------------------------------------
  593.  
  594.    procedure Box (
  595.               Ps            : in Win.Ps_Type;
  596.               Start_Corner  : in Win.Point_Type;
  597.               End_Corner    : in Win.Point_Type;
  598.               Outline_Style : in Outline_Style_Type;
  599.               Horz_Rounding : in Pm_Types.Long;
  600.               Vert_Rounding : in Pm_Types.Long) is
  601.     begin
  602.  
  603.       if Failed_To (Set_Current_Position (Ps, Start_Corner)) or else
  604.          Error = Box (Ps, 
  605.                       End_Corner, 
  606.                       Outline_Style, 
  607.                       Horz_Rounding, 
  608.                       Vert_Rounding) then
  609.          raise Gpi_Error;
  610.       end if;
  611.  
  612.     end Box;
  613.  
  614.  
  615.  ---------------------------------------------
  616.  
  617.    function Set_Arc_Parameters (
  618.               Ps         : Win.Ps_Type;
  619.               Parameters : Arc_Parameter_Type) return Boolean is
  620.  
  621.         function GpiSetArcParams (
  622.               Ps         : Win.Ps_Type;
  623.               Parameters : System.Address) return Pm_Types.Long;
  624.  
  625.         pragma Import (Convention => C,
  626.                        Entity     => GpiSetArcParams,
  627.                        Link_Name  => "GpiSetArcParams");
  628.     
  629.      Result : Pm_Types.Long;
  630.  
  631.      begin
  632.        
  633.        Result := GpiSetArcParams (Ps         => Ps,
  634.                                   Parameters => Parameters'Address);
  635.        return Result = 1;
  636.  
  637.      end Set_Arc_Parameters;
  638.  
  639.  ---------------------------------------------
  640.  
  641.    procedure Set_Arc_Parameters (
  642.               Ps         : in Win.Ps_Type;
  643.               Parameters : in Arc_Parameter_Type) is
  644.      begin
  645.        if not Set_Arc_Parameters (Ps, Parameters) then
  646.           raise Gpi_Error;
  647.        end if;
  648.      end Set_Arc_Parameters;
  649.  
  650.  ---------------------------------------------
  651.  
  652.    function Query_Arc_Parameters (
  653.               Ps         : Win.Ps_Type;
  654.               Parameters : Arc_Parameter_Pointer_Type) 
  655.                                           return Boolean is
  656.  
  657.         function GpiQueryArcParams (
  658.               Ps         : Win.Ps_Type;
  659.               Parameters : Arc_Parameter_Pointer_Type) 
  660.                                           return Pm_Types.Long;
  661.  
  662.         pragma Import (Convention => C,
  663.                        Entity     => GpiQueryArcParams,
  664.                        Link_Name  => "GpiQueryArcParams");
  665.     
  666.      Result : Pm_Types.Long;
  667.  
  668.      begin
  669.        
  670.        Result := GpiQueryArcParams (Ps         => Ps,
  671.                                     Parameters => Parameters);
  672.        return Result = 1;
  673.  
  674.      end Query_Arc_Parameters;
  675.  
  676.  ---------------------------------------------
  677.  
  678.    procedure Query_Arc_Parameters (
  679.               Ps         : in     Win.Ps_Type;
  680.               Parameters :    out Arc_Parameter_Type) is
  681.  
  682.         function GpiQueryArcParams (
  683.               Ps         : Win.Ps_Type;
  684.               Parameters : System.Address) return Pm_Types.Long;
  685.  
  686.         pragma Import (Convention => C,
  687.                        Entity     => GpiQueryArcParams,
  688.                        Link_Name  => "GpiQueryArcParams");
  689.     
  690.      Result : Pm_Types.Long;
  691.  
  692.      begin
  693.        
  694.        Result := GpiQueryArcParams (Ps         => Ps,
  695.                                     Parameters => Parameters'address);
  696.        if Result /= 1 then
  697.          raise GPI_Error;
  698.        end if;
  699.  
  700.      end Query_Arc_Parameters;
  701.  
  702.  ---------------------------------------------
  703.  
  704.    function Set_Default_Arc_Parameters (
  705.               Ps         : Win.Ps_Type;
  706.               Parameters : Arc_Parameter_Type) return Boolean is
  707.  
  708.         function GpiSetDefArcParams (
  709.               Ps         : Win.Ps_Type;
  710.               Parameters : System.Address) return Pm_Types.Long;
  711.  
  712.         pragma Import (Convention => C,
  713.                        Entity     => GpiSetDefArcParams,
  714.                        Link_Name  => "GpiSetDefArcParams");
  715.     
  716.      Result : Pm_Types.Long;
  717.  
  718.      begin
  719.        
  720.        Result := GpiSetDefArcParams (Ps         => Ps,
  721.                                      Parameters => Parameters'Address);
  722.        return Result = 1;
  723.  
  724.      end Set_Default_Arc_Parameters;
  725.  
  726.  ---------------------------------------------
  727.  
  728.    procedure Set_Default_Arc_Parameters (
  729.               Ps         : in Win.Ps_Type;
  730.               Parameters : in Arc_Parameter_Type) is
  731.      begin
  732.        if not Set_Default_Arc_Parameters (Ps, Parameters) then
  733.           raise Gpi_Error;
  734.        end if;
  735.      end Set_Default_Arc_Parameters;
  736.  
  737.  ---------------------------------------------
  738.  
  739.    function Query_Default_Arc_Parameters (
  740.               Ps         : Win.Ps_Type;
  741.               Parameters : Arc_Parameter_Pointer_Type) 
  742.                                              return Boolean is
  743.  
  744.         function GpiQueryDefArcParams (
  745.               Ps         : Win.Ps_Type;
  746.               Parameters : Arc_Parameter_Pointer_Type) 
  747.                                              return Pm_Types.Long;
  748.  
  749.         pragma Import (Convention => C,
  750.                        Entity     => GpiQueryDefArcParams,
  751.                        Link_Name  => "GpiQueryDefArcParams");
  752.     
  753.      Result : Pm_Types.Long;
  754.  
  755.      begin
  756.        
  757.        Result := GpiQueryDefArcParams (Ps         => Ps,
  758.                                        Parameters => Parameters);
  759.        return Result = 1;
  760.  
  761.      end Query_Default_Arc_Parameters;
  762.  
  763.  ---------------------------------------------
  764.  
  765.    procedure Query_Default_Arc_Parameters (
  766.               Ps         : in     Win.Ps_Type;
  767.               Parameters :    out Arc_Parameter_Type) is
  768.  
  769.         function GpiQueryDefArcParams (
  770.               Ps         : Win.Ps_Type;
  771.               Parameters : System.Address) return Pm_Types.Long;
  772.  
  773.         pragma Import (Convention => C,
  774.                        Entity     => GpiQueryDefArcParams,
  775.                        Link_Name  => "GpiQueryDefArcParams");
  776.     
  777.      Result : Pm_Types.Long;
  778.  
  779.      begin
  780.        
  781.        Result := GpiQueryDefArcParams (Ps         => Ps,
  782.                                        Parameters => Parameters'address);
  783.        if Result /= 1 then
  784.          raise GPI_Error;
  785.        end if;
  786.  
  787.      end Query_Default_Arc_Parameters;
  788.  
  789.  ---------------------------------------------
  790.  
  791.   --GNAT BUG
  792.      function GpiFullArc (
  793.               Ps            : Win.Ps_Type;
  794.               Outline_Style : Pm_Types.Long;
  795.               Multiplier    : Pm_Types.Long) return Pm_Types.Long;
  796.  
  797.       pragma Import (Convention => C,
  798.                      Entity     => GpiFullArc,
  799.                      Link_Name  => "GpiFullArc");
  800.  
  801.    function Full_Arc (
  802.               Ps            : Win.Ps_Type;
  803.               Outline_Style : Outline_Style_Type;
  804.               Multiplier    : Multipler_Type) return Status_Type is
  805.  
  806.       Result : Pm_Types.Long;
  807.       Mult   : Pm_Types.Long;
  808.  
  809.       use Pm_Types;
  810.      begin
  811.  
  812.       Mult := 65_536 * Pm_Types.Long (Multiplier);       
  813.     
  814.       Result := GpiFullArc (Ps            => Ps,
  815.                             Outline_Style => Outline_Values (Outline_Style),
  816.                             Multiplier    => Mult);
  817.       return Status_Is (Result);
  818.  
  819.      end Full_Arc;
  820.  
  821.  ---------------------------------------------
  822.  
  823.    procedure Full_Arc (
  824.               Ps            : in Win.Ps_Type;
  825.               Outline_Style : in Outline_Style_Type;
  826.               Multiplier    : in Multipler_Type) is
  827.      begin
  828.        if Error = Full_Arc (Ps, Outline_Style, Multiplier) then
  829.          raise Gpi_Error;
  830.        end if;
  831.      end Full_Arc;
  832.  
  833.  ---------------------------------------------
  834.  
  835.    procedure Full_Arc (
  836.               Ps            : in Win.Ps_Type;
  837.               Center        : in Win.Point_Type;
  838.               Arc_Params    : in Arc_Parameter_Type;
  839.               Outline_Style : in Outline_Style_Type;
  840.               Multiplier    : in Multipler_Type) is
  841.     begin
  842.  
  843.       if Failed_To (Set_Current_Position (Ps, Center)) or else
  844.          Failed_To (Set_Arc_Parameters (Ps, Arc_Params)) or else
  845.          Error = Full_Arc (Ps, Outline_Style, Multiplier) then
  846.           raise Gpi_Error;
  847.       end if;
  848.  
  849.     end Full_Arc;
  850.  
  851. end GPI;
  852.  
  853.  
  854.  
  855.