summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-03-15 09:34:20 +0100
committerErich Eckner <git@eckner.net>2016-03-15 13:01:16 +0100
commit3a9b41172a7cfce57c5f1a70e79b2eaa73132caf (patch)
tree8a5df05d52a91931b012c4454859e5b1e7ae72a7
parent33909e59e3e5f4b6d3c8489edb7e02c239688af2 (diff)
downloadunits-3a9b41172a7cfce57c5f1a70e79b2eaa73132caf.tar.xz
strToTRGB neu in lowlevelunit.pas
-rw-r--r--lowlevelunit.pas21
1 files changed, 21 insertions, 0 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas
index 1d3aa33..ab0a2fa 100644
--- a/lowlevelunit.pas
+++ b/lowlevelunit.pas
@@ -59,12 +59,14 @@ function binOpPos(op: char; s: string): integer;
function fktPos(fkt,s: string): integer;
procedure gibAus(s: string; ausgaben: byte);
function strToGen(out gen: tGenauigkeit; s: string): boolean;
+function mischeFarben(a,b: tRGB; x: extended): tRGB;
function orFarben(a,b: tRGB): tRGB;
function andFarben(a,b: tRGB): tRGB;
function wertZuFarbe(x: extended; p: tRGBArray): tRGB;
function tFPColor2tRgb(c: tFPColor): tRGB;
function tRgb2tFPColor(c: tRGB): tFPColor;
function rgb(r,g,b: byte): tRGB; inline;
+function strToTRGB(s: string; out rgb: tRGB): boolean;
procedure myDebugLnThreadLog(s: string);
procedure cleanupLogs;
procedure cleanupLog(tid: PtrUInt);
@@ -498,6 +500,25 @@ begin
result.rgbBlue:=b;
end;
+function strToTRGB(s: string; out rgb: tRGB): boolean;
+var
+ i: longint;
+begin
+ result:=false;
+ if length(s)=6 then begin
+ result:=true;
+ for i:=1 to 6 do
+ result:=result and (s[i] in ['0'..'9','a'..'f','A'..'F']);
+ if result then begin
+ i:=strToInt('$'+s);
+ rgb.rgbRed:= (i and $ff0000) shr 16;
+ rgb.rgbGreen:=(i and $00ff00) shr 8;
+ rgb.rgbBlue:= i and $0000ff;
+ exit;
+ end;
+ end;
+end;
+
procedure myDebugLnThreadLog(s: string);
var
f: textfile;