From dee76d5884c6f079ea3a2387d07289534a51a0c1 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 28 Jan 2025 21:43:17 +1300 Subject: Revised Image subhierarchy, fixed data subprograms, added constructor for Pixmap --- doc/fl_bitmap.html | 48 ++++++++++++++++++++++++++---- doc/fl_image.html | 78 +++++++------------------------------------------ doc/fl_pixmap.html | 45 +++++++++++++++++++++++++--- doc/fl_rgb_image.html | 51 ++++++++++++++++++++++++++++---- doc/fl_tiled_image.html | 6 ++-- 5 files changed, 141 insertions(+), 87 deletions(-) (limited to 'doc') diff --git a/doc/fl_bitmap.html b/doc/fl_bitmap.html index 2a8cc72..922b1b5 100644 --- a/doc/fl_bitmap.html +++ b/doc/fl_bitmap.html @@ -52,14 +52,49 @@
 int alloc_array;
 
-  +Intentionally left unbound.
 const uchar * array;
 
-  +
+function Data_Size
+       (This : in Bitmap)
+    return Natural;
+
+function Get_Datum
+       (This  : in Bitmap;
+        Place : in Positive)
+    return Color_Component
+with Pre => Place <= This.Data_Size;
+
+procedure Set_Datum
+       (This  : in out Bitmap;
+        Place : in     Positive;
+        Value : in     Color_Component)
+with Pre => Place <= This.Data_Size;
+
+function Slice
+       (This : in Bitmap;
+        Low  : in Positive;
+        High : in Natural)
+    return Color_Component_Array
+with Pre => High <= This.Data_Size,
+    Post => Slice'Result'Length = Integer'Max (0, High - Low + 1);
+
+procedure Overwrite
+       (This   : in out Bitmap;
+        Place  : in     Positive;
+        Values : in     Color_Component_Array)
+with Pre => Place + Values'Length - 1 <= This.Data_Size;
+
+function All_Data
+       (This : in Bitmap)
+    return Color_Component_Array
+with Post => All_Data'Result'Length = This.Data_Size;
+
@@ -79,7 +114,8 @@ Fl_Bitmap(const char *bits, int W, int H); function Create (Data : in Color_Component_Array; Width, Height : in Natural) - return Bitmap; + return Bitmap +with Pre => Data'Length = To_Next_Byte (Width) * Height; @@ -120,9 +156,9 @@ virtual void draw(int X, int Y, int W, int H,
 procedure Draw
-       (This       : in Bitmap;
-        X, Y, W, H : in Integer;
-        CX, CY     : in Integer := 0);
+       (This           : in Bitmap;
+        X, Y, W, H     : in Integer;
+        Clip_X, Clip_Y : in Integer := 0);
 
diff --git a/doc/fl_image.html b/doc/fl_image.html index 7550b5c..10c9ed8 100644 --- a/doc/fl_image.html +++ b/doc/fl_image.html @@ -84,21 +84,21 @@
 static const int ERR_FILE_ACCESS = -2;
 
-  +See the errors table.
 static const int ERR_FORMAT = -3;
 
-  +See the errors table.
 static const int ERR_NO_IMAGE = -1;
 
-  +See the errors table. @@ -192,20 +192,7 @@ function Copy
 int count() const;
 
-
-function Get_Data_Count
-       (This : in Image)
-    return Natural;
-
- - - -  -
-function Get_Data_Size
-       (This : in Image)
-    return Natural;
-
+Intentionally left unbound. @@ -223,53 +210,8 @@ function Get_D
 const char * const * data() const;
 
-
-function Get_Datum
-       (This     : in Image;
-        Data     : in Positive;
-        Position : in Positive)
-    return Color_Component
-with Pre =>
-        Data <= Get_Data_Count (This) and
-        Position <= Get_Data_Size (This);
-
-procedure Set_Datum
-       (This     : in out Image;
-        Data     : in     Positive;
-        Position : in     Positive;
-        Value    : in     Color_Component)
-with Pre =>
-        Data <= Get_Data_Count (This) and
-        Position <= Get_Data_Size (This);
-
-function Get_Data
-       (This     : in Image;
-        Data     : in Positive;
-        Position : in Positive;
-        Count    : in Natural)
-    return Color_Component_Array
-with Pre =>
-        Data <= Get_Data_Count (This) and
-        Position <= Get_Data_Size (This) and
-        Count <= Get_Data_Size (This) - Position + 1;
-
-function All_Data
-       (This : in Image;
-        Data : in Positive)
-    return Color_Component_Array
-with Pre =>
-        Data <= Get_Data_Count (This);
-
-procedure Update_Data
-       (This     : in out Image;
-        Data     : in     Positive;
-        Position : in     Positive;
-        Values   : in     Color_Component_Array)
-with Pre =>
-        Data <= Get_Data_Count (This) and
-        Position <= Get_Data_Size (This) and
-        Values'Length <= Get_Data_Size (This) - Position + 1;
-
+See Data_Size, Get_Datum, Set_Datum, Slice, Overwrite, All_Data subprograms +in Fl_Bitmap and Fl_RGB_Image. @@ -289,9 +231,9 @@ virtual void draw(int X, int Y, int W, int H,
 procedure Draw
-       (This       : in Image;
-        X, Y, W, H : in Integer;
-        CX, CY     : in Integer := 0);
+       (This           : in Image;
+        X, Y, W, H     : in Integer;
+        Clip_X, Clip_Y : in Integer := 0);
 
@@ -357,7 +299,7 @@ virtual void label(Fl_Menu_Item *m); int ld() const;
-function Get_Line_Data
+function Get_Line_Size
        (This : in Image)
     return Natural;
 
diff --git a/doc/fl_pixmap.html b/doc/fl_pixmap.html index 60fec01..ab8c8d8 100644 --- a/doc/fl_pixmap.html +++ b/doc/fl_pixmap.html @@ -41,6 +41,31 @@ Pixmap_Reference + + char * + Header + + + + char + Color_Kind + + + + char * + Color_Definition + + + + char ** + Color_Definition_Array + + + + char ** + Pixmap_Data + + @@ -72,7 +97,19 @@ Fl_Pixmap(const char *const *D); Fl_Pixmap(const uchar *const *D); -  +
+function Create
+       (Values : in Header;
+        Colors : in Color_Definition_Array;
+        Pixels : in Pixmap_Data)
+    return Pixmap
+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;
+
@@ -134,9 +171,9 @@ virtual void draw(int X, int Y, int W, int H,
 procedure Draw
-       (This       : in Pixmap;
-        X, Y, W, H : in Integer;
-        CX, CY     : in Integer := 0);
+       (This           : in Pixmap;
+        X, Y, W, H     : in Integer;
+        Clip_X, Clip_Y : in Integer := 0);
 
diff --git a/doc/fl_rgb_image.html b/doc/fl_rgb_image.html index 1e115d5..061b07a 100644 --- a/doc/fl_rgb_image.html +++ b/doc/fl_rgb_image.html @@ -59,7 +59,42 @@ int alloc_array;
 const uchar * array;
 
-Intentionally left unbound. +
+function Data_Size
+       (This : in RGB_Image)
+    return Natural;
+
+function Get_Datum
+       (This  : in RGB_Image;
+        Place : in Positive)
+    return Color_Component
+with Pre => Place <= This.Data_Size;
+
+procedure Set_Datum
+       (This  : in out RGB_Image;
+        Place : in     Positive;
+        Value : in     Color_Component)
+with Pre => Place <= This.Data_Size;
+
+function Slice
+       (This : in RGB_Image;
+        Low  : in Positive;
+        High : in Natural)
+    return Color_Component_Array
+with Pre => High <= This.Data_Size,
+    Post => Slice'Result'Length = Integer'Max (0, High - Low + 1);
+
+procedure Overwrite
+       (This   : in out RGB_Image;
+        Place  : in     Positive;
+        Values : in     Color_Component_Array)
+with Pre => Place + Values'Length - 1 <= This.Data_Size;
+
+function All_Data
+       (This : in RGB_Image)
+    return Color_Component_Array
+with Post => All_Data'Result'Length = This.Data_Size;
+
@@ -78,8 +113,12 @@ function Create (Data : in Color_Component_Array; Width, Height : in Natural; Depth : in Natural := 3; - Line_Data : in Natural := 0) - return RGB_Image; + Line_Size : in Natural := 0) + return RGB_Image +with Pre => (if Line_Size = 0 + then Data'Length = Width * Height * Depth + else Data'Length = Line_Size * Height) + and Data'Length <= Get_Max_Size; @@ -181,9 +220,9 @@ virtual void draw(int X, int Y, int W, int H,
 procedure Draw
-       (This       : in RGB_Image;
-        X, Y, W, H : in Integer;
-        CX, CY     : in Integer := 0);
+       (This           : in RGB_Image;
+        X, Y, W, H     : in Integer;
+        Clip_X, Clip_Y : in Integer := 0);
 
diff --git a/doc/fl_tiled_image.html b/doc/fl_tiled_image.html index 39292b1..49aeca0 100644 --- a/doc/fl_tiled_image.html +++ b/doc/fl_tiled_image.html @@ -150,9 +150,9 @@ virtual void draw(int X, int Y, int W, int H, int cx, int cy);
 procedure Draw
-       (This       : in Tiled_Image;
-        X, Y, W, H : in Integer;
-        CX, CY     : in Integer);
+       (This           : in Tiled_Image;
+        X, Y, W, H     : in Integer;
+        Clip_X, Clip_Y : in Integer);
 
-- cgit