SCAR Code:
program New;
//{.Include SRL/SRL.scar}
function IntToBool(TheInt: Integer): Boolean;
begin;
If (TheInt = 0) Then
Result:= False;
else
Result:= True;
end;
function BoolToInt(TheBool: Boolean): Integer;
begin;
If not (TheBool) Then
Result:= False;
else
Result:= True;
end;
{ function SetIntBMP ]
[ ]
[ Desc. : Returns True if it had to split the integer in half to ]
[ store it. In which case, you must specify if it has been ]
[ split on retrieval }
function SetIntBMP(BitMSet, Valu, X, Y: Integer): Boolean;
begin;
If not (Valu > 16777215) Then
begin;
FastSetPixel(BitMSet, X, Y, Valu);
Result:= False;
end else
begin;
FastSetPixel(BitMSet, X, Y, Round(Valu - Round(Valu/2)));
Result:= True;
end;
end;
function SetFloatBMP(BitMSet, X, Y: Integer; Valu: Extended): Boolean;
Var
S, L, sValu ssValu: Extended;
begin;
If not (Valu > 16777215) Then
begin;
sValu:= Valu - Round(Valu);
ssValu:= sValu - (sValu / 2);
FastSetPixel(BitMSet, X, Y, HSLToColor(Valu, ssValu, ssValu));
Result:= False;
end else
begin;
sValu:= Valu - Round(Valu);
ssValu:= sValu - (sValu / 2);
FastSetPixel(BitMSet, X, Y, HSLToColor(Valu/2, ssValu, 0.0));
Result:= True;
end;
end;
function SetBoolBMP(BitMSet, X, Y: Integer; Valu: Boolean): Boolean;
begin;
Result:= Valu;
FastSetPixel(BitMSet, X, Y, BoolToInt(Valu));
end;
function ReadIntBMP(BitMSet, X, Y: Integer, Halved: Boolean): Integer;
begin;
If (Halved) Then
Result:= FastGetPixel(BitMSet, X, Y) * 2;
else
Result:= FastGetPixel(BitMSet, X, Y);
end;
function ReadFloatBMP(BitMSet, X, Y: Integer; Halved: Boolean): Extended;
Var H, S, L, sValu: Extended;
begin;
If (Halved) Then
begin;
ColorToHSL(FastGetPixel(BitMSet, X, Y), H, S, L);
Result:= H+S+L*2;
end else
begin;
ColorToHSL(FastGetPixel(BitMSet, X, Y), H, S, L);
Result:= H+S+L;
end;
end;
function ReadBoolBMP(BitMSet, X, Y: Integer): Boolean;
begin;
Result:= IntToBool(FastGetPixel(BitMSet, X, Y));
end;
begin;
end.
{
This agreement may be ignored for identified members of SRL-Forums.com under the discretion of R0b0t1. All members of aforementioned website under the title of SRL Member, SRL Dev, Dev, SSRL (Senior Scar Resource Library Member), Admin, or Administrator, will be excused from the above clause and instead be able to use this file without discretion of R0b0t1, but may be asked to remove said file from use if required to by request from R0b0t1.
<OWNER> = User under the alias of R0b0t1, R0b0t1, unextended family of alias R0b0t1.
<ORGANIZATION> = R0b0t1
<YEAR> = 2007
Copyright (c) <YEAR>, <OWNER>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the <ORGANIZATION> nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
* You may not use this software for personal gain and/or bussiness
purposes without specific prior written permision.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. }