mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 13:38:00 +02:00
cocoa: returning alpha multiplied colors in NSColorToRGB
git-svn-id: trunk@61710 -
This commit is contained in:
parent
013971d96c
commit
9cf9304d03
@ -365,9 +365,14 @@ begin
|
||||
end;
|
||||
|
||||
function NSColorToRGB(const Color: NSColor): TColorRef; inline;
|
||||
var
|
||||
alpha: CGFloat;
|
||||
begin
|
||||
// TColorRef doesn't bear an alpha channel information.
|
||||
// Thus RGB needs to be multiplied by it.
|
||||
alpha := Color.alphaComponent;
|
||||
with Color do
|
||||
Result := RGBToColorFloat(redComponent, greenComponent, blueComponent);
|
||||
Result := RGBToColorFloat(redComponent*alpha, greenComponent*alpha, blueComponent*alpha);
|
||||
end;
|
||||
|
||||
function NSColorToColorRef(const Color: NSColor): TColorRef;
|
||||
|
Loading…
Reference in New Issue
Block a user