From 50ac4f6cdf46db983b96b3493a4d0e47de55b1cf Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Mon, 7 Aug 2023 16:25:37 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=89=E5=8E=BB=E6=8E=89=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=BC=96=E8=AF=91=E7=9A=84=E5=B7=A5=E7=A8=8B=202?= =?UTF-8?q?=EF=BC=89=E8=B0=83=E6=95=B4=E8=87=AA=E5=AE=9A=E4=B9=89=E6=9B=B2?= =?UTF-8?q?=E7=BA=BF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build2/qt/HGSolutionLinux.pro | 22 +------- build2/qt/HGSolutionWin.pro | 22 +------- modules/twainui/hg_settingdialog.cpp | 76 ++++++++++++---------------- modules/twainui/setpicclrtool.cpp | 46 ++++------------- modules/twainui/setpicclrtool.h | 7 +-- 5 files changed, 46 insertions(+), 127 deletions(-) diff --git a/build2/qt/HGSolutionLinux.pro b/build2/qt/HGSolutionLinux.pro index 7ce1ffef..6ede1716 100644 --- a/build2/qt/HGSolutionLinux.pro +++ b/build2/qt/HGSolutionLinux.pro @@ -10,12 +10,9 @@ SUBDIRS += \ HGVersion \ HGScannerLib \ HGUpload \ - HGWebScan \ HGWebService \ HGUpgrade \ HGFWUpgrade \ - HGScanner \ - HGOCR \ HGScanner2 HGImgFmt.depends = \ @@ -46,11 +43,6 @@ HGScannerLib.depends = \ HGUpload.depends = \ HGBase -HGWebScan.depends = \ - HGBase \ - HGImgFmt \ - HGImgProc - HGWebService.depends = \ HGBase \ HGImgFmt \ @@ -66,21 +58,9 @@ HGFWUpgrade.depends = \ HGImgProc \ HGVersion -HGScanner.depends = \ - HGBase \ - HGImgFmt \ - HGImgProc \ - HGVersion - -HGOCR.depends = \ - HGBase \ - HGImgFmt \ - HGImgProc - HGScanner2.depends = \ HGBase \ HGImgFmt \ HGImgProc \ HGVersion \ - HGSaneUser \ - HGOCR + HGSaneUser diff --git a/build2/qt/HGSolutionWin.pro b/build2/qt/HGSolutionWin.pro index e3d763fb..b56f0498 100644 --- a/build2/qt/HGSolutionWin.pro +++ b/build2/qt/HGSolutionWin.pro @@ -9,12 +9,9 @@ SUBDIRS += \ HGVersion \ HGScannerLib \ HGUpload \ - HGWebScan \ HGWebService \ HGUpgrade \ HGFWUpgrade \ - HGScanner \ - HGOCR \ HGScanner2 HGImgFmt.depends = \ @@ -42,11 +39,6 @@ HGScannerLib.depends = \ HGUpload.depends = \ HGBase -HGWebScan.depends = \ - HGBase \ - HGImgFmt \ - HGImgProc - HGWebService.depends = \ HGBase \ HGImgFmt \ @@ -62,21 +54,9 @@ HGFWUpgrade.depends = \ HGImgProc \ HGVersion -HGScanner.depends = \ - HGBase \ - HGImgFmt \ - HGImgProc \ - HGVersion - -HGOCR.depends = \ - HGBase \ - HGImgFmt \ - HGImgProc - HGScanner2.depends = \ HGBase \ HGImgFmt \ HGImgProc \ HGVersion \ - HGTwainUser \ - HGOCR + HGTwainUser diff --git a/modules/twainui/hg_settingdialog.cpp b/modules/twainui/hg_settingdialog.cpp index 9baf17f7..5bc4c47a 100644 --- a/modules/twainui/hg_settingdialog.cpp +++ b/modules/twainui/hg_settingdialog.cpp @@ -1380,10 +1380,11 @@ void hg_settingdialog::slot_gammaButtonClicked() colorMode = 1; QList keyTable; - for (int i = 0; i < m_gammaData.pt_count; ++i) + for (int i = 0; i < m_gammaData.count[GAMMA_INDEX_GRAY]; ++i) { - QPoint pt(m_gammaData.keypoint[i].x, m_gammaData.keypoint[i].y); - keyTable.append(pt); + uchar x = m_gammaData.pt_gray[i]; + uchar y = m_gammaData.table[256 * GAMMA_INDEX_GRAY + x]; + keyTable.append(QPoint(x, y)); } if (!keyTable.empty()) @@ -1396,31 +1397,35 @@ void hg_settingdialog::slot_gammaButtonClicked() colorMode = 0; QList keyTable; - for (int i = 0; i < m_gammaData.pt_count; ++i) + for (int i = 0; i < m_gammaData.count[GAMMA_INDEX_COLOR]; ++i) { - QPoint pt(m_gammaData.keypoint[i].x, m_gammaData.keypoint[i].y); - keyTable.append(pt); + uchar x = m_gammaData.pt_color[i]; + uchar y = m_gammaData.table[256 * GAMMA_INDEX_COLOR + x]; + keyTable.append(QPoint(x, y)); } QList rKeyTable; - for (int i = 0; i < m_gammaData.pt_count_r; ++i) + for (int i = 0; i < m_gammaData.count[GAMMA_INDEX_RED]; ++i) { - QPoint pt(m_gammaData.keypoint_r[i].x, m_gammaData.keypoint_r[i].y); - rKeyTable.append(pt); + uchar x = m_gammaData.pt_red[i]; + uchar y = m_gammaData.table[256 * GAMMA_INDEX_RED + x]; + rKeyTable.append(QPoint(x, y)); } QList gKeyTable; - for (int i = 0; i < m_gammaData.pt_count_g; ++i) + for (int i = 0; i < m_gammaData.count[GAMMA_INDEX_GREEN]; ++i) { - QPoint pt(m_gammaData.keypoint_g[i].x, m_gammaData.keypoint_g[i].y); - gKeyTable.append(pt); + uchar x = m_gammaData.pt_green[i]; + uchar y = m_gammaData.table[256 * GAMMA_INDEX_GREEN + x]; + gKeyTable.append(QPoint(x, y)); } QList bKeyTable; - for (int i = 0; i < m_gammaData.pt_count_b; ++i) + for (int i = 0; i < m_gammaData.count[GAMMA_INDEX_BLUE]; ++i) { - QPoint pt(m_gammaData.keypoint_b[i].x, m_gammaData.keypoint_b[i].y); - bKeyTable.append(pt); + uchar x = m_gammaData.pt_blue[i]; + uchar y = m_gammaData.table[256 * GAMMA_INDEX_BLUE + x]; + bKeyTable.append(QPoint(x, y)); } QVector> keyTableList; @@ -1451,85 +1456,68 @@ void hg_settingdialog::slot_gammaButtonClicked() { QList keyTable = dlg.getGrayKeyTable(); - m_gammaData.pt_count = HGMIN(4, keyTable.size()); + m_gammaData.count[GAMMA_INDEX_GRAY] = HGMIN(4, keyTable.size()); int i = 0; for (QPoint pt : keyTable) { if (i >= 4) break; - m_gammaData.keypoint[i].x = pt.x(); - m_gammaData.keypoint[i].y = pt.y(); + m_gammaData.pt_gray[i] = pt.x(); ++i; } - uchar data[256]; - dlg.getGrayTable(data, 256); - for (int i = 0; i < 256; ++i) - { - m_gammaData.table[i] = data[i]; - } + dlg.getGrayTable(m_gammaData.table, 256); } else { QVector> keyTableList = dlg.getRGBKeyTable(); - m_gammaData.pt_count = HGMIN(4, keyTableList[0].size()); + m_gammaData.count[GAMMA_INDEX_COLOR] = HGMIN(4, keyTableList[0].size()); int i = 0; for (QPoint pt : keyTableList[0]) { if (i >= 4) break; - m_gammaData.keypoint[i].x = pt.x(); - m_gammaData.keypoint[i].y = pt.y(); + m_gammaData.pt_color[i] = pt.x(); ++i; } - m_gammaData.pt_count_r = HGMIN(4, keyTableList[1].size()); + m_gammaData.count[GAMMA_INDEX_RED] = HGMIN(4, keyTableList[1].size()); i = 0; for (QPoint pt : keyTableList[1]) { if (i >= 4) break; - m_gammaData.keypoint_r[i].x = pt.x(); - m_gammaData.keypoint_r[i].y = pt.y(); + m_gammaData.pt_red[i] = pt.x(); ++i; } - m_gammaData.pt_count_g = HGMIN(4, keyTableList[2].size()); + m_gammaData.count[GAMMA_INDEX_GREEN] = HGMIN(4, keyTableList[2].size()); i = 0; for (QPoint pt : keyTableList[2]) { if (i >= 4) break; - m_gammaData.keypoint_g[i].x = pt.x(); - m_gammaData.keypoint_g[i].y = pt.y(); + m_gammaData.pt_green[i] = pt.x(); ++i; } - m_gammaData.pt_count_b = HGMIN(4, keyTableList[3].size()); + m_gammaData.count[GAMMA_INDEX_BLUE] = HGMIN(4, keyTableList[3].size()); i = 0; for (QPoint pt : keyTableList[3]) { if (i >= 4) break; - m_gammaData.keypoint_b[i].x = pt.x(); - m_gammaData.keypoint_b[i].y = pt.y(); + m_gammaData.pt_blue[i] = pt.x(); ++i; } - uchar data[256 * 3]; - dlg.getRGBTable(data, 256 * 3); - for (int i = 0; i < 256; ++i) - { - m_gammaData.table[i] = data[i * 3 + 2]; - m_gammaData.table[i + 256] = data[i * 3 + 1]; - m_gammaData.table[i + 512] = data[i * 3 + 0]; - } + dlg.getRGBTable(m_gammaData.table + 256, 256 * 4); } QVector type = dlg.getRgbAndColorType(); diff --git a/modules/twainui/setpicclrtool.cpp b/modules/twainui/setpicclrtool.cpp index 3e4d249a..ec5c388f 100644 --- a/modules/twainui/setpicclrtool.cpp +++ b/modules/twainui/setpicclrtool.cpp @@ -28,15 +28,18 @@ setPicClrTool::~setPicClrTool() void setPicClrTool::getGrayTable(uchar *table, size_t length) { + if (length != 256) + throw "length is not 256."; + QVector gray = getGrayALLPoint(); - for (size_t i = 0; i < length; i++) - table[i] = static_cast(gray[static_cast(i)]); + for (size_t i = 0; i < 256; i++) + table[i] = static_cast(gray[i]); } void setPicClrTool::getRGBTable(uchar *table, size_t length) { - if (length != 768) - throw "length is not 768."; + if (length != 1024) + throw "length is not 1024."; QVector rgb = getRgbALLPoint(); QVector red = getRedALLPoint(); @@ -46,40 +49,13 @@ void setPicClrTool::getRGBTable(uchar *table, size_t length) for (size_t i = 0; i < 256; i++) { - //if (i == 255) - // int a = 0; - //table member order is B\G\R - table[i * 3 + 0] = static_cast(blue[rgb[static_cast(i)]]); - table[i * 3 + 1] = static_cast(green[rgb[static_cast(i)]]); - table[i * 3 + 2] = static_cast(red[rgb[static_cast(i)]]); + table[i] = static_cast(rgb[i]); + table[256 + i] = static_cast(red[i]); + table[256 * 2 + i] = static_cast(green[i]); + table[256 * 3 + i] = static_cast(blue[i]); } } -//void setPicClrTool::setGrayTable(const uchar *table, size_t length) -//{ -// QVector gray; -// for (size_t i = 0; i < length; i++) -// gray[static_cast(i)] = int(table[i]); -// //ui->widget->setGrayALLPoint(gray); -//} - -//void setPicClrTool::setRGBTable(const uchar *table, size_t length) -//{ -// QVector rgb; -// QVector red; -// QVector green; -// QVector blue; -// for(int i = 0; i < 256; i++){ -// rgb.append(i); -// } -// for (size_t i = 0; i < length; i++){ -// red.append(int(table[i * 3 + 0])); -// green.append(int(table[i * 3 + 1])); -// blue.append(int(table[i * 3 + 2])); -// } - -//} - void setPicClrTool::setColorMode(int colorMode) { QVariant v(6); diff --git a/modules/twainui/setpicclrtool.h b/modules/twainui/setpicclrtool.h index c92a8d71..31fe4e8f 100644 --- a/modules/twainui/setpicclrtool.h +++ b/modules/twainui/setpicclrtool.h @@ -17,12 +17,7 @@ public: ~setPicClrTool(); void getGrayTable(uchar* table, size_t length = 256); - - void getRGBTable(uchar* table, size_t length = 768); - -// void setGrayTable(const uchar* table, size_t length = 256); - -// void setRGBTable(const uchar* table, size_t length = 768); + void getRGBTable(uchar* table, size_t length = 1024); void setColorMode(int colorMode);