From fb4183c9244ee31aa5cb8bc9745c9242b1fafeeb Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Fri, 11 Apr 2025 22:21:26 +1200 Subject: Moved Size_Type to FLTK and better incorporated it into Bitmaps and RGB_Images --- doc/fl_bitmap.html | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'doc/fl_bitmap.html') diff --git a/doc/fl_bitmap.html b/doc/fl_bitmap.html index 922b1b5..edaf6a4 100644 --- a/doc/fl_bitmap.html +++ b/doc/fl_bitmap.html @@ -62,31 +62,31 @@ const uchar * array;
 function Data_Size
        (This : in Bitmap)
-    return Natural;
+    return Size_Type;
 
 function Get_Datum
        (This  : in Bitmap;
-        Place : in Positive)
+        Place : in Positive_Size)
     return Color_Component
 with Pre => Place <= This.Data_Size;
 
 procedure Set_Datum
        (This  : in out Bitmap;
-        Place : in     Positive;
+        Place : in     Positive_Size;
         Value : in     Color_Component)
 with Pre => Place <= This.Data_Size;
 
 function Slice
        (This : in Bitmap;
-        Low  : in Positive;
-        High : in Natural)
+        Low  : in Positive_Size;
+        High : in Size_Type)
     return Color_Component_Array
 with Pre => High <= This.Data_Size,
-    Post => Slice'Result'Length = Integer'Max (0, High - Low + 1);
+    Post => Slice'Result'Length = Size_Type'Max (0, High - Low + 1);
 
 procedure Overwrite
        (This   : in out Bitmap;
-        Place  : in     Positive;
+        Place  : in     Positive_Size;
         Values : in     Color_Component_Array)
 with Pre => Place + Values'Length - 1 <= This.Data_Size;
 
@@ -115,7 +115,24 @@ function Create
        (Data          : in Color_Component_Array;
         Width, Height : in Natural)
     return Bitmap
-with Pre => Data'Length = To_Next_Byte (Width) * Height;
+with Pre =>
+    Data'Length >= Size_Type (Bytes_Needed (Width)) * Size_Type (Height);
+
+ + + + + + + + + + + + -- cgit
Static Functions and Procedures
 
+function Bytes_Needed
+       (Bits : in Natural)
+    return Natural;