This package runs from an MS DOS console so it does not require any WIN32 bindings or Windows API programming. The original AdaGraph supports only 16 colors but extensions are available that support up to 256 colors (see Chapter 8). The package includes a limited set of drawing primitives such as Create_Graph_Window - creates a graphics window of the user specified size. Clear_Window - Erases the contents of the current graphics window with a specified color. Get_Pixel - Returns the color of the indicated pixel Put_Pixel - Set the indicated point in the graphics window to the specified color Draw_Line - Draws a line from a specified point to a specified point of a specified color Where_X - Returns the current X position of the drawing point in the graphics window Where_Y - Returns the current Y position of th darwing point in the graphics window Goto_XY - Moves the current drawing position to the specified point in the graphics window Draw_Box - Draws a rectangle with a specified upper left and lower right corner, line color and fill/no fill factor. Draw_Ellipse - Draws an ellipse contained in a box with a specified upper left and lower right corner. Also sets the color and fill factor. Flood_Fill - Fills a closed region defined by all pixels of the same color as the pixel at a specified. starting location that are adjacent (up,down,left,right) of a member pixel. Display_Text - Displays the specified line of text starting at the specified position and of a specified color. A sample GNAT Ada program demonstrating some of the features of AdaGraph is shown below. with ada.text_io, adagraph; use ada.text_io, adagraph; procedure adagraph_demo is x, y : integer; -- Where to display the text string x_max : integer; -- Maximum horizontal coordinate y_max : integer; -- Maximum vertical coordinate x_char : integer; -- Character width in pixels y_char : integer; -- Character height in pixels -- Text string to display hello_string : constant string := "Hello, world!"; string_length : constant integer := hello_string'length; key : character; -- user input character begin -- Open the AdaGraph Window create_graph_window (x_max, y_max, x_char, y_char); -- Set the window's title set_window_title ("AdaGraph 'hello world' example"); -- Clear the window to a dark blue background clear_window (white); -- Calculate the horizontal position x := ((x_max + 1) - (string_length * x_char)) / 2; -- Calculate the vertical position y := ((y_max + 1) - y_char) / 2; -- Display the string in red and black display_text (x, y, hello_string, black); display_text (x-1,y-1, hello_string, light_red); display_text (x-2,y-2, hello_string, light_red); -- Demonstrate drawing primitives draw_line(10,10,400,300,light_blue); draw_box(300,20,350,70,light_green,fill); draw_circle(60,300,50,light_magenta,fill); draw_circle(60,300,44,blue,no_fill); flood_fill(75,325,light_gray); for i in 1..40 loop draw_ellipse(450+i*2,100+i*2, 600-i*2,320-i*2, color_type'val(i mod 16),no_fill); end loop; -- Wait until the user presses any key put ("Press any key to exit: "); if key_hit then -- clears the keyboard buffer key:=get_key; end if; while not(key_hit) loop -- loops until a key is hit null; end loop; -- Close the AdaGraph window destroy_graph_window; end adagraph_demo;