---------------------------------------------------------------------------- -- Copyright (C) 2015-2016, AdaCore -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are -- met: -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in -- the documentation and/or other materials provided with the -- distribution. -- 3. Neither the name of the copyright holder nor the names of its -- contributors may be used to endorse or promote products derived -- from this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- ----------------------------------------------------------------------------
function "+" (P1, P2 : Point) return Point
function "-" (P1, P2 : Point) return Point
subtype Actual_Orientation is Orientation_Mode range Portrait .. Landscape;
Alice_Blue : constant Bitmap_Color := (255, 240, 248, 255);
Antique_White : constant Bitmap_Color := (255, 250, 235, 215);
type Any_Bitmap_Buffer is access all Bitmap_Buffer'Class;
Aqua : constant Bitmap_Color := (255, 000, 255, 255);
Aqua_Marine : constant Bitmap_Color := (255, 127, 255, 212);
Azure : constant Bitmap_Color := (255, 240, 255, 255);
Beige : constant Bitmap_Color := (255, 245, 245, 220);
procedure Bezier
(Buffer : in out Bitmap_Buffer;
Input_Points : Point_Array;
N : Positive := 20;
Thickness : Natural := 1)
Bisque : constant Bitmap_Color := (255, 255, 228, 196);
type Bitmap_Buffer is interface;
type Bitmap_Color is record
Alpha : UInt8;
Red : UInt8;
Green : UInt8;
Blue : UInt8;
end record with Size => 32;
type Bitmap_Color_Mode is
(ARGB_8888,
RGB_888,
RGB_565,
ARGB_1555,
ARGB_4444,
L_8,
AL_44,
AL_88,
L_4,
A_8,
A_4,
M_1
) with Size => 4;
Monochrome
function Bits_Per_Pixel (Mode : Bitmap_Color_Mode) return Positive
Black : constant Bitmap_Color := (255, 000, 000, 000);
Blanched_Almond : constant Bitmap_Color := (255, 255, 235, 205);
Blue : constant Bitmap_Color := (255, 000, 000, 255);
Blue_Violet : constant Bitmap_Color := (255, 138, 043, 226);
Brown : constant Bitmap_Color := (255, 165, 042, 042);
function Buffer_Size (Buffer : Bitmap_Buffer) return Natural
Burly_Wood : constant Bitmap_Color := (255, 222, 184, 135);
Cadet_Blue : constant Bitmap_Color := (255, 095, 158, 160);
Chart_Reuse : constant Bitmap_Color := (255, 127, 255, 000);
Chocolate : constant Bitmap_Color := (255, 210, 105, 030);
function Color_Mode (Buffer : Bitmap_Buffer) return Bitmap_Color_Mode
The buffer color mode. Note that not all color modes are supported by the hardware acceleration (if any), so you need to check your actual hardware to optimize buffer transfers.
procedure Copy_Rect
(Src_Buffer : Bitmap_Buffer'Class;
Src_Pt : Point;
Dst_Buffer : in out Bitmap_Buffer;
Dst_Pt : Point;
Bg_Buffer : Bitmap_Buffer'Class;
Bg_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean)
procedure Copy_Rect
(Src_Buffer : Bitmap_Buffer'Class;
Src_Pt : Point;
Dst_Buffer : in out Bitmap_Buffer;
Dst_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean)
procedure Copy_Rect_Blend
(Src_Buffer : Bitmap_Buffer;
Src_Pt : Point;
Dst_Buffer : in out Bitmap_Buffer'Class;
Dst_Pt : Point;
Width : Natural;
Height : Natural;
Synchronous : Boolean)
Coral : constant Bitmap_Color := (255, 255, 127, 080);
Corn_Flower_Blue : constant Bitmap_Color := (255, 100, 149, 237);
Corn_Silk : constant Bitmap_Color := (255, 255, 248, 220);
Crimson : constant Bitmap_Color := (255, 220, 020, 060);
procedure Cubic_Bezier
(Buffer : in out Bitmap_Buffer;
P1, P2, P3, P4 : Point;
N : Positive := 20;
Thickness : Natural := 1)
Cyan : constant Bitmap_Color := (255, 000, 255, 255);
Dark_Blue : constant Bitmap_Color := (255, 000, 000, 139);
Dark_Cyan : constant Bitmap_Color := (255, 000, 139, 139);
Dark_Golden_Rod : constant Bitmap_Color := (255, 184, 134, 011);
Dark_Green : constant Bitmap_Color := (255, 000, 100, 000);
Dark_Grey : constant Bitmap_Color := (255, 169, 169, 169);
Dark_Khaki : constant Bitmap_Color := (255, 189, 183, 107);
Dark_Magenta : constant Bitmap_Color := (255, 139, 000, 139);
Dark_Olive_Green : constant Bitmap_Color := (255, 085, 107, 047);
Dark_Orange : constant Bitmap_Color := (255, 255, 140, 000);
Dark_Orchid : constant Bitmap_Color := (255, 153, 050, 204);
Dark_Red : constant Bitmap_Color := (255, 139, 000, 000);
Dark_Salmon : constant Bitmap_Color := (255, 233, 150, 122);
Dark_Sea_Green : constant Bitmap_Color := (255, 143, 188, 143);
Dark_Slate_Blue : constant Bitmap_Color := (255, 072, 061, 139);
Dark_Slate_Gray : constant Bitmap_Color := (255, 047, 079, 079);
Dark_Turquoise : constant Bitmap_Color := (255, 000, 206, 209);
Dark_Violet : constant Bitmap_Color := (255, 148, 000, 211);
Deep_Pink : constant Bitmap_Color := (255, 255, 020, 147);
Deep_Sky_Blue : constant Bitmap_Color := (255, 000, 191, 255);
Dim_Grey : constant Bitmap_Color := (255, 105, 105, 105);
Dodger_Blue : constant Bitmap_Color := (255, 030, 144, 255);
procedure Draw_Circle
(Buffer : in out Bitmap_Buffer;
Center : Point;
Radius : Natural)
procedure Draw_Horizontal_Line
(Buffer : in out Bitmap_Buffer;
Pt : Point;
Width : Integer)
procedure Draw_Line
(Buffer : in out Bitmap_Buffer;
Start, Stop : Point;
Thickness : Natural := 1;
Fast : Boolean := True)
If fast is set, then the line thickness uses squares to draw, while if not set, then the line will be composed of circles, much slower to draw but providing nicer line cap.
procedure Draw_Rect
(Buffer : in out Bitmap_Buffer;
Area : Rect;
Thickness : Natural := 1)
Draws a rectangle
procedure Draw_Rounded_Rect
(Buffer : in out Bitmap_Buffer;
Area : Rect;
Radius : Natural;
Thickness : Natural := 1)
procedure Draw_Vertical_Line
(Buffer : in out Bitmap_Buffer;
Pt : Point;
Height : Integer)
procedure Fill
(Buffer : in out Bitmap_Buffer)
Fill the entire buffer with the source color
procedure Fill_Circle
(Buffer : in out Bitmap_Buffer;
Center : Point;
Radius : Natural)
procedure Fill_Rect
(Buffer : in out Bitmap_Buffer;
Area : Rect)
Fill the specified area of the buffer with the source color
procedure Fill_Rounded_Rect
(Buffer : in out Bitmap_Buffer;
Area : Rect;
Radius : Natural)
Firebrick : constant Bitmap_Color := (255, 178, 034, 034);
Floral_White : constant Bitmap_Color := (255, 255, 250, 240);
Forest_Green : constant Bitmap_Color := (255, 034, 139, 034);
Gainsboro : constant Bitmap_Color := (255, 220, 220, 220);
Ghost_White : constant Bitmap_Color := (255, 248, 248, 255);
Gold : constant Bitmap_Color := (255, 255, 215, 000);
Golden_Rod : constant Bitmap_Color := (255, 218, 165, 032);
Gray : constant Bitmap_Color := (255, 190, 190, 190);
Green : constant Bitmap_Color := (255, 000, 255, 000);
Green_Yellow : constant Bitmap_Color := (255, 173, 255, 047);
Grey : constant Bitmap_Color := (255, 128, 128, 128);
function Height (Buffer : Bitmap_Buffer) return Natural
Height of the buffer. Note that it's the user-visible height (see below for the meaning of the Swapped value).
Honeydew : constant Bitmap_Color := (255, 240, 255, 240);
Hot_Pink : constant Bitmap_Color := (255, 255, 105, 180);
Indian_Red : constant Bitmap_Color := (255, 205, 092, 092);
Indigo : constant Bitmap_Color := (255, 075, 000, 130);
Ivory : constant Bitmap_Color := (255, 255, 255, 240);
Khaki : constant Bitmap_Color := (255, 240, 230, 140);
Lavender : constant Bitmap_Color := (255, 230, 230, 250);
Lavender_Blush : constant Bitmap_Color := (255, 255, 240, 245);
Lawn_Green : constant Bitmap_Color := (255, 124, 252, 000);
Lemon_Chiffon : constant Bitmap_Color := (255, 255, 250, 205);
Light_Blue : constant Bitmap_Color := (255, 173, 216, 230);
Light_Coral : constant Bitmap_Color := (255, 240, 128, 128);
Light_Cyan : constant Bitmap_Color := (255, 224, 255, 255);
Light_Green : constant Bitmap_Color := (255, 144, 238, 144);
Light_Grey : constant Bitmap_Color := (255, 211, 211, 211);
Light_Orange : constant Bitmap_Color := (255, 255, 069, 000);
Light_Pink : constant Bitmap_Color := (255, 255, 182, 193);
Light_Salmon : constant Bitmap_Color := (255, 255, 160, 122);
Light_Sea_Green : constant Bitmap_Color := (255, 032, 178, 170);
Light_Sky_Blue : constant Bitmap_Color := (255, 135, 206, 250);
Light_Slate_Gray : constant Bitmap_Color := (255, 119, 136, 153);
Light_Steel_Blue : constant Bitmap_Color := (255, 176, 196, 222);
Light_Yellow : constant Bitmap_Color := (255, 255, 255, 224);
Lime : constant Bitmap_Color := (255, 000, 255, 000);
Lime_Green : constant Bitmap_Color := (255, 050, 205, 050);
Linen : constant Bitmap_Color := (255, 250, 240, 230);
Magenta : constant Bitmap_Color := (255, 255, 000, 255);
function Mapped_In_RAM (Buffer : Bitmap_Buffer) return Boolean
Return True is the bitmap is storred in the CPU address space
Maroon : constant Bitmap_Color := (255, 128, 000, 000);
Medium_Aqua_Marine : constant Bitmap_Color := (255, 102, 205, 170);
Medium_Blue : constant Bitmap_Color := (255, 000, 000, 205);
Medium_Orchid : constant Bitmap_Color := (255, 186, 085, 211);
Medium_Purple : constant Bitmap_Color := (255, 147, 112, 219);
Medium_Sea_Green : constant Bitmap_Color := (255, 060, 179, 113);
Medium_Slate_Blue : constant Bitmap_Color := (255, 123, 104, 238);
Medium_Spring_Green : constant Bitmap_Color := (255, 000, 250, 154);
Medium_Turquoise : constant Bitmap_Color := (255, 072, 209, 204);
Medium_Violet_Red : constant Bitmap_Color := (255, 199, 021, 133);
function Memory_Address (Buffer : Bitmap_Buffer) return System.Address
Return the address of the bitmap in the CPU address space. If the bitmap is not in the CPU address space, the result is undefined.
Midnight_Blue : constant Bitmap_Color := (255, 025, 025, 112);
Mint_Cream : constant Bitmap_Color := (255, 245, 255, 250);
Misty_Rose : constant Bitmap_Color := (255, 255, 228, 225);
Moccasin : constant Bitmap_Color := (255, 255, 228, 181);
Navajo_White : constant Bitmap_Color := (255, 255, 222, 173);
Navy : constant Bitmap_Color := (255, 000, 000, 128);
Old_Lace : constant Bitmap_Color := (255, 253, 245, 230);
Olive : constant Bitmap_Color := (255, 128, 128, 000);
Olive_Drab : constant Bitmap_Color := (255, 107, 142, 035);
Orange : constant Bitmap_Color := (255, 255, 165, 000);
Orchid : constant Bitmap_Color := (255, 218, 112, 214);
type Orientation_Mode is
(Default,
Portrait,
Landscape);
Pale_Golden_Rod : constant Bitmap_Color := (255, 238, 232, 170);
Pale_Green : constant Bitmap_Color := (255, 152, 251, 152);
Pale_Turquoise : constant Bitmap_Color := (255, 175, 238, 238);
Pale_Violet_Red : constant Bitmap_Color := (255, 219, 112, 147);
Papaya_Whip : constant Bitmap_Color := (255, 255, 239, 213);
Peach_Puff : constant Bitmap_Color := (255, 255, 218, 185);
Peru : constant Bitmap_Color := (255, 205, 133, 063);
Pink : constant Bitmap_Color := (255, 255, 192, 203);
function Pixel
(Buffer : Bitmap_Buffer;
Pt : Point)
return Bitmap_Color
Return ARGB pixel value
function Pixel
(Buffer : Bitmap_Buffer;
Pt : Point)
return UInt32
Return raw pixel value
Plum : constant Bitmap_Color := (255, 221, 160, 221);
type Point is record
X : Natural;
Y : Natural;
end record;
type Point_Array is array (Natural range <>) of Point;
Powder_Blue : constant Bitmap_Color := (255, 176, 224, 230);
Purple : constant Bitmap_Color := (255, 128, 000, 128);
type Rect is record
Position : Point;
Width : Natural;
Height : Natural;
end record;
Red : constant Bitmap_Color := (255, 255, 000, 000);
Rosy_Brown : constant Bitmap_Color := (255, 188, 143, 143);
Royal_Blue : constant Bitmap_Color := (255, 065, 105, 225);
Saddle_Brown : constant Bitmap_Color := (255, 139, 069, 019);
Salmon : constant Bitmap_Color := (255, 250, 128, 114);
Sandy_Brown : constant Bitmap_Color := (255, 244, 164, 096);
Sea_Green : constant Bitmap_Color := (255, 046, 139, 087);
Sea_Shell : constant Bitmap_Color := (255, 255, 245, 238);
procedure Set_Pixel
(Buffer : in out Bitmap_Buffer;
Pt : Point)
Set pixel with current source color
procedure Set_Pixel
(Buffer : in out Bitmap_Buffer;
Pt : Point;
Color : Bitmap_Color)
Set pixel with Color and update source color
procedure Set_Pixel
(Buffer : in out Bitmap_Buffer;
Pt : Point;
Native : UInt32)
Set pixel with low level native pixel value Color and update source color
procedure Set_Pixel_Blend
(Buffer : in out Bitmap_Buffer;
Pt : Point)
procedure Set_Source (Buffer : in out Bitmap_Buffer;
ARGB : Bitmap_Color)
Set the source color for the following drawing operations
procedure Set_Source (Buffer : in out Bitmap_Buffer;
Native : UInt32)
Set the source color for the following drawing operations
Sienna : constant Bitmap_Color := (255, 160, 082, 045);
Silver : constant Bitmap_Color := (255, 192, 192, 192);
Sky_Blue : constant Bitmap_Color := (255, 135, 206, 235);
Slate_Blue : constant Bitmap_Color := (255, 106, 090, 205);
Slate_Gray : constant Bitmap_Color := (255, 112, 128, 144);
Snow : constant Bitmap_Color := (255, 255, 250, 250);
function Source
(Buffer : Bitmap_Buffer)
return Bitmap_Color
Current source color in ARGB format
function Source
(Buffer : Bitmap_Buffer)
return UInt32
Current source color in native format
Spring_Green : constant Bitmap_Color := (255, 000, 255, 127);
Steel_Blue : constant Bitmap_Color := (255, 070, 130, 180);
function Swapped (Buffer : Bitmap_Buffer) return Boolean
If Swapped return True, operations on this buffer will consider: Width0 = Height Height0 = Width Y0 = Buffer.Width - X - 1 X0 = Y
As an example, the Bitmap buffer that corresponds to a 240x320 swapped display (to display images in landscape mode) with have the following values: Width => 320 Height => 240 Swapped => True So Put_Pixel (Buffer, 30, 10, Color) will place the pixel at Y0 = 320 - 30 - 1 = 289 X0 = 10
Tan : constant Bitmap_Color := (255, 210, 180, 140);
Teal : constant Bitmap_Color := (255, 000, 128, 128);
Thistle : constant Bitmap_Color := (255, 216, 191, 216);
Tomato : constant Bitmap_Color := (255, 255, 099, 071);
Transparent : constant Bitmap_Color := (000, 000, 000, 000);
Turquoise : constant Bitmap_Color := (255, 064, 224, 208);
Violet : constant Bitmap_Color := (255, 238, 130, 238);
Wheat : constant Bitmap_Color := (255, 245, 222, 179);
White : constant Bitmap_Color := (255, 255, 255, 255);
White_Smoke : constant Bitmap_Color := (255, 245, 245, 245);
function Width (Buffer : Bitmap_Buffer) return Natural
Width of the buffer. Note that it's the user-visible width (see below for the meaning of the Swapped value).
Yellow : constant Bitmap_Color := (255, 255, 255, 000);
Yellow_Green : constant Bitmap_Color := (255, 154, 205, 050);