diff options
Diffstat (limited to 'spec/fltk-images-bitmaps.ads')
-rw-r--r-- | spec/fltk-images-bitmaps.ads | 87 |
1 files changed, 70 insertions, 17 deletions
diff --git a/spec/fltk-images-bitmaps.ads b/spec/fltk-images-bitmaps.ads index d8730a2..d60334f 100644 --- a/spec/fltk-images-bitmaps.ads +++ b/spec/fltk-images-bitmaps.ads @@ -7,10 +7,6 @@ package FLTK.Images.Bitmaps is - ------------- - -- Types -- - ------------- - type Bitmap is new Image with private; type Bitmap_Reference (Data : not null access Bitmap'Class) is limited null record @@ -19,22 +15,31 @@ package FLTK.Images.Bitmaps is - -------------------- - -- Construction -- - -------------------- + function To_Next_Byte + (Bits : in Natural) + return Natural; + + + package Forge is - -- Please note that I'm pretty sure (?) input data here should be some - -- declared item that lives at least as long as the resulting Bitmap + -- Please note that input data should be some declared item + -- that lives at least as long as the resulting Bitmap. function Create (Data : in Color_Component_Array; Width, Height : in Natural) - return Bitmap; + return Bitmap + with Pre => Data'Length = To_Next_Byte (Width) * Height; end Forge; + + + + -- Copying -- + function Copy (This : in Bitmap; Width, Height : in Natural) @@ -47,9 +52,7 @@ package FLTK.Images.Bitmaps is - ---------------- -- Activity -- - ---------------- procedure Uncache (This : in out Bitmap); @@ -57,18 +60,56 @@ package FLTK.Images.Bitmaps is - --------------- + -- Pixel Data -- + + 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; + + + + -- Drawing -- - --------------- procedure Draw (This : in Bitmap; X, Y : in Integer); 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); private @@ -80,10 +121,22 @@ private (This : in out Bitmap); + pragma Inline (To_Next_Byte); + pragma Inline (Copy); + pragma Inline (Uncache); + + pragma Inline (Data_Size); + pragma Inline (Get_Datum); + pragma Inline (Set_Datum); + pragma Inline (Slice); + pragma Inline (Overwrite); + pragma Inline (All_Data); + pragma Inline (Draw); end FLTK.Images.Bitmaps; + |