
Setting up red therefore corresponds to 255/0/0 in terms of r/g/b. +1 is needed, because you never get the number that max, only the number that max-1. By using 'mod' you get module from division Random and max. 100, the maximum value is 255, and since you don’t want to mix in green and blue, they get the minimum value of 0 (hence 0). To get a random number between some two numbers you need this: Result:Min+random (10000)mod max + 1 I don't remember the maximum value for random, so you can change it (it don't changes anything). GetBits ( const AIndex : Integer ) : Integer var Offset : Integer BitCount : Integer Mask : Integer begin BitCount := AIndex and $FF Offset := AIndex shr 8 Mask := (( 1 shl BitCount ) - 1 ) Result := ( RawData shr Offset ) and Mask end procedure TSomeBitStructure. If you like to have a red colour, you need to set the value for the red colour high, e.g. Copy N bytes of pascal string: UpperCase Convert string to all-uppercase.


TBits = class ( TObject ) public constructor Create ( TheSize : longint = 0 ) virtual destructor Destroy override function GetFSize : longint procedure SetOn ( Bit : longint ) procedure Clear ( Bit : longint ) procedure Clearall procedure AndBits ( BitSet : TBits ) procedure OrBits ( BitSet : TBits ) procedure XorBits ( BitSet : TBits ) procedure NotBits ( BitSet : TBits ) function Get ( Bit : longint ) : boolean procedure Grow ( NBit : longint ) function Equals ( Obj : TObject ) : Boolean override overload function Equals ( BitSet : TBits ) : Boolean overload procedure SetIndex ( Index : longint ) function FindFirstBit ( State : boolean ) : longint function FindNextBit : longint function FindPrevBit : longint function TSomeBitStructure. type TCaseTranslationTable array0.255 of char var UpperCaseTable.
