Thank you very much Bill, for your answer. So I assume there is not a function for it in ImageEn?
Then this could be a version to handle white also:
function DitherColor(AColor: TColor; AAlpha: Integer): TColor;
{ Dither a 32-bit color(with alpha value) to TColor.}
var
iRGB: TRGB;
begin
iRGB := TColor2TRGB(AColor);
if (iRGB.r = 255) and (iRGB.g = 255) and (iRGB.b = 255) then begin
iRGB.r := AAlpha;
iRGB.g := AAlpha;
iRGB.b := AAlpha;
end else begin
iRGB.r := Trunc(AAlpha / 255 * iRGB.r) + (255 - AAlpha);
iRGB.g := Trunc(AAlpha / 255 * iRGB.g) + (255 - AAlpha);
iRGB.b := Trunc(AAlpha / 255 * iRGB.b) + (255 - AAlpha);
end;
Result := TRGB2TColor(iRGB);
end;
HS