aboutsummaryrefslogtreecommitdiff
path: root/spec/fltk-draw.ads
diff options
context:
space:
mode:
Diffstat (limited to 'spec/fltk-draw.ads')
-rw-r--r--spec/fltk-draw.ads109
1 files changed, 67 insertions, 42 deletions
diff --git a/spec/fltk-draw.ads b/spec/fltk-draw.ads
index cedd4da..a2c66f3 100644
--- a/spec/fltk-draw.ads
+++ b/spec/fltk-draw.ads
@@ -6,17 +6,14 @@
with
- FLTK.Images,
+ Ada.Strings.Unbounded,
+ FLTK.Images.Pixmaps,
FLTK.Widgets.Groups.Windows;
package FLTK.Draw is
- --------------------------
- -- Types and Constants --
- --------------------------
-
type Line_Kind is
(Solid_Line,
Dash_Line,
@@ -66,9 +63,7 @@ package FLTK.Draw is
- ------------------------
-- No Documentation --
- ------------------------
procedure Reset_Spot;
@@ -89,9 +84,7 @@ package FLTK.Draw is
- ---------------
-- Utility --
- ---------------
function Can_Do_Alpha_Blending
return Boolean;
@@ -103,9 +96,7 @@ package FLTK.Draw is
- --------------------------
-- Charset Conversion --
- --------------------------
function Latin1_To_Local
(From : in String)
@@ -126,9 +117,7 @@ package FLTK.Draw is
- ----------------
-- Clipping --
- ----------------
function Clip_Box
(X, Y, W, H : in Integer;
@@ -151,9 +140,7 @@ package FLTK.Draw is
- ---------------
-- Overlay --
- ---------------
procedure Overlay_Clear;
@@ -163,9 +150,7 @@ package FLTK.Draw is
- ----------------
-- Settings --
- ----------------
function Get_Color
return Color;
@@ -215,9 +200,7 @@ package FLTK.Draw is
- -------------------------
-- Matrix Operations --
- -------------------------
procedure Mult_Matrix
(A, B, C, D, X, Y : in Long_Float);
@@ -263,17 +246,18 @@ package FLTK.Draw is
- ---------------------
-- Image Drawing --
- ---------------------
procedure Draw_Image
(X, Y, W, H : in Integer;
Data : in Color_Component_Array;
Depth : in Positive := 3;
- Line_Data : in Natural := 0;
+ Line_Size : in Natural := 0;
Flip_Horizontal : in Boolean := False;
- Flip_Vertical : in Boolean := False);
+ Flip_Vertical : in Boolean := False)
+ with Pre => (if Line_Size = 0
+ then Data'Length >= Size_Type (W) * Size_Type (H) * Size_Type (Depth)
+ else Data'Length >= Size_Type (Line_Size) * Size_Type (H));
procedure Draw_Image
(X, Y, W, H : in Integer;
@@ -284,30 +268,44 @@ package FLTK.Draw is
(X, Y, W, H : in Integer;
Data : in Color_Component_Array;
Depth : in Positive := 1;
- Line_Data : in Natural := 0;
+ Line_Size : in Natural := 0;
Flip_Horizontal : Boolean := False;
- Flip_Vertical : Boolean := False);
+ Flip_Vertical : Boolean := False)
+ with Pre => (if Line_Size = 0
+ then Data'Length >= Size_Type (W) * Size_Type (H) * Size_Type (Depth)
+ else Data'Length >= Size_Type (Line_Size) * Size_Type (H));
procedure Draw_Image_Mono
(X, Y, W, H : in Integer;
Callback : in Image_Draw_Function;
Depth : in Positive := 1);
+ procedure Draw_Pixmap
+ (Values : in FLTK.Images.Pixmaps.Header;
+ Colors : in FLTK.Images.Pixmaps.Color_Definition_Array;
+ Pixels : in FLTK.Images.Pixmaps.Pixmap_Data;
+ X, Y : in Integer;
+ Tone : in Color := Grey0_Color)
+ with Pre =>
+ Colors'Length = Values.Colors and
+ Pixels'Length (1) = Values.Height and
+ (for all Definition of Colors =>
+ Ada.Strings.Unbounded.Length (Definition.Name) = Values.Per_Pixel) and
+ Pixels'Length (2) = Values.Width * Values.Per_Pixel;
+
function Read_Image
(X, Y, W, H : in Integer;
Alpha : in Integer := 0)
return Color_Component_Array
with Post =>
- (if Alpha = 0
- then Read_Image'Result'Length = W * H * 3
- else Read_Image'Result'Length = W * H * 4);
+ (if Alpha = 0
+ then Read_Image'Result'Length = Size_Type (W) * Size_Type (H) * 3
+ else Read_Image'Result'Length = Size_Type (W) * Size_Type (H) * 4);
- -----------------------
-- Special Drawing --
- -----------------------
procedure Add_Symbol
(Text : in String;
@@ -381,6 +379,19 @@ package FLTK.Draw is
(Text : in String;
DX, DY, W, H : out Integer);
+ -- Last is the index of the last character processed in Text which
+ -- would normally be one before the index of the char pointed at by
+ -- the return value in the C++ version. Instead, the return value
+ -- here is the processed text buffer.
+ function Expand_Text
+ (Text : in String;
+ Max_Width : in Long_Float;
+ Width : out Long_Float;
+ Last : out Natural;
+ Wrap : in Boolean;
+ Symbols : in Boolean := False)
+ return String;
+
function Width
(Text : in String)
return Long_Float;
@@ -400,9 +411,7 @@ package FLTK.Draw is
- ----------------------
-- Manual Drawing --
- ----------------------
procedure Begin_Complex_Polygon;
procedure Begin_Line;
@@ -524,32 +533,53 @@ private
pragma Convention (C, Symbol_Draw_Function);
+ pragma Import (C, Reset_Spot, "fl_draw_reset_spot");
+
+ pragma Import (C, Pop_Clip, "fl_draw_pop_clip");
+ pragma Import (C, Push_No_Clip, "fl_draw_push_no_clip");
+ pragma Import (C, Restore_Clip, "fl_draw_restore_clip");
+
+ pragma Import (C, Overlay_Clear, "fl_draw_overlay_clear");
+
+ pragma Import (C, Pop_Matrix, "fl_draw_pop_matrix");
+ pragma Import (C, Push_Matrix, "fl_draw_push_matrix");
+
+ pragma Import (C, Begin_Complex_Polygon, "fl_draw_begin_complex_polygon");
+ pragma Import (C, Begin_Line, "fl_draw_begin_line");
+ pragma Import (C, Begin_Loop, "fl_draw_begin_loop");
+ pragma Import (C, Begin_Points, "fl_draw_begin_points");
+ pragma Import (C, Begin_Polygon, "fl_draw_begin_polygon");
+
+ pragma Import (C, Gap, "fl_draw_gap");
+
+ pragma Import (C, End_Complex_Polygon, "fl_draw_end_complex_polygon");
+ pragma Import (C, End_Line, "fl_draw_end_line");
+ pragma Import (C, End_Loop, "fl_draw_end_loop");
+ pragma Import (C, End_Points, "fl_draw_end_points");
+ pragma Import (C, End_Polygon, "fl_draw_end_polygon");
+
+
pragma Inline (Reset_Spot);
pragma Inline (Set_Spot);
pragma Inline (Set_Status);
-
pragma Inline (Can_Do_Alpha_Blending);
pragma Inline (Shortcut_Label);
-
pragma Inline (Latin1_To_Local);
pragma Inline (Local_To_Latin1);
pragma Inline (Mac_Roman_To_Local);
pragma Inline (Local_To_Mac_Roman);
-
pragma Inline (Clip_Intersects);
pragma Inline (Pop_Clip);
pragma Inline (Push_Clip);
pragma Inline (Push_No_Clip);
pragma Inline (Restore_Clip);
-
pragma Inline (Overlay_Clear);
pragma Inline (Overlay_Rect);
-
pragma Inline (Get_Color);
pragma Inline (Set_Color);
pragma Inline (Get_Font);
@@ -559,7 +589,6 @@ private
pragma Inline (Font_Descent);
pragma Inline (Font_Height);
-
pragma Inline (Mult_Matrix);
pragma Inline (Pop_Matrix);
pragma Inline (Push_Matrix);
@@ -573,7 +602,6 @@ private
pragma Inline (Translate);
pragma Inline (Vertex);
-
pragma Inline (Add_Symbol);
pragma Inline (Draw_Text);
pragma Inline (Draw_Text_Right_Left);
@@ -584,14 +612,12 @@ private
pragma Inline (Text_Extents);
pragma Inline (Width);
-
pragma Inline (Begin_Complex_Polygon);
pragma Inline (Begin_Line);
pragma Inline (Begin_Loop);
pragma Inline (Begin_Points);
pragma Inline (Begin_Polygon);
-
pragma Inline (Arc);
pragma Inline (Chord);
pragma Inline (Circle);
@@ -608,7 +634,6 @@ private
pragma Inline (Ecks_Why_Line);
pragma Inline (Why_Ecks_Line);
-
pragma Inline (End_Complex_Polygon);
pragma Inline (End_Line);
pragma Inline (End_Loop);