|
@@ -118,6 +118,7 @@ type
|
|
|
procedure btnSavePictureClick(Sender: TObject);
|
|
procedure btnSavePictureClick(Sender: TObject);
|
|
|
procedure btnSetAspectRatioClick(Sender: TObject);
|
|
procedure btnSetAspectRatioClick(Sender: TObject);
|
|
|
procedure edNameChange(Sender: TObject);
|
|
procedure edNameChange(Sender: TObject);
|
|
|
|
|
+ procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
|
procedure KeepAspectRatioClick(Sender: TObject);
|
|
procedure KeepAspectRatioClick(Sender: TObject);
|
|
|
|
|
|
|
|
procedure btBox_AddClick(Sender: TObject);
|
|
procedure btBox_AddClick(Sender: TObject);
|
|
@@ -139,7 +140,7 @@ type
|
|
|
private
|
|
private
|
|
|
{ private declarations }
|
|
{ private declarations }
|
|
|
lastNewBoxNum :Word;
|
|
lastNewBoxNum :Word;
|
|
|
- changingAspect:Boolean;
|
|
|
|
|
|
|
+ changingAspect, closing:Boolean;
|
|
|
|
|
|
|
|
procedure FillBoxUI(ABox :TCropArea);
|
|
procedure FillBoxUI(ABox :TCropArea);
|
|
|
procedure SaveCallBack(Bitmap :TBGRABitmap; CropArea: TCropArea);
|
|
procedure SaveCallBack(Bitmap :TBGRABitmap; CropArea: TCropArea);
|
|
@@ -170,11 +171,11 @@ begin
|
|
|
// Finally, associate the image into component
|
|
// Finally, associate the image into component
|
|
|
BGRAImageManipulation.Bitmap := Bitmap;
|
|
BGRAImageManipulation.Bitmap := Bitmap;
|
|
|
Bitmap.Free;
|
|
Bitmap.Free;
|
|
|
- edLeft.MaxValue:=BGRAImageManipulation.Width;
|
|
|
|
|
- edTop.MaxValue:=BGRAImageManipulation.Height;
|
|
|
|
|
- edWidth.MaxValue:=BGRAImageManipulation.Width;
|
|
|
|
|
- edHeight.MaxValue:=BGRAImageManipulation.Height;
|
|
|
|
|
- BGRAImageManipulation.addCropArea(Rect(0,0,120,160));
|
|
|
|
|
|
|
+ edLeft.MaxValue:=BGRAImageManipulation.Bitmap.Width;
|
|
|
|
|
+ edTop.MaxValue:=BGRAImageManipulation.Bitmap.Height;
|
|
|
|
|
+ edWidth.MaxValue:=BGRAImageManipulation.Bitmap.Width;
|
|
|
|
|
+ edHeight.MaxValue:=BGRAImageManipulation.Bitmap.Height;
|
|
|
|
|
+ BGRAImageManipulation.addCropArea(Rect(100,100,220,260));
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
@@ -230,8 +231,8 @@ begin
|
|
|
// Compress
|
|
// Compress
|
|
|
JpegImage := TJpegImage.Create;
|
|
JpegImage := TJpegImage.Create;
|
|
|
if (chkFullSize.Checked)
|
|
if (chkFullSize.Checked)
|
|
|
- then JpegImage.Assign(BGRAImageManipulation.getBitmapFullSize)
|
|
|
|
|
- else JpegImage.Assign(BGRAImageManipulation.getBitmap);
|
|
|
|
|
|
|
+ then JpegImage.Assign(BGRAImageManipulation.getBitmap)
|
|
|
|
|
+ else JpegImage.Assign(BGRAImageManipulation.getResampledBitmap);
|
|
|
JpegImage.CompressionQuality := RateCompression.Position;
|
|
JpegImage.CompressionQuality := RateCompression.Position;
|
|
|
|
|
|
|
|
// And save to file
|
|
// And save to file
|
|
@@ -264,8 +265,8 @@ begin
|
|
|
if SelectDirectoryDialog1.Execute then
|
|
if SelectDirectoryDialog1.Execute then
|
|
|
begin
|
|
begin
|
|
|
if (chkFullSize.Checked)
|
|
if (chkFullSize.Checked)
|
|
|
- then Self.BGRAImageManipulation.getAllBitmapsFullSize(@SaveCallBack)
|
|
|
|
|
- else Self.BGRAImageManipulation.getAllBitmaps(@SaveCallBack);
|
|
|
|
|
|
|
+ then Self.BGRAImageManipulation.getAllBitmaps(@SaveCallBack)
|
|
|
|
|
+ else Self.BGRAImageManipulation.getAllResampledBitmaps(@SaveCallBack);
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
@@ -291,6 +292,12 @@ begin
|
|
|
CropArea.Name :=edName.Text;
|
|
CropArea.Name :=edName.Text;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+procedure TFormBGRAImageManipulationDemo.FormCloseQuery(Sender: TObject;
|
|
|
|
|
+ var CanClose: Boolean);
|
|
|
|
|
+begin
|
|
|
|
|
+ closing :=True;
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
procedure TFormBGRAImageManipulationDemo.KeepAspectRatioClick(Sender: TObject);
|
|
procedure TFormBGRAImageManipulationDemo.KeepAspectRatioClick(Sender: TObject);
|
|
|
begin
|
|
begin
|
|
|
BGRAImageManipulation.KeepAspectRatio := KeepAspectRatio.Checked;
|
|
BGRAImageManipulation.KeepAspectRatio := KeepAspectRatio.Checked;
|
|
@@ -381,6 +388,7 @@ var
|
|
|
i :Integer;
|
|
i :Integer;
|
|
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
|
+ closing :=False;
|
|
|
changingAspect :=False;
|
|
changingAspect :=False;
|
|
|
lastNewBoxNum :=0;
|
|
lastNewBoxNum :=0;
|
|
|
TStringList(cbBoxList.Items).OwnsObjects:=False;
|
|
TStringList(cbBoxList.Items).OwnsObjects:=False;
|
|
@@ -433,9 +441,12 @@ var
|
|
|
delIndex :Integer;
|
|
delIndex :Integer;
|
|
|
begin
|
|
begin
|
|
|
try
|
|
try
|
|
|
- delIndex :=cbBoxList.Items.IndexOfObject(CropArea);
|
|
|
|
|
- if (delIndex<>-1)
|
|
|
|
|
- then cbBoxList.Items.Delete(delIndex);
|
|
|
|
|
|
|
+ if not(closing) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ delIndex :=cbBoxList.Items.IndexOfObject(CropArea);
|
|
|
|
|
+ if (delIndex<>-1)
|
|
|
|
|
+ then cbBoxList.Items.Delete(delIndex);
|
|
|
|
|
+ end;
|
|
|
except
|
|
except
|
|
|
end;
|
|
end;
|
|
|
//MessageDlg('Deleting Crop Area', 'Deleting '+CropArea.Name, mtInformation, [mbOk], 0);
|
|
//MessageDlg('Deleting Crop Area', 'Deleting '+CropArea.Name, mtInformation, [mbOk], 0);
|