text stringlengths 0 234 |
|---|
-- Allocation |
the_Image.Data := new Byte_Array (0 .. (Image_Bits / 8) * the_Image.size - 1); |
getData (Image_Bits, the_Image.Data.all); |
return the_Image; |
end To_TGA_Image; |
function To_TGA_Image (Filename : String) return Image is |
f : File_Type; |
the_Image : Image; |
begin |
begin |
Open (f, In_File, Filename); |
exception |
when Name_Error => Raise_Exception (File_Not_Found'Identity, " file name:" & Filename); |
Function Definition: procedure i_Load_TGA is new Load_XXX (Stream_Loader => Load_TGA); |
Function Body: procedure Load_TGA (Name : String; Id : Integer; blending_hint : out Boolean) renames i_Load_TGA; |
-- BMP |
procedure Load_BMP (S : Ada.Streams.Stream_IO.Stream_Access; -- Input data stream |
Id : Integer; -- Id is the texture identifier to bind to |
blending_hint : out Boolean) is -- has the image blending / transparency /alpha ? |
imageData : Byte_Array_Ptr := null; |
stream_buf : Input_buffer; |
subtype Y_Loc is Natural range 0 .. 4095; |
subtype X_Loc is Natural range 0 .. 4095; |
-- 256 - col types |
subtype Color_Type is GL.Ubyte; |
type RGB_Color_Bytes is |
record |
Red : Color_Type; |
Green : Color_Type; |
Blue : Color_Type; |
end record; |
type Color_Palette is array (Color_Type) of RGB_Color_Bytes; |
Palette : Color_Palette; |
---------------------------------------------------- |
-- BMP format I/O -- |
-- -- |
-- Rev 1.5 10 - May - 2006 GdM : added 4 - bit support -- |
-- Rev 1.4 11/02/99 RBS -- |
-- -- |
---------------------------------------------------- |
-- Coded by G. de Montmollin |
-- Code additions, changes, and corrections by Bob Sutton |
-- |
-- Remarks expanded and altered |
-- Provided for scanline padding in data stream |
-- Corrected stream reading for images exceeding screen size. |
-- Provided selectable trim modes for oversize images |
-- Procedures originally Read_BMP_dimensions now Read_BMP_Header |
-- Some exceptions added |
-- |
-- Rev 1.2 RBS. Added variable XY screen location for BMP |
-- Rev 1.3 RBS. Added image inversion & reversal capability |
-- Rev 1.4 RBS. Activated LOCATE centering / clipping options |
-- |
-- This version presumes that the infile is a new style, 256 color bitmap. |
-- The Bitmap Information Header structure (40 bytes) is presumed |
-- instead of the pre - Windows 3.0 Bitmap Core Header Structure (12 Bytes) |
-- Pos 15 (0EH), if 28H, is valid BIH structure. If 0CH, is BCH structure. |
procedure Read_BMP_Header (S : Stream_Access; |
width : out X_Loc; |
height : out Y_Loc; |
image_bits : out Integer; |
offset : out U32) is |
fsz : U32; |
ih : U32; |
w, dummy16 : U16; |
n : U32; |
Str2 : String (1 .. 2); |
Str4 : String (1 .. 4); |
Str20 : String (1 .. 20); |
-- Get numbers with correct trucmuche endian, to ensure |
-- correct header loading on some non - Intel machines |
generic |
type Number is mod <>; -- range <> in Ada83 version (fake Interfaces) |
procedure Read_Intel_x86_number (n : out Number); |
procedure Read_Intel_x86_number (n : out Number) is |
b : GL.Ubyte; |
m : Number := 1; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.