JEWL package specification
------------------------------------------------------------------------------
-- --
-- J E W L --
-- --
-- Top-level package in a hierarchy providing I/O and Windows facilities --
-- for beginners. --
-- --
-- Copyright (C) John English 2000. Contact address: je@brighton.ac.uk --
-- This software is released under the terms of the GNU General Public --
-- License and is intended primarily for educational use. Please contact --
-- the author to report bugs, suggestions and modifications. --
-- --
------------------------------------------------------------------------------
with Ada.Finalization;
package JEWL is
----------------------------------------------------------------------------
--
-- S U P P O R T T Y P E S
--
-- These types are used elsewhere throughout this package library:
--
-- Angle_Type : an angle specified as an integral number of
-- degrees (0 to 359)
-- Colour_Type : a colour specified as an RGB value.
-- Font_Type : a font specified by a name, point size and style
-- options.
-- Point_Type : a pair of (X,Y) coordinates within a window.
-- Point_List : an array of (X,Y) coordinate pairs.
--
----------------------------------------------------------------------------
type Angle_Type is mod 360;
subtype Colour_Range is Integer range 0..255;
type Colour_Type is record
Red : Colour_Range;
Green : Colour_Range;
Blue : Colour_Range;
end record;
type Font_Type (Length : Natural)
is record
Name : String (1..Length);
Size : Positive;
Bold : Boolean := False;
Italic : Boolean := False;
end record;
type Point_Type is record
X,Y : Integer;
end record;
type Point_List is array (Positive range <>) of Point_Type;
----------------------------------------------------------------------------
--
-- O P E R A T I O N S O N S U P P O R T T Y P E S
--
-- Colour operations:
-- Light : Generate a lightened version of a colour, e.g. Light(Red).
-- Dark : Generate a darkened version of a colour, e.g. Dark(Green).
--
-- Font operations:
-- Font : Generate a font with the specified properties.
-- Name : Get the name of the font typeface.
-- Size : Get the font size in points.
-- Bold : Test if the font is bold.
-- Italic : Test if the font is italic.
--
-- Point operations:
-- Endpoint : Calculate the endpoint of a line from a starting point,
-- length and angle.
-- Inside : Test if a specified point is inside a specified rectangle
-- (defined by the coordinates of two diagonally opposite
-- corners).
-- P1 + P2 : Add two points (P1.X+P2.X, P1.Y+P2.Y).
-- P1 - P2 : Subtract two points (P1.X-P2.X, P1.Y-P2.Y).
--
----------------------------------------------------------------------------
function Light (Colour : Colour_Type) return Colour_Type;
function Dark (Colour : Colour_Type) return Colour_Type;
function Font (Name : String;
Size : Positive;
Bold : Boolean := False;
Italic : Boolean := False)
return Font_Type;
function Name (Font : Font_Type) return String;
function Size (Font : Font_Type) return Natural;
function Bold (Font : Font_Type) return Boolean;
function Italic (Font : Font_Type) return Boolean;
function Endpoint (From : Point_Type;
Length : Positive;
Angle : Angle_Type) return Point_Type;
function Inside (Point : Point_Type;
From : Point_Type;
To : Point_Type) return Boolean;
function "+" (P1, P2 : Point_Type) return Point_Type;
function "-" (P1, P2 : Point_Type) return Point_Type;
----------------------------------------------------------------------------
-- Renamings for our transatlantic cousins, in the hope that some day
-- they'll repay the favour/favor... ;-)
----------------------------------------------------------------------------
subtype Color_Range is Colour_Range;
subtype Color_Type is Colour_Type;
private
-- implementation details
end JEWL;