Index

Package: IO

Description

package GL.IO is
---------------------------------------------------------------------------- File : GL - IO.ads Description : I/O for (Open)GL graphics This package provides currently: ****************************************************** * INPUT * from a file or a data stream, to a texture * ****************************************************** - TGA image : RGA, RGBA, Grey - BMP image : B&W, 16 colours indexed (palette), 256 colours indexed *************************************************** * OUTPUT * from the GL active viewport, to a file * *************************************************** - BMP image : screenshot - AVI video : video capture ---------------------------------------------------------------------------- Change log: 19 - Jan - 2010 (GdM) : using workaround to the slow attribute I/O issue (GNAT, OA); buffered input; improvements on BMP 26 - May - 2008 (GdM) : added support for TGA images with RLE encoding 27 - Jan - 2008 (RK) : added 'Image' record and a function to get greyscale pixels from an Image. 10 - May - 2007 (GdM) : screenshot and video capture 13 - Oct - 2006 (GdM) : new blending_hint out parameter, indicates possible blending/transparency 30 - Apr - 2006 (GdM) : - added multi - format loaders - dimensions not power of two allowed, but discouraged in the docs. - > removed TGA_BAD_DIMENSION

Types

Supported_format

type Supported_format is (BMP, TGA);

References:

gl-io.ads:49:8 (declaration)
gl-io.adb:729:40 (reference)
gl-io.adb:741:40 (reference)
gl-io.ads:79:40 (reference)
gl-io.ads:84:40 (reference)
globe_3d-textures.adb:61:67 (reference)

Byte_Array

type Byte_Array is array (Integer range <>) of aliased GL.Ubyte;

References:

gl-io.ads:51:8 (declaration)
gl-io.adb:78:27 (reference)
gl-io.adb:93:51 (reference)
gl-io.adb:161:17 (reference)
gl-io.adb:164:55 (reference)
gl-io.adb:231:39 (reference)
gl-io.adb:259:38 (reference)
gl-io.adb:286:39 (reference)
gl-io.adb:307:56 (reference)
gl-io.adb:324:18 (reference)
gl-io.adb:325:18 (reference)
gl-io.adb:326:18 (reference)
gl-io.adb:332:7 (reference)
gl-io.adb:333:7 (reference)
gl-io.adb:334:7 (reference)
gl-io.adb:383:29 (reference)
gl-io.adb:619:54 (reference)
gl-io.adb:704:24 (reference)
gl-io.ads:52:37 (reference)
gl-io.ads:55:37 (reference)
gl-io.ads:156:19 (reference)

Byte_Array_Ptr

type Byte_Array_Ptr is access all Byte_Array;

References:

gl-io.ads:52:8 (declaration)
gl-io.adb:52:48 (reference)
gl-io.adb:470:19 (reference)
gl-io.ads:55:49 (reference)
gl-io.ads:67:27 (reference)

Byte_Grid

type Byte_Grid is array (Integer range <>, Integer range <>) of aliased GL.Ubyte;

References:

gl-io.ads:57:8 (declaration)
gl-io.adb:26:60 (reference)
gl-io.adb:28:19 (reference)
gl-io.ads:74:59 (reference)

Image

type Image is
    record
      blending_hint     : Boolean;        -- has the image blending / transparency /alpha ?
      tex_Format        : GL.TexFormatEnm;
      tex_pixel_Format  : GL.TexPixelFormatEnm;
      size              : Integer;
      Width,
      Height            : Integer;
      Data              : Byte_Array_Ptr;
    end record;

References:

gl-io.ads:59:8 (declaration)
gl-io.adb:26:46 (reference)
gl-io.adb:153:77 (reference)
gl-io.adb:155:20 (reference)
gl-io.adb:389:53 (reference)
gl-io.adb:392:20 (reference)
gl-io.adb:422:20 (reference)
gl-io.ads:70:52 (reference)
gl-io.ads:72:74 (reference)
gl-io.ads:74:45 (reference)

Input_buffer

type Input_buffer is private;

References:

gl-io.ads:145:8 (declaration)
gl-io.adb:85:38 (reference)
gl-io.adb:89:38 (reference)
gl-io.adb:132:40 (reference)
gl-io.adb:140:35 (reference)
gl-io.adb:156:20 (reference)
gl-io.adb:471:20 (reference)
gl-io.ads:147:38 (reference)
gl-io.ads:150:34 (reference)
gl-io.ads:155:8 (full declaration)
------------------------------------------------------------------------ An object - oriented stream buffering, initially for reading images to -- the GL system, but that may be useful elsewhere, hence its presence -- in this package's specification -- ------------------------------------------------------------------------

Constants & Global variables

File_Not_Found

File_Not_Found  : exception;

References:

gl-io.ads:47:3 (declaration)
gl-io.adb:398:46 (reference)
gl-io.adb:450:46 (reference)

Unsupported_BMP_format

Unsupported_BMP_format,
  Not_BMP_format,
  BMP_Unsupported_Bits_per_Pixel,
  Unsupported_compression :      exception;

References:

gl-io.ads:102:3 (declaration)

Not_BMP_format

Not_BMP_format,
  BMP_Unsupported_Bits_per_Pixel,
  Unsupported_compression :      exception;

References:

gl-io.ads:103:3 (declaration)
gl-io.adb:559:19 (reference)

BMP_Unsupported_Bits_per_Pixel

BMP_Unsupported_Bits_per_Pixel,
  Unsupported_compression :      exception;

References:

gl-io.ads:104:3 (declaration)
gl-io.adb:583:19 (reference)

Unsupported_compression

Unsupported_compression :      exception;

References:

gl-io.ads:105:3 (declaration)
gl-io.adb:589:19 (reference)

TGA_Unsupported_Image_Type

TGA_Unsupported_Image_Type      : exception;

References:

gl-io.ads:119:3 (declaration)
gl-io.adb:338:27 (reference)
gl-io.adb:359:27 (reference)

TGA_Unsupported_Bits_per_pixel

TGA_Unsupported_Bits_per_pixel  : exception;

References:

gl-io.ads:120:3 (declaration)
gl-io.adb:379:16 (reference)
color mapped or compressed image

TGA_Bad_Data

TGA_Bad_Data                    : exception;

References:

gl-io.ads:121:3 (declaration)
image bits is not 8, 24 or 32

Subprograms & Entries

Free

procedure Free is new Ada.Unchecked_Deallocation 
(Byte_Array, Byte_Array_Ptr);

References:

gl-io.ads:54:13 (declaration)
gl-io.adb:434:7 (call)
gl-io.adb:720:7 (call)

Called by:

Load_BMP defined at gl-io.ads:98:13
Load_TGA defined at gl-io.ads:115:14

To_TGA_Image

function To_TGA_Image 
(Filename: String) return Image;

References:

gl-io.ads:70:12 (declaration)
gl-io.adb:389:13 (body)
gl-io.adb:408:8 (label)

Calls:

Ada.Exceptions.Exception_Identity defined at a-except.ads:105:13
Ada.Exceptions.Raise_Exception defined at a-except.ads:93:14
Close defined at a-ststio.ads:79:14
Open defined at a-ststio.ads:73:14
Stream defined at a-ststio.ads:91:13
To_TGA_Image defined at gl-io.ads:72:12

To_TGA_Image

function To_TGA_Image 
(S: Ada.Streams.Stream_IO.Stream_Access) return Image;

References:

gl-io.ads:72:12 (declaration)
gl-io.adb:153:13 (body)
gl-io.adb:387:8 (label)
gl-io.adb:400:20 (call)
gl-io.adb:422:29 (call)

Called by:

Load_TGA defined at gl-io.ads:115:14
To_TGA_Image defined at gl-io.ads:70:12

Calls:

Ada.Exceptions.Raise_Exception defined at a-except.ads:93:14
IO.To_TGA_Image.getData defined at gl-io.adb:307:17
IO.To_TGA_Image.getGray defined at gl-io.adb:286:17
IO.To_TGA_Image.getRGB defined at gl-io.adb:259:17
IO.To_TGA_Image.getRGBA defined at gl-io.adb:231:17
IO.To_TGA_Image.RLE_Pixel defined at gl-io.adb:164:17

to_greyscale_Pixels

function to_greyscale_Pixels 
(the_Image: Image) return Byte_Grid;

References:

gl-io.ads:74:12 (declaration)
gl-io.adb:26:13 (body)
gl-io.adb:44:8 (label)

Load

procedure Load 
(name: String;
-- file name format: Supported_format;
-- expected file format ID: Integer;
-- ID is the texture identifier to bind to blending_hint: out Boolean);

References:

gl-io.ads:78:14 (declaration)
gl-io.adb:728:14 (body)
gl-io.adb:738:8 (label)
gl-textures.adb:103:16 (call)
gl-textures.adb:106:16 (call)

Calls:

Load_BMP defined at gl-io.ads:94:14
Load_TGA defined at gl-io.ads:111:14

Load

procedure Load 
(s: Ada.Streams.Stream_IO.Stream_Access;
-- input data stream (e.g. UnZip.Streams) format: Supported_format;
-- expected file format ID: Integer;
-- ID is the texture identifier to bind to blending_hint: out Boolean);

References:

gl-io.ads:83:14 (declaration)
gl-io.adb:740:14 (body)
gl-io.adb:750:8 (label)
globe_3d-textures.adb:64:15 (call)

Calls:

Load_BMP defined at gl-io.ads:98:13
Load_TGA defined at gl-io.ads:115:14

Load_BMP

procedure Load_BMP 
(Name: String;
-- File name Id: Integer;
-- Id is the texture identifier to bind to blending_hint: out Boolean);

References:

gl-io.ads:94:14 (declaration)
gl-io.adb:726:14 (body)
gl-io.adb:735:19 (call)

Called by:

Load defined at gl-io.ads:78:14

Load_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);

References:

gl-io.ads:98:13 (declaration)
gl-io.adb:466:14 (body)
gl-io.adb:722:8 (label)
gl-io.adb:724:59 (reference)
gl-io.adb:747:19 (call)

Called by:

Load defined at gl-io.ads:83:14

Load_TGA

procedure Load_TGA 
(Name: String;
-- File name Id: Integer;
-- Id is the texture identifier to bind to blending_hint: out Boolean);

References:

gl-io.ads:111:14 (declaration)
gl-io.adb:462:14 (body)
gl-io.adb:736:19 (call)

Called by:

Load defined at gl-io.ads:78:14

Load_TGA

procedure Load_TGA 
(S: Ada.Streams.Stream_IO.Stream_Access;
-- Input data stream Id: Integer;
-- Id is the texture identifier to bind to blending_hint: out Boolean);

References:

gl-io.ads:115:14 (declaration)
gl-io.adb:418:14 (body)
gl-io.adb:437:8 (label)
gl-io.adb:460:59 (reference)
gl-io.adb:748:19 (call)

Called by:

Load defined at gl-io.ads:83:14

Screenshot

procedure Screenshot 
(Name: String);

References:

gl-io.ads:127:13 (declaration)
gl-io.adb:819:14 (body)
gl-io.adb:924:8 (label)
glut-windows.adb:498:16 (call)
screenshots.adb:18:7 (call)

Calls:

Close defined at a-ststio.ads:79:14
Create defined at a-ststio.ads:67:14
GL.GetIntegerv defined at gl.ads:1198:14
IO.Screenshot.Cvt defined at gl-io.adb:891:19
IO.Screenshot.Cvt defined at gl-io.adb:855:16
IO.Screenshot.Write_Intel defined at gl-io.adb:890:20
IO.Screenshot.Write_Intel defined at gl-io.adb:889:20
IO.Write_Intel_x86_number defined at gl-io.adb:759:14
IO.Write_raw_BGR_frame defined at gl-io.adb:771:14
Stream defined at a-ststio.ads:91:13
Unchecked_Conversion defined at a-unccon.ads:20:14

Start_Capture

procedure Start_Capture 
(AVI_Name: String;
frame_rate: Positive);

References:

gl-io.ads:133:13 (declaration)
gl-io.adb:1023:14 (body)
gl-io.adb:1042:8 (label)
glut-windows.adb:485:19 (call)

Calls:

Create defined at a-ststio.ads:67:14
GL.GetIntegerv defined at gl.ads:1198:14
IO.Start_Capture.Cvt defined at gl-io.adb:1028:16
IO.Write_RIFF_headers defined at gl-io.adb:938:14
Unchecked_Conversion defined at a-unccon.ads:20:14

Capture_Frame

procedure Capture_Frame;

References:

gl-io.ads:135:13 (declaration)
gl-io.adb:1044:14 (body)
gl-io.adb:1054:8 (label)
glut-windows.adb:492:16 (call)

Calls:

IO.Capture_Frame.Write_Intel defined at gl-io.adb:1047:17
IO.Write_Intel_x86_number defined at gl-io.adb:759:14
IO.Write_raw_BGR_frame defined at gl-io.adb:771:14
Stream defined at a-ststio.ads:91:13

Stop_Capture

procedure Stop_Capture;

References:

gl-io.ads:137:13 (declaration)
gl-io.adb:1056:14 (body)
gl-io.adb:1079:8 (label)
glut-windows.adb:482:19 (call)

Calls:

Close defined at a-ststio.ads:79:14
IO.Stop_Capture.Write_Intel defined at gl-io.adb:1060:17
IO.Write_Intel_x86_number defined at gl-io.adb:759:14
IO.Write_RIFF_headers defined at gl-io.adb:938:14
Set_Index defined at a-ststio.ads:121:14
Stream defined at a-ststio.ads:91:13

Attach_Stream

procedure Attach_Stream 
(b: out Input_buffer;
stm: Ada.Streams.Stream_IO.Stream_Access);

References:

gl-io.ads:147:13 (declaration)
gl-io.adb:132:14 (body)
gl-io.adb:138:8 (label)
gl-io.adb:309:10 (call)
gl-io.adb:640:10 (call)

Calls:

IO.Fill_Buffer defined at gl-io.adb:85:14

Get_Byte

procedure Get_Byte 
(b: in out Input_buffer;
Return_Byte: out Ubyte);

Calls:

IO.Fill_Buffer defined at gl-io.adb:85:14