Hi,
I've been experimenting with ImageEn for a few days now and I'm really impressed of its functionality!
Right now I'm implementing a trackbar to adjust the contrast and I'm not sure I'm applying it correctly. The trackbar should adjust the contrast of the loaded image in real-time, which works properly.
Info: In order to optimize the performance, I first resize the image to match the TImageEnView's dimensions.
Here is the source code:
procedure TForm1.FormCreate(Sender: TObject);
begin
ImageEnView1.IO.LoadFromFile('C:\Temp\Test\20190911_160859.jpg');
ImageEnView1.IEBitmap.Resample(ImageEnView1w.Width, ImageEnView1.Height, rfFastLinear, true, true);
end;
procedure TForm1.TrackBar1Changing(Sender: TObject; NewPos: Integer;
var AllowChange: Boolean);
begin
ImageEnView1.Proc.Undo();
ImageEnView1.Proc.ClearUndo;
ImageEnView1.Proc.ClearRedo;
ImageEnView1.Proc.AdjustBrightnessContrastSaturation(0, NewPos, 0);
end;
Since I want to adjust the original image's contrast (not the contrast of changed image), I use Proc.Undo to "reset" the image and ClearRedo to keep the memory clean. Is there a better way than using Undo maybe?
Thanks in advance!
Kind regards
Andreas