调整自动裁剪功能

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();
HGImgAutoCropParam autoCropParam;
autoCropParam.normalCrop = HGFALSE;
autoCropParam.dispersion = HGTRUE;
if (isFillBlank)
{
@ -2562,20 +2564,26 @@ void MainWindow::on_act_autoCrop_triggered()
autoCropParam.indent = 5;
}
HGImageInfo imgInfo;
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)
if (isCrop || isDeskew || isFillBlank)
{
m_view->addImage(destImage);
HGBase_DestroyImage(destImage);
m_modify = true;
HGImageInfo imgInfo;
HGBase_GetImageInfo(img, &imgInfo);
updateStatusBarPixelInfo();
updateActionStatus();
HGImage destImage = nullptr;
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();
}
}
}
}