调整自动裁剪功能

This commit is contained in:
yangjiaxuan 2022-10-19 11:14:07 +08:00
parent cf64d5de55
commit ecc0231097
1 changed files with 20 additions and 12 deletions

View File

@ -2537,6 +2537,8 @@ void MainWindow::on_act_autoCrop_triggered()
int indent = dlg.getIndent(); int indent = dlg.getIndent();
HGImgAutoCropParam autoCropParam; HGImgAutoCropParam autoCropParam;
autoCropParam.normalCrop = HGFALSE;
autoCropParam.dispersion = HGTRUE;
if (isFillBlank) if (isFillBlank)
{ {
@ -2562,20 +2564,26 @@ void MainWindow::on_act_autoCrop_triggered()
autoCropParam.indent = 5; autoCropParam.indent = 5;
} }
HGImageInfo imgInfo; if (isCrop || isDeskew || isFillBlank)
HGBase_GetImageInfo(img, &imgInfo);
HGImage destImage = nullptr;
HGImgProc_ImageAutoCrop(img, (HGBool)isCrop, (HGBool)isDeskew, (HGBool)isFillBlank, &autoCropParam, imgInfo.width, imgInfo.height,
imgInfo.type, HGBASE_IMGORIGIN_TOP, &destImage);
if (nullptr != destImage)
{ {
m_view->addImage(destImage); HGImageInfo imgInfo;
HGBase_DestroyImage(destImage); HGBase_GetImageInfo(img, &imgInfo);
m_modify = true;
updateStatusBarPixelInfo(); HGImage destImage = nullptr;
updateActionStatus(); HGUInt destWidth = imgInfo.width;
HGUInt destHeight = imgInfo.height;
HGImgProc_ImageAutoCrop(img, (HGBool)isCrop, (HGBool)isDeskew, (HGBool)isFillBlank, &autoCropParam, destWidth, destHeight,
imgInfo.type, HGBASE_IMGORIGIN_TOP, &destImage);
if (nullptr != destImage)
{
m_view->addImage(destImage);
HGBase_DestroyImage(destImage);
m_modify = true;
updateStatusBarPixelInfo();
updateActionStatus();
}
} }
} }
} }