mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 20:29:14 +02:00
FPReferenceWhiteGet call itself, stackoverflow solved
This commit is contained in:
parent
a3beff94dc
commit
e83b557a0a
@ -28,6 +28,7 @@ uses FPImage;
|
|||||||
|
|
||||||
type
|
type
|
||||||
TIlluminant = string[10];
|
TIlluminant = string[10];
|
||||||
|
|
||||||
PXYZReferenceWhite = ^TXYZReferenceWhite;
|
PXYZReferenceWhite = ^TXYZReferenceWhite;
|
||||||
TXYZReferenceWhite = packed record
|
TXYZReferenceWhite = packed record
|
||||||
X, Y, Z: single;
|
X, Y, Z: single;
|
||||||
@ -298,6 +299,7 @@ type
|
|||||||
TStdHSLAHelper = record helper for TStdHSLA
|
TStdHSLAHelper = record helper for TStdHSLA
|
||||||
function ToStdRGBA: TStdRGBA;
|
function ToStdRGBA: TStdRGBA;
|
||||||
function ToStdHSVA: TStdHSVA;
|
function ToStdHSVA: TStdHSVA;
|
||||||
|
function ToExpandedPixel: TExpandedPixel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TStdHSVAHelper }
|
{ TStdHSVAHelper }
|
||||||
@ -311,6 +313,8 @@ type
|
|||||||
|
|
||||||
TStdCMYKHelper = record helper for TStdCMYK
|
TStdCMYKHelper = record helper for TStdCMYK
|
||||||
function ToStdRGBA(AAlpha: Single = 1): TStdRGBA;
|
function ToStdRGBA(AAlpha: Single = 1): TStdRGBA;
|
||||||
|
function ToExpandedPixel: TExpandedPixel;overload;
|
||||||
|
function ToExpandedPixel(AAlpha: word): TExpandedPixel;overload;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TByteMaskHelper }
|
{ TByteMaskHelper }
|
||||||
@ -357,6 +361,8 @@ type
|
|||||||
function ToXYZA: TXYZA; overload;
|
function ToXYZA: TXYZA; overload;
|
||||||
function ToXYZA(const AReferenceWhite: TXYZReferenceWhite): TXYZA; overload;
|
function ToXYZA(const AReferenceWhite: TXYZReferenceWhite): TXYZA; overload;
|
||||||
function ToLChA: TLChA;
|
function ToLChA: TLChA;
|
||||||
|
function ToExpandedPixel: TExpandedPixel; overload;
|
||||||
|
function ToExpandedPixel(const AReferenceWhite: TXYZReferenceWhite): TExpandedPixel; overload;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TLChAHelper }
|
{ TLChAHelper }
|
||||||
@ -1630,6 +1636,11 @@ begin
|
|||||||
Result.value := v;
|
Result.value := v;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TStdHSLAHelper.ToExpandedPixel: TExpandedPixel;
|
||||||
|
begin
|
||||||
|
result :=self.ToStdRGBA.ToExpandedPixel;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TStdHSVAHelper }
|
{ TStdHSVAHelper }
|
||||||
|
|
||||||
function TStdHSVAHelper.ToStdRGBA: TStdRGBA;
|
function TStdHSVAHelper.ToStdRGBA: TStdRGBA;
|
||||||
@ -1718,8 +1729,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TStdCMYKHelper.ToExpandedPixel: TExpandedPixel;
|
||||||
|
begin
|
||||||
|
self.ToStdRGBA.ToExpandedPixel;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStdCMYKHelper.ToExpandedPixel(AAlpha: word): TExpandedPixel;
|
||||||
|
begin
|
||||||
|
self.ToStdRGBA(AAlpha).ToExpandedPixel;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TLabAHelper }
|
{ TLabAHelper }
|
||||||
|
|
||||||
|
function TLabAHelper.ToExpandedPixel: TExpandedPixel;
|
||||||
|
begin
|
||||||
|
self.ToXYZA.ToLinearRGBA.ToExpandedPixel;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLabAHelper.ToExpandedPixel(const AReferenceWhite: TXYZReferenceWhite): TExpandedPixel;
|
||||||
|
begin
|
||||||
|
self.ToXYZA(AReferenceWhite).ToLinearRGBA(AReferenceWhite).ToExpandedPixel;
|
||||||
|
end;
|
||||||
|
|
||||||
function TLabAHelper.ToXYZA: TXYZA;
|
function TLabAHelper.ToXYZA: TXYZA;
|
||||||
begin
|
begin
|
||||||
if FPReferenceWhite=nil then raise FPImageException.Create('Reference white (FPReferenceWhite) can not be null');
|
if FPReferenceWhite=nil then raise FPImageException.Create('Reference white (FPReferenceWhite) can not be null');
|
||||||
@ -2419,9 +2450,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function FPReferenceWhiteGet(AObserverAngle: integer; AIlluminant: TIlluminant): PXYZReferenceWhite;
|
function FPReferenceWhiteGet(AObserverAngle: integer; AIlluminant: TIlluminant): PXYZReferenceWhite;
|
||||||
|
var
|
||||||
|
rp: PXYZReferenceWhite;
|
||||||
|
i: integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
result := FPReferenceWhiteGet(AObserverAngle, AIlluminant);
|
for i := 0 to Length(FPReferenceWhiteArray) - 1 do
|
||||||
if result = nil then raise FPImageException.Create('Reference white not found');
|
begin
|
||||||
|
rp := @FPReferenceWhiteArray[i];
|
||||||
|
if (rp^.ObserverAngle = AObserverAngle) and (rp^.Illuminant = AIlluminant) then
|
||||||
|
begin
|
||||||
|
result := rp;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FPReferenceWhiteAdd(const AReferenceWhite: TXYZReferenceWhite):PXYZReferenceWhite;
|
function FPReferenceWhiteAdd(const AReferenceWhite: TXYZReferenceWhite):PXYZReferenceWhite;
|
||||||
|
Loading…
Reference in New Issue
Block a user