-- Sample Scriptlet File for AutoPlay Media Studio 5.0
-- Name: RGB.lua

-- Copyright © 2003 Indigo Rose Software
-- http://www.indigorose.com
-- sales@indigorose.com

-- The script functions below can be used to create and manipulate RGB
-- values.  An RGB value is a 24-bit color value that is comprised of
-- Red, Green, and Blue components.  Each of these components can
-- vary from 0 to 255.  An RGB value of 0,0,0 is black and 255,255,255 is white

RGB = {};

-- ***************************************************************************

-- Definition:
-- number RGB.Create(number Red, number Green, number Blue)

-- Purpose:
-- To create an RGB value given individual color components.

-- Arguments:
-- number Red (The red value from 0-255)
-- number Green (The green value from 0-255)
-- number Blue (The blue value from 0-255)

-- Returns:
-- number Result (the RGB value)

function RGB.Create(Red,Green,Blue)
	return ((Red) + (Green*256) + (Blue*256*256));
end

-- ***************************************************************************

-- Definition:
-- string RGB.GetHexString(number Red, number Green, number Blue)

-- Purpose:
-- To return a Hex formatted RGB value as a string (i.e. "#FF00FF")

-- Arguments:
-- number Red (The red value from 0-255)
-- number Green (The green value from 0-255)
-- number Blue (The blue value from 0-255)

-- Returns:
-- string Result (the Hex formatted RGB value)

function RGB.GetHexString(Red,Green,Blue)
	return string.format("#%02X%02X%02X",Red,Green,Blue);
end

-- ***************************************************************************
