| ImageEn, unit imageenproc |
|
TImageEnProc.CreateFromBitmap
Declaration
constructor CreateFromBitmap(Bitmap: TIEBitmap);
constructor CreateFromBitmap(Bitmap: TBitmap);
Description
Creates a new instance of TImageEnProc assigning the property
AttachedIEBitmap or
AttachedBitmap.
Note: Also sets
AutoUndo to
False.
Examples
// Draw text onto a TBitmap or TIEBitmap
proc := TImageEnProc.CreateFromBitmap(myBitmap);
proc.TextOut(Align_Text_Horz_Center, Align_Text_Near_Bottom, 'Me in Italy - 2015', 'Arial', 32, clRed, [fsBold]);
proc.Free();
// Load an image with a TBitmap, make it negative then save it
bmp := TBitmap.Create();
bmp.LoadFromFile('D:\Image.bmp');
proc := TImageEnProc.CreateFromBitmap( bmp );
proc.Negative();
proc.Free();
bmp.SaveToFile('D:\output.bmp');
bmp.Free();
// Load an image rotate it 270 deg. clockwise and then save it
bmp := TIEBitmap.Create();
bmp.LoadFromFile('D:\Image.jpeg');
proc := TImageEnProc.CreateFromBitmap( bmp );
proc.Rotate(90);
proc.Free();
bmp.SaveToFile('D:\output.jpeg');
bmp.Free();
// Deskew all selected scanned documents
ImageEnMView1.LockUpdate();
try
for i := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
begin
selIdx := ImageEnMView1.MultiSelectedImages[i];
bmp := ImageEnMView1.GetTIEBitmap( selIdx );
try
proc := TImageEnProc.CreateFromBitmap( bmp );
try
nAngle := proc.SkewDetection();
proc.RotateAndCrop( nAngle, ierBilinear, bmp.Height / bmp.Width, iecaSkewedDocument );
finally
FreeAndNil( proc );
end;
finally
ImageEnMView1.ReleaseBitmap( selIdx, True );
end;
end;
finally
ImageEnMView1.UnlockUpdate();
end;