Well, MidPoint, at least in The Gimp can be up to 10.0.
I get the same exception, but I have made some changes and now it runs great. The first one tries to do less operations, but I don't really know if I get that (every time I run the function it takes a different time).
procedure TImagingCanvas.AdjustColorLevels(BlackPoint, WhitePoint, MidPoint: Single);
begin
PointTransform(TransformLevels, BlackPoint, WhitePoint-BlackPoint, 1.0/MidPoint);
end;
function TransformLevels(const Pixel: TColorFPRec; BlackPoint, Divisor, Exponente: Single): TColorFPRec;
begin
Result.A := Pixel.A;
if Pixel.R>BlackPoint then
Result.R := Power((Pixel.R - BlackPoint) / Divisor, Exponente)
else
Result.R:=0.0;
if Pixel.G>BlackPoint then
Result.G := Power((Pixel.G - BlackPoint) / Divisor, Exponente)
else
Result.G:=0.0;
if Pixel.B>BlackPoint then
Result.B := Power((Pixel.B - BlackPoint) / Divisor, Exponente)
else
Result.B:=0.0;
end;