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;
var
FBitmap:TImagingBitmap;
FImage:TMultiImage;
FImageCanvas: TImagingCanvas;
begin
FImage:=TMultiImage.Create;
FBitmap:=TImagingBitmap.Create;
Image.Picture.Graphic:=FBitmap;
FImageCanvas:=TImagingCanvas.Create;
FImage.LoadFromFile('example.JPG');
Image.Picture.Graphic.Assign(FImage);
FImageCanvas.CreateForImage(FImage);
FImageCanvas.AdjustColorLevels(27.0,252.0,1.0);
Image.Picture.Graphic.Assign(FImage);
end;
Page created in 0.010 seconds with 19 queries.