diff options
author | Erich Eckner <git@eckner.net> | 2017-01-14 19:51:53 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-01-14 19:51:53 +0100 |
commit | 33a5e61e3730dac181226cac5a3a33393d1eb7bf (patch) | |
tree | 13e61a4ba92150a687ed97263d50a92356a81166 | |
parent | 966286432638d3b64e5ebc6c2ace8e5eddd56ce4 (diff) | |
download | units-33a5e61e3730dac181226cac5a3a33393d1eb7bf.tar.xz |
mehr Farbkonvertierungen in lowlevelunit
-rw-r--r-- | lowlevelunit.pas | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/lowlevelunit.pas b/lowlevelunit.pas index 3445a13..9d21db5 100644 --- a/lowlevelunit.pas +++ b/lowlevelunit.pas @@ -5,7 +5,7 @@ unit lowlevelunit; interface uses - math, Classes, SysUtils, RegExpr, process, FPimage; + math, Classes, SysUtils, RegExpr, process, FPimage, Graphics; type generic tArray<T> = array of T; @@ -61,12 +61,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 mischeFarben(a,b: tRGB; x: extended): tRGB; inline; +function orFarben(a,b: tRGB): tRGB; inline; +function andFarben(a,b: tRGB): tRGB; inline; function wertZuFarbe(x: extended; p: tRGBArray): tRGB; -function tFPColor2tRgb(c: tFPColor): tRGB; -function tRgb2tFPColor(c: tRGB): tFPColor; +function tFPColor2tRgb(c: tFPColor): tRGB; inline; +function tRgb2tFPColor(c: tRGB): tFPColor; inline; +function tColor2tRgb(c: tColor): tRGB; inline; +function tRgb2tColor(c: tRGB): tColor; inline; function rgb(r,g,b: byte): tRGB; inline; function strToTRGB(s: string; out rgb: tRGB): boolean; procedure myDebugLnThreadLog(s: string); @@ -480,6 +482,18 @@ begin result.blue:=c.rgbBlue; end; +function tColor2tRgb(c: tColor): tRGB; +begin + result.rgbRed:=c and $ff; + result.rgbGreen:=(c shr 8) and $ff; + result.rgbBlue:=(c shr 16) and $ff; +end; + +function tRgb2tColor(c: tRGB): tColor; +begin + result:=c.rgbRed or (c.rgbGreen shl 8) or (c.rgbBlue shl 16); +end; + function rgb(r,g,b: byte): tRGB; begin result.rgbRed:=r; |