union colorClass as uinteger colour 'color value type as ubyte b 'color blue component as ubyte g 'color green component as ubyte r 'color red component as ubyte a 'color alpha component end type declare operator let(value as uinteger) 'define object assignment ....... ex: object=var declare operator cast() as string 'define object string output .... ex: print object declare operator cast() as uinteger 'define object numerical output . ex: var=object declare operator + (byref c1 as colorClass,byref c2 as colorClass) as colorClass declare constructor(byval value as uinteger=&hFF000000) end union operator colorClass.let(value as uinteger): colour=value: end operator operator colorClass.cast() as string: return str$(colour): end operator operator colorClass.cast() as uinteger: return colour: end operator operator colorClass.+(byref c1 as colorClass,byref c2 as colorClass) as colorClass dim as colorClass newColor with newColor .r=c1.r+c2.r .g=c1.g+c2.g .b=c1.b+c2.b end with return newColor end operator ' ============================================================================= ' Name: rgbaClass constructor (05.17.08) ' Parameters: ' [value]: initial color value [&hFF000000] ' ----------------------------------------------------------------------------- ' Description: Construct color class instance ' Comments: The default color value [&hFF000000] is the equivalent of ' rgba(0,0,0,255). This allows subsequent rgb only updates to ' 'take effect' without modifying the alpha value. ' ============================================================================= constructor colorClass(byval value as uinteger) colour=value end constructor