├── resources ├── win32 │ ├── resources.rc │ └── icon.ico └── icons │ ├── file-16.png │ ├── minus-16.png │ ├── plus-16.png │ ├── stop-big.png │ ├── undo-22.png │ ├── folder-16.png │ ├── play-small.png │ ├── two_pages.png │ ├── user-trash.png │ ├── appicon-about.png │ ├── aqua-sphere.png │ ├── big-up-arrow.png │ ├── keep-in-view.png │ ├── trashed-big.png │ ├── trashed-small.png │ ├── untrash-big.png │ ├── big-down-arrow.png │ ├── big-left-arrow.png │ ├── big-right-arrow.png │ ├── insert-after-16.png │ ├── insert-here-16.png │ ├── left_page_thumb.png │ ├── stock-center-24.png │ ├── stock-vchain-24.png │ ├── insert-before-16.png │ ├── layout_type_auto.png │ ├── object-rotate-left.png │ ├── play-small-hovered.png │ ├── play-small-pressed.png │ ├── right_page_thumb.png │ ├── single_page_uncut.png │ ├── stop-big-hovered.png │ ├── stop-big-pressed.png │ ├── two_pages_selected.png │ ├── despeckle-normal.png.png │ ├── object-rotate-right.png │ ├── despeckle-cautious.png.png │ ├── left_page_plus_offcut.png │ ├── right_page_plus_offcut.png │ ├── stock-gravity-east-24.png │ ├── stock-gravity-north-24.png │ ├── stock-gravity-south-24.png │ ├── stock-gravity-west-24.png │ ├── stock-vchain-broken-24.png │ ├── despeckle-aggressive.png.png │ ├── single_page_uncut_selected.png │ ├── stock-gravity-north-east-24.png │ ├── stock-gravity-north-west-24.png │ ├── stock-gravity-south-east-24.png │ ├── stock-gravity-south-west-24.png │ ├── left_page_plus_offcut_selected.png │ └── right_page_plus_offcut_selected.png ├── ui └── CMakeLists.txt ├── crash_reporter ├── ui │ └── CMakeLists.txt └── MultipartFormData.h ├── .gitignore ├── packaging ├── osx │ ├── ScanTailor.icns │ ├── Info.plist.in │ └── makeapp.sh └── windows │ ├── patch_libtiff │ ├── apply_individual_patches.cmake.in │ └── CMakeLists.txt │ └── build_deps │ ├── dump_dll_syms.cmake │ └── generate_qt_build_script.cmake ├── math ├── adiff │ ├── references.txt │ └── tests │ │ └── CMakeLists.txt ├── spfit │ ├── references.txt │ ├── tests │ │ └── CMakeLists.txt │ ├── FrenetFrame.cpp │ ├── ModelShape.h │ └── OptimizationResult.cpp ├── LinearSolver.cpp ├── LineBoundedByRect.h ├── SidesOfLine.cpp ├── LineIntersectionScalar.h └── SidesOfLine.h ├── cmake ├── ToNativePath.cmake ├── default_cflags.cmake ├── default_cxxflags.cmake ├── SetDefaultBuildType.cmake ├── move_sym_file.cmake ├── copy_to_build_dir.cmake.in └── LibToDLL.cmake ├── config.h.in ├── COPYING ├── tests ├── CMakeLists.txt └── main.cpp ├── dewarping ├── CMakeLists.txt └── RasterDewarper.h ├── interaction └── CMakeLists.txt ├── filters ├── fix_orientation │ ├── CMakeLists.txt │ └── ImageView.h ├── deskew │ ├── CMakeLists.txt │ └── Thumbnail.h ├── page_layout │ ├── CMakeLists.txt │ ├── OrderByWidthProvider.h │ └── OrderByHeightProvider.h ├── output │ ├── FillZonePropFactory.cpp │ ├── PictureZonePropFactory.cpp │ ├── FillZonePropFactory.h │ ├── ImageViewTab.h │ ├── PictureZonePropFactory.h │ ├── Thumbnail.cpp │ ├── DespeckleLevel.h │ ├── FillZoneComparator.h │ ├── PictureZoneComparator.h │ ├── Utils.h │ ├── DewarpingMode.h │ ├── Thumbnail.h │ ├── ImageView.h │ ├── OutputMargins.h │ ├── DewarpingMode.cpp │ ├── ImageView.cpp │ ├── PictureZonePropDialog.h │ ├── TabbedImageView.h │ └── DepthPerception.h ├── select_content │ ├── CMakeLists.txt │ ├── PhysSizeCalc.h │ ├── OrderByWidthProvider.h │ ├── OrderByHeightProvider.h │ ├── PhysSizeCalc.cpp │ └── PhysContentSizeCalc.cpp └── page_split │ ├── CMakeLists.txt │ ├── LayoutType.h │ └── OrderBySplitTypeProvider.h ├── FilterOptionsWidget.cpp ├── foundation ├── CMakeLists.txt ├── PerformanceTimer.h ├── NonCopyable.h ├── Property.h ├── ScopedDecInc.h ├── ScopedIncDec.h ├── QtSignalForwarder.cpp ├── PerformanceTimer.cpp ├── PropertyFactory.cpp ├── GridLineTraverser.h ├── PropertyFactory.h └── RefCountable.h ├── zones ├── CMakeLists.txt ├── SplineSegment.cpp └── SplineSegment.h ├── imageproc ├── tests │ ├── CMakeLists.txt │ ├── main.cpp │ └── TestBinarize.cpp ├── ByteOrder.h ├── BWColor.h ├── Connectivity.h ├── GrayImage.cpp ├── ColorInterpolation.h ├── Constants.cpp ├── Scale.h ├── ColorInterpolation.cpp ├── LeastSquaresFit.h └── MorphGradientDetect.cpp ├── PageView.h ├── BeforeOrAfter.h ├── AutoManualMode.h ├── version.h ├── OpenGLSupport.h ├── filter_dc ├── AbstractFilterDataCollector.h ├── PageOrientationCollector.h ├── ContentBoxCollector.h └── ThumbnailCollector.h ├── TaskStatus.h ├── Application.h ├── BackgroundTask.cpp ├── PageRange.h ├── NonOwningWidget.cpp ├── ImageFileInfo.cpp ├── RelinkingSortingModel.h ├── ImageLoader.h ├── SettingsDialog.h ├── PayloadEvent.h ├── NonOwningWidget.h ├── CompositeCacheDrivenTask.h ├── PhysicalTransformation.cpp ├── PhysicalTransformation.h ├── ErrorWidget.h ├── ImageInfo.cpp ├── Application.cpp ├── PageInfo.cpp ├── ErrorWidget.cpp ├── PageSelectionProvider.h ├── AbstractRelinker.h ├── SelectedPage.cpp ├── TiffMetadataLoader.cpp ├── compat └── QAtomicInt ├── FilterData.cpp ├── SystemLoadWidget.h ├── BasicImageView.h ├── NewOpenProjectPanel.h ├── PageSelectionAccessor.cpp ├── LoadFilesStatusDialog.h ├── PageOrderProvider.h ├── BasicImageView.cpp ├── ImagePixmapUnion.h ├── PageSequence.h ├── PngMetadataLoader.h ├── RelinkingListView.h ├── JpegMetadataLoader.h ├── TiffMetadataLoader.h ├── Dpi.cpp ├── OpenGLSupport.cpp ├── FilterResult.h ├── PageRange.cpp ├── PageSelectionAccessor.h ├── SmartFilenameOrdering.h ├── ImageFileInfo.h ├── TabbedDebugImages.cpp ├── AbstractCommand.h ├── Dpi.h ├── PageOrderOption.h └── TabbedDebugImages.h /resources/win32/resources.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "icon.ico" -------------------------------------------------------------------------------- /ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 2 | -------------------------------------------------------------------------------- /crash_reporter/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user* 2 | CMakeFiles 3 | *.qm 4 | *.h.moc 5 | build/ 6 | *~ 7 | -------------------------------------------------------------------------------- /resources/win32/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/win32/icon.ico -------------------------------------------------------------------------------- /resources/icons/file-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/file-16.png -------------------------------------------------------------------------------- /resources/icons/minus-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/minus-16.png -------------------------------------------------------------------------------- /resources/icons/plus-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/plus-16.png -------------------------------------------------------------------------------- /resources/icons/stop-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stop-big.png -------------------------------------------------------------------------------- /resources/icons/undo-22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/undo-22.png -------------------------------------------------------------------------------- /packaging/osx/ScanTailor.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/packaging/osx/ScanTailor.icns -------------------------------------------------------------------------------- /resources/icons/folder-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/folder-16.png -------------------------------------------------------------------------------- /resources/icons/play-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/play-small.png -------------------------------------------------------------------------------- /resources/icons/two_pages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/two_pages.png -------------------------------------------------------------------------------- /resources/icons/user-trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/user-trash.png -------------------------------------------------------------------------------- /resources/icons/appicon-about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/appicon-about.png -------------------------------------------------------------------------------- /resources/icons/aqua-sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/aqua-sphere.png -------------------------------------------------------------------------------- /resources/icons/big-up-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/big-up-arrow.png -------------------------------------------------------------------------------- /resources/icons/keep-in-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/keep-in-view.png -------------------------------------------------------------------------------- /resources/icons/trashed-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/trashed-big.png -------------------------------------------------------------------------------- /resources/icons/trashed-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/trashed-small.png -------------------------------------------------------------------------------- /resources/icons/untrash-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/untrash-big.png -------------------------------------------------------------------------------- /resources/icons/big-down-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/big-down-arrow.png -------------------------------------------------------------------------------- /resources/icons/big-left-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/big-left-arrow.png -------------------------------------------------------------------------------- /resources/icons/big-right-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/big-right-arrow.png -------------------------------------------------------------------------------- /resources/icons/insert-after-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/insert-after-16.png -------------------------------------------------------------------------------- /resources/icons/insert-here-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/insert-here-16.png -------------------------------------------------------------------------------- /resources/icons/left_page_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/left_page_thumb.png -------------------------------------------------------------------------------- /resources/icons/stock-center-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-center-24.png -------------------------------------------------------------------------------- /resources/icons/stock-vchain-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-vchain-24.png -------------------------------------------------------------------------------- /resources/icons/insert-before-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/insert-before-16.png -------------------------------------------------------------------------------- /resources/icons/layout_type_auto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/layout_type_auto.png -------------------------------------------------------------------------------- /resources/icons/object-rotate-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/object-rotate-left.png -------------------------------------------------------------------------------- /resources/icons/play-small-hovered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/play-small-hovered.png -------------------------------------------------------------------------------- /resources/icons/play-small-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/play-small-pressed.png -------------------------------------------------------------------------------- /resources/icons/right_page_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/right_page_thumb.png -------------------------------------------------------------------------------- /resources/icons/single_page_uncut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/single_page_uncut.png -------------------------------------------------------------------------------- /resources/icons/stop-big-hovered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stop-big-hovered.png -------------------------------------------------------------------------------- /resources/icons/stop-big-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stop-big-pressed.png -------------------------------------------------------------------------------- /resources/icons/two_pages_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/two_pages_selected.png -------------------------------------------------------------------------------- /resources/icons/despeckle-normal.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/despeckle-normal.png.png -------------------------------------------------------------------------------- /resources/icons/object-rotate-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/object-rotate-right.png -------------------------------------------------------------------------------- /resources/icons/despeckle-cautious.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/despeckle-cautious.png.png -------------------------------------------------------------------------------- /resources/icons/left_page_plus_offcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/left_page_plus_offcut.png -------------------------------------------------------------------------------- /resources/icons/right_page_plus_offcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/right_page_plus_offcut.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-east-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-east-24.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-north-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-north-24.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-south-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-south-24.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-west-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-west-24.png -------------------------------------------------------------------------------- /resources/icons/stock-vchain-broken-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-vchain-broken-24.png -------------------------------------------------------------------------------- /resources/icons/despeckle-aggressive.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/despeckle-aggressive.png.png -------------------------------------------------------------------------------- /resources/icons/single_page_uncut_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/single_page_uncut_selected.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-north-east-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-north-east-24.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-north-west-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-north-west-24.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-south-east-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-south-east-24.png -------------------------------------------------------------------------------- /resources/icons/stock-gravity-south-west-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/stock-gravity-south-west-24.png -------------------------------------------------------------------------------- /resources/icons/left_page_plus_offcut_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/left_page_plus_offcut_selected.png -------------------------------------------------------------------------------- /resources/icons/right_page_plus_offcut_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tulon/scantailor/HEAD/resources/icons/right_page_plus_offcut_selected.png -------------------------------------------------------------------------------- /math/adiff/references.txt: -------------------------------------------------------------------------------- 1 | [1] C. H. Bischof, G. F. Corliss, and A. Griewank. Structured second- and 2 | higher-order derivatives through univariate Taylor series. 3 | http://softlib.rice.edu/pub/CRPC-TRs/reports/CRPC-TR92237.pdf -------------------------------------------------------------------------------- /cmake/ToNativePath.cmake: -------------------------------------------------------------------------------- 1 | # This macro exists because FILE(TO_NATIVE_PATH ...) is broken on MinGW. 2 | MACRO(TO_NATIVE_PATH PATH OUT) 3 | FILE(TO_NATIVE_PATH "${PATH}" "${OUT}") 4 | IF(MINGW) 5 | STRING(REPLACE "/" "\\" "${OUT}" "${${OUT}}") 6 | ENDIF(MINGW) 7 | ENDMACRO(TO_NATIVE_PATH) 8 | -------------------------------------------------------------------------------- /cmake/default_cflags.cmake: -------------------------------------------------------------------------------- 1 | IF(MSVC) 2 | # If we want reliable stack traces, we need /Oy- 3 | # We do it only for RelWithDebInfo, because configuration is used with 4 | # the built-in crash reporter. 5 | SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG /Oy-") 6 | ENDIF() 7 | -------------------------------------------------------------------------------- /cmake/default_cxxflags.cmake: -------------------------------------------------------------------------------- 1 | IF(MSVC) 2 | # If we want reliable stack traces, we need /Oy- 3 | # We do it only for RelWithDebInfo, because configuration is used with 4 | # the built-in crash reporter. 5 | SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG /Oy-") 6 | ENDIF() 7 | -------------------------------------------------------------------------------- /packaging/windows/patch_libtiff/apply_individual_patches.cmake.in: -------------------------------------------------------------------------------- 1 | FILE(STRINGS "@TIFF_DIR@/debian/patches/series" patch_list) 2 | 3 | FOREACH(patch_file ${patch_list}) 4 | EXECUTE_PROCESS( 5 | COMMAND "@PATCH_EXE@" -p1 --binary -i 6 | "@TIFF_DIR@/debian/patches/${patch_file}" 7 | WORKING_DIRECTORY "@TIFF_DIR@" 8 | ) 9 | ENDFOREACH(patch_file) 10 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* This file is a template for config.h, for use with CMake. */ 2 | 3 | #ifndef SCANTAILOR_CONFIG_H_ 4 | #define SCANTAILOR_CONFIG_H_ 5 | 6 | #define TRANSLATIONS_DIR_REL "@TRANSLATIONS_DIR_REL@" 7 | #define TRANSLATIONS_DIR_ABS "@TRANSLATIONS_DIR_ABS@" 8 | 9 | #cmakedefine ENABLE_CRASH_REPORTER 10 | #cmakedefine ENABLE_OPENGL 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /cmake/SetDefaultBuildType.cmake: -------------------------------------------------------------------------------- 1 | MACRO(ST_SET_DEFAULT_BUILD_TYPE TYPE_) 2 | IF(NOT CMAKE_BUILD_TYPE AND NOT DEFAULT_BUILD_TYPE_SET) 3 | SET(DEFAULT_BUILD_TYPE_SET TRUE CACHE INTERNAL "" FORCE) 4 | SET( 5 | CMAKE_BUILD_TYPE "${TYPE_}" CACHE STRING 6 | "Build type (Release Debug RelWithDebInfo MinSizeRel)" FORCE 7 | ) 8 | ENDIF(NOT CMAKE_BUILD_TYPE AND NOT DEFAULT_BUILD_TYPE_SET) 9 | ENDMACRO(ST_SET_DEFAULT_BUILD_TYPE) 10 | -------------------------------------------------------------------------------- /math/spfit/references.txt: -------------------------------------------------------------------------------- 1 | [1] Pottmann H, Leopoldseder S. A concept for parametric surface fitting which 2 | avoids the parametrization problem. 3 | http://scholar.google.com/scholar?cluster=7639013126651979063&hl=en&as_sdt=0,5&as_vis=1 4 | 5 | [2] W. Wang, H. Pottmann, Y. Liu, Fitting B-spline curves to point clouds by 6 | squared distance minimization. 7 | http://scholar.google.com/scholar?cluster=5549848162867282704&hl=en&as_sdt=0,5&as_vis=1 -------------------------------------------------------------------------------- /math/adiff/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | ${CMAKE_SOURCE_DIR}/tests/main.cpp 6 | TestHessians.cpp 7 | ) 8 | 9 | SOURCE_GROUP("Sources" FILES ${sources}) 10 | 11 | SET( 12 | libs 13 | math ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 14 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} 15 | ${QT_QTCORE_LIBRARY} ${EXTRA_LIBS} 16 | ) 17 | 18 | ADD_EXECUTABLE(adiff_tests ${sources}) 19 | TARGET_LINK_LIBRARIES(adiff_tests ${libs}) 20 | -------------------------------------------------------------------------------- /math/spfit/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | ${CMAKE_SOURCE_DIR}/tests/main.cpp 6 | TestSqDistApproximant.cpp 7 | ) 8 | 9 | SOURCE_GROUP("Sources" FILES ${sources}) 10 | 11 | SET( 12 | libs 13 | math ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 14 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} 15 | ${QT_QTCORE_LIBRARY} ${EXTRA_LIBS} 16 | ) 17 | 18 | ADD_EXECUTABLE(spfit_tests ${sources}) 19 | TARGET_LINK_LIBRARIES(spfit_tests ${libs}) 20 | -------------------------------------------------------------------------------- /cmake/move_sym_file.cmake: -------------------------------------------------------------------------------- 1 | FILE(STRINGS "${SYMBOLS_PATH}/temp.sym" first_line LIMIT_COUNT 1) 2 | SEPARATE_ARGUMENTS(first_line) 3 | LIST(GET first_line 3 module_id) 4 | LIST(GET first_line 4 module_name_pdb) 5 | STRING( 6 | REGEX REPLACE "(.*)\\.pdb" "\\1.sym" 7 | module_name_sym "${module_name_pdb}" 8 | ) 9 | CONFIGURE_FILE( 10 | "${SYMBOLS_PATH}/temp.sym" 11 | "${SYMBOLS_PATH}/${module_name_pdb}/${module_id}/${module_name_sym}" 12 | COPYONLY 13 | ) 14 | FILE(REMOVE "${SYMBOLS_PATH}/temp.sym") 15 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Scan Tailor is free software: you can redistribute it and/or modify 2 | it under the terms of the GNU General Public License as published by 3 | the Free Software Foundation, either version 3 of the License, or 4 | (at your option) any later version. 5 | 6 | The GNU General Public License version 3 can be found in GPL3.txt 7 | 8 | Some parts of the program are licensed under different, but compatible 9 | with GPL3 terms. For more details, see: 10 | 11 | boost/LICENSE_1_0.txt 12 | resources/icons/COPYING -------------------------------------------------------------------------------- /packaging/windows/build_deps/dump_dll_syms.cmake: -------------------------------------------------------------------------------- 1 | # We are operating on files from the current directory. 2 | FILE(GLOB DLL_FILES "*.dll" "*.DLL") 3 | FOREACH(dll_file ${DLL_FILES}) 4 | MESSAGE(STATUS "Dumping symbols from ${dll_file}") 5 | EXECUTE_PROCESS( 6 | COMMAND "${DUMP_SYMS_EXECUTABLE}" "${dll_file}" 7 | OUTPUT_FILE "${SYMBOLS_PATH}/temp.sym" 8 | ) 9 | EXECUTE_PROCESS( 10 | COMMAND "${CMAKE_COMMAND}" "-DSYMBOLS_PATH=${SYMBOLS_PATH}" 11 | -P "${MOVE_SYMBOLS_SCRIPT}" 12 | ) 13 | ENDFOREACH() 14 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | main.cpp TestContentSpanFinder.cpp 6 | TestSmartFilenameOrdering.cpp 7 | TestMatrixCalc.cpp 8 | ../ContentSpanFinder.cpp ../ContentSpanFinder.h 9 | ../SmartFilenameOrdering.cpp ../SmartFilenameOrdering.h 10 | ) 11 | 12 | SOURCE_GROUP("Sources" FILES ${sources}) 13 | 14 | SET( 15 | libs 16 | imageproc math ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 17 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} 18 | ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${EXTRA_LIBS} 19 | ) 20 | 21 | ADD_EXECUTABLE(tests ${sources}) 22 | TARGET_LINK_LIBRARIES(tests ${libs}) 23 | -------------------------------------------------------------------------------- /dewarping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Dewarping library") 2 | 3 | SET( 4 | sources 5 | Curve.cpp Curve.h 6 | DistortionModel.cpp DistortionModel.h 7 | DistortionModelBuilder.cpp DistortionModelBuilder.h 8 | DetectVertContentBounds.cpp DetectVertContentBounds.h 9 | TowardsLineTracer.cpp TowardsLineTracer.h 10 | TextLineTracer.cpp TextLineTracer.h 11 | TextLineRefiner.cpp TextLineRefiner.h 12 | TopBottomEdgeTracer.cpp TopBottomEdgeTracer.h 13 | CylindricalSurfaceDewarper.cpp CylindricalSurfaceDewarper.h 14 | DewarpingPointMapper.cpp DewarpingPointMapper.h 15 | RasterDewarper.cpp RasterDewarper.h 16 | ) 17 | SOURCE_GROUP("Sources" FILES ${sources}) 18 | 19 | ADD_LIBRARY(dewarping STATIC ${sources}) 20 | -------------------------------------------------------------------------------- /interaction/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(interaction) 2 | 3 | INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | DraggableObject.h 8 | DraggablePoint.cpp DraggablePoint.h 9 | DraggableLineSegment.cpp DraggableLineSegment.h 10 | ObjectDragHandler.cpp ObjectDragHandler.h 11 | InteractionHandler.cpp InteractionHandler.h 12 | InteractionState.cpp InteractionState.h 13 | DragHandler.cpp DragHandler.h 14 | DragWatcher.cpp DragWatcher.h 15 | ZoomHandler.cpp ZoomHandler.h 16 | InteractiveXSpline.cpp InteractiveXSpline.h 17 | ) 18 | 19 | SOURCE_GROUP(Sources FILES ${sources}) 20 | QT4_AUTOMOC(${sources}) 21 | 22 | ADD_LIBRARY(interaction STATIC ${sources}) 23 | 24 | TRANSLATION_SOURCES(scantailor ${sources}) -------------------------------------------------------------------------------- /filters/fix_orientation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Fix Orientation Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | FILE(GLOB ui_files "ui/*.ui") 6 | QT4_WRAP_UI(ui_sources ${ui_files}) 7 | SET_SOURCE_FILES_PROPERTIES(${ui_sources} PROPERTIES GENERATED TRUE) 8 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 9 | SOURCE_GROUP("Generated" FILES ${ui_sources}) 10 | 11 | SET( 12 | sources 13 | ImageView.cpp ImageView.h 14 | Filter.cpp Filter.h 15 | OptionsWidget.cpp OptionsWidget.h 16 | ApplyDialog.cpp ApplyDialog.h 17 | Settings.cpp Settings.h 18 | Task.cpp Task.h 19 | CacheDrivenTask.cpp CacheDrivenTask.h 20 | ) 21 | SOURCE_GROUP("Sources" FILES ${sources}) 22 | QT4_AUTOMOC(${sources}) 23 | 24 | ADD_LIBRARY(fix_orientation STATIC ${sources} ${ui_sources}) 25 | 26 | TRANSLATION_SOURCES(scantailor ${sources} ${ui_files}) -------------------------------------------------------------------------------- /packaging/windows/build_deps/generate_qt_build_script.cmake: -------------------------------------------------------------------------------- 1 | FILE( 2 | WRITE "${TARGET_FILE}" 3 | "configure -platform ${PLATFORM} -debug-and-release -shared -fast" 4 | " -no-gif -system-zlib -system-libpng -no-libmng -no-libtiff -system-libjpeg" 5 | " -no-openssl -no-qt3support -no-style-plastique -no-style-cleanlooks" 6 | " -no-style-motif -no-style-cde -qt-style-windowsxp -qt-style-windowsvista" 7 | " -no-phonon -no-webkit -no-script -no-scripttools -no-declarative" 8 | " -nomake examples -nomake demos -nomake docs" 9 | " ${MAYBE_SKIP_TOOLS}" 10 | " -opensource -confirm-license -no-ltcg" 11 | " -I \"${JPEG_INCLUDE_DIR}\" -I \"${ZLIB_INCLUDE_DIR}\"" 12 | " -I \"${PNG_INCLUDE_DIR}\" -L \"${JPEG_LINK_DIR}\" -L \"${ZLIB_LINK_DIR}\"" 13 | " -L \"${PNG_LINK_DIR}\"" 14 | " -D _BIND_TO_CURRENT_VCLIBS_VERSION=1" 15 | "\n" 16 | "${MAKE_COMMAND}\n" 17 | ) 18 | -------------------------------------------------------------------------------- /cmake/copy_to_build_dir.cmake.in: -------------------------------------------------------------------------------- 1 | SET("COPY_TO_BUILD_DIR_Debug" "@COPY_TO_BUILD_DIR_Debug@") 2 | SET("COPY_TO_BUILD_DIR_Release" "@COPY_TO_BUILD_DIR_Release@") 3 | SET("COPY_TO_BUILD_DIR_MinSizeRel" "@COPY_TO_BUILD_DIR_MinSizeRel@") 4 | SET("COPY_TO_BUILD_DIR_RelWithDebInfo" "@COPY_TO_BUILD_DIR_RelWithDebInfo@") 5 | 6 | FOREACH(src_file ${COPY_TO_BUILD_DIR_${CFG}}) 7 | SET(subdir "") 8 | IF(src_file MATCHES ".*=>.*") 9 | STRING(REGEX REPLACE ".*=>(.*)" "/\\1" subdir "${src_file}") 10 | STRING(REGEX REPLACE "(.*)=>.*" "\\1" src_file "${src_file}") 11 | ENDIF() 12 | SET(dst_dir "${TARGET_DIR}${subdir}") 13 | 14 | GET_FILENAME_COMPONENT(dst_file "${src_file}" NAME) 15 | 16 | IF("${src_file}" IS_NEWER_THAN "${dst_dir}/${dst_file}") 17 | MESSAGE(STATUS "Copying ${dst_file} to ${CFG}${subdir}") 18 | CONFIGURE_FILE("${src_file}" "${dst_dir}/${dst_file}" COPYONLY) 19 | ENDIF() 20 | ENDFOREACH() -------------------------------------------------------------------------------- /FilterOptionsWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "FilterOptionsWidget.h.moc" 20 | -------------------------------------------------------------------------------- /cmake/LibToDLL.cmake: -------------------------------------------------------------------------------- 1 | # Usage: 2 | # LIB_TO_DLL(output_list_of_dlls ${list_of_dot_lib_files}) 3 | MACRO(LIB_TO_DLL out_list_) 4 | SET(${out_list_} "") 5 | FOREACH(lib_file_ ${ARGN}) 6 | #STRING(REGEX REPLACE "\\.lib$" ".dll" dll_file_ "${lib_file_}") 7 | #IF(NOT "${dll_file_}" STREQUAL "${lib_file_}") 8 | # LIST(APPEND ${out_list_} "${dll_file_}") 9 | #ENDIF() 10 | GET_FILENAME_COMPONENT(lib_file_name_ "${lib_file_}" NAME) 11 | GET_FILENAME_COMPONENT(dir_ "${lib_file_}" PATH) 12 | 13 | STRING(REGEX REPLACE "^lib(.*)\\.a$" "\\1.dll" dll_file_name_ "${lib_file_name_}") 14 | IF("${dll_file_name_}" STREQUAL "${lib_file_name_}") 15 | STRING(REGEX REPLACE "^(.*)\\.lib$" "\\1.dll" dll_file_name_ "${lib_file_name_}") 16 | ENDIF() 17 | 18 | IF(NOT "${dll_file_name_}" STREQUAL "${lib_file_name_}") 19 | LIST(APPEND ${out_list_} "${dir_}/${dll_file_name_}") 20 | ENDIF() 21 | ENDFOREACH() 22 | ENDMACRO() -------------------------------------------------------------------------------- /filters/deskew/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Deskew Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | FILE(GLOB ui_files "ui/*.ui") 6 | QT4_WRAP_UI(ui_sources ${ui_files}) 7 | SET_SOURCE_FILES_PROPERTIES(${ui_sources} PROPERTIES GENERATED TRUE) 8 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 9 | SOURCE_GROUP("Generated" FILES ${ui_sources}) 10 | 11 | SET( 12 | sources 13 | ImageView.cpp ImageView.h 14 | Thumbnail.cpp Thumbnail.h 15 | Filter.cpp Filter.h 16 | OptionsWidget.cpp OptionsWidget.h 17 | Settings.cpp Settings.h 18 | Task.cpp Task.h 19 | CacheDrivenTask.cpp CacheDrivenTask.h 20 | Dependencies.cpp Dependencies.h 21 | Params.cpp Params.h 22 | ApplyDialog.cpp ApplyDialog.h 23 | ) 24 | SOURCE_GROUP("Sources" FILES ${sources}) 25 | QT4_AUTOMOC(${sources}) 26 | 27 | ADD_LIBRARY(deskew STATIC ${sources} ${ui_sources}) 28 | 29 | TRANSLATION_SOURCES(scantailor ${sources} ${ui_files}) 30 | -------------------------------------------------------------------------------- /foundation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Foundation library") 2 | 3 | INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | NonCopyable.h IntrusivePtr.h RefCountable.h 8 | AlignedArray.h 9 | FastQueue.h 10 | SafeDeletingQObjectPtr.h 11 | ScopedIncDec.h ScopedDecInc.h 12 | Span.h VirtualFunction.h FlagOps.h 13 | AutoRemovingFile.cpp AutoRemovingFile.h 14 | Proximity.cpp Proximity.h 15 | Property.h 16 | PropertyFactory.cpp PropertyFactory.h 17 | PropertySet.cpp PropertySet.h 18 | PerformanceTimer.cpp PerformanceTimer.h 19 | QtSignalForwarder.cpp QtSignalForwarder.h 20 | GridLineTraverser.cpp GridLineTraverser.h 21 | StaticPool.h 22 | DynamicPool.h 23 | NumericTraits.h 24 | VecNT.h 25 | VecT.h 26 | MatMNT.h 27 | MatT.h 28 | PriorityQueue.h 29 | Grid.h 30 | ValueConv.h 31 | ) 32 | SOURCE_GROUP("Sources" FILES ${sources}) 33 | QT4_AUTOMOC(${sources}) 34 | 35 | ADD_LIBRARY(foundation STATIC ${sources}) 36 | -------------------------------------------------------------------------------- /zones/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(zones) 2 | 3 | INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | SplineVertex.cpp SplineVertex.h 8 | SplineSegment.cpp SplineSegment.h 9 | EditableSpline.cpp EditableSpline.h 10 | SerializableSpline.cpp SerializableSpline.h 11 | Zone.cpp Zone.h 12 | ZoneSet.cpp ZoneSet.h 13 | EditableZoneSet.cpp EditableZoneSet.h 14 | BasicSplineVisualizer.cpp BasicSplineVisualizer.h 15 | ZoneInteractionContext.cpp ZoneInteractionContext.h 16 | ZoneDefaultInteraction.cpp ZoneDefaultInteraction.h 17 | ZoneCreationInteraction.cpp ZoneCreationInteraction.h 18 | ZoneVertexDragInteraction.cpp ZoneVertexDragInteraction.h 19 | ZoneContextMenuInteraction.cpp ZoneContextMenuInteraction.h 20 | ZoneContextMenuItem.h 21 | ) 22 | 23 | SOURCE_GROUP(Sources FILES ${sources}) 24 | QT4_AUTOMOC(${sources}) 25 | 26 | ADD_LIBRARY(zones STATIC ${sources}) 27 | 28 | TRANSLATION_SOURCES(scantailor ${sources}) -------------------------------------------------------------------------------- /imageproc/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | main.cpp 6 | TestBinaryImage.cpp TestReduceThreshold.cpp 7 | TestSlicedHistogram.cpp 8 | TestConnCompEraser.cpp TestConnCompEraserExt.cpp 9 | TestGrayscale.cpp 10 | TestRasterOp.cpp TestShear.cpp 11 | TestOrthogonalRotation.cpp 12 | TestSkewFinder.cpp 13 | TestScale.cpp 14 | TestTransform.cpp 15 | TestMorphology.cpp 16 | TestDentFinder.cpp 17 | TestBinarize.cpp 18 | TestPolygonRasterizer.cpp 19 | TestSeedFill.cpp 20 | TestSEDM.cpp 21 | TestRastLineFinder.cpp 22 | Utils.cpp Utils.h 23 | ) 24 | SOURCE_GROUP("Sources" FILES ${sources}) 25 | 26 | SET( 27 | libs 28 | imageproc math foundation ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 29 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} 30 | ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${EXTRA_LIBS} 31 | ) 32 | 33 | ADD_EXECUTABLE(imageproc_tests ${sources}) 34 | TARGET_LINK_LIBRARIES(imageproc_tests ${libs}) 35 | -------------------------------------------------------------------------------- /crash_reporter/MultipartFormData.h: -------------------------------------------------------------------------------- 1 | #ifndef MULTIPART_FORM_DATA_H_ 2 | #define MULTIPART_FORM_DATA_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class MultipartFormData 9 | { 10 | public: 11 | MultipartFormData(); 12 | 13 | /** 14 | * \brief Returns the content type that needs to be set for HTTP requests. 15 | */ 16 | QString contentType() const; 17 | 18 | void addParameter(QString const& name, QString const& value); 19 | 20 | void addFile(QString const& name, QString const& filename, QByteArray const& data); 21 | 22 | /** 23 | * \brief Marks the end of parameters and returns the serialized 24 | * representation of the form. 25 | * 26 | * Once called, no other data may be added to the form. 27 | */ 28 | QByteArray finalize(); 29 | private: 30 | static void generateBoundary(QByteArray& boundary); 31 | 32 | QByteArray m_boundary; 33 | QByteArray m_body; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /PageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_VIEW_H_ 20 | #define PAGE_VIEW_H_ 21 | 22 | enum PageView { IMAGE_VIEW, PAGE_VIEW }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /packaging/osx/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleInfoDictionaryVersion 8 | 6.0 9 | CFBundleExecutable 10 | ScanTailor 11 | CFBundleName 12 | ScanTailor 13 | CFBundlePackageType 14 | APPL 15 | CFBundleIdentifier 16 | net.sourceforge.Scantailor 17 | CFBundleSignature 18 | sctl 19 | CSResourcesFileMapped 20 | 21 | CFBundleIconFile 22 | ScanTailor.icns 23 | CFBundleShortVersionString 24 | ScanTailor-@VERSION@ 25 | LSMinimumSystemVersion 26 | 10.4.0 27 | 28 | 29 | -------------------------------------------------------------------------------- /BeforeOrAfter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BEFORE_OR_AFTER_H_ 20 | #define BEFORE_OR_AFTER_H_ 21 | 22 | enum BeforeOrAfter { BEFORE, AFTER }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /tests/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #define BOOST_AUTO_TEST_MAIN 24 | 25 | #include 26 | -------------------------------------------------------------------------------- /AutoManualMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef AUTOMANUALMODE_H_ 20 | #define AUTOMANUALMODE_H_ 21 | 22 | enum AutoManualMode 23 | { 24 | MODE_AUTO, 25 | MODE_MANUAL 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /imageproc/tests/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #define BOOST_AUTO_TEST_MAIN 24 | 25 | #include 26 | -------------------------------------------------------------------------------- /filters/page_layout/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Page Layout Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | FILE(GLOB ui_files "ui/*.ui") 6 | QT4_WRAP_UI(ui_sources ${ui_files}) 7 | SET_SOURCE_FILES_PROPERTIES(${ui_sources} PROPERTIES GENERATED TRUE) 8 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 9 | SOURCE_GROUP("Generated" FILES ${ui_sources}) 10 | 11 | SET( 12 | sources 13 | Utils.cpp Utils.h 14 | ImageView.cpp ImageView.h 15 | Filter.cpp Filter.h 16 | OptionsWidget.cpp OptionsWidget.h 17 | Task.cpp Task.h 18 | CacheDrivenTask.cpp CacheDrivenTask.h 19 | Params.cpp Params.h 20 | Settings.cpp Settings.h 21 | Thumbnail.cpp Thumbnail.h 22 | ApplyDialog.cpp ApplyDialog.h 23 | Alignment.cpp Alignment.h 24 | OrderByWidthProvider.cpp OrderByWidthProvider.h 25 | OrderByHeightProvider.cpp OrderByHeightProvider.h 26 | ) 27 | SOURCE_GROUP("Sources" FILES ${sources}) 28 | QT4_AUTOMOC(${sources}) 29 | 30 | ADD_LIBRARY(page_layout STATIC ${sources} ${ui_sources}) 31 | 32 | TRANSLATION_SOURCES(scantailor ${sources} ${ui_files}) -------------------------------------------------------------------------------- /imageproc/ByteOrder.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_BYTEORDER_H_ 20 | #define IMAGEPROC_BYTEORDER_H_ 21 | 22 | #ifdef _WIN32 23 | #include 24 | #else 25 | #include 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SCANTAILOR_VERSION_H_ 20 | #define SCANTAILOR_VERSION_H_ 21 | 22 | #define VERSION "0.9.11" 23 | #define VERSION_QUAD "0.9.11.0" // Must be "x.x.x.x" or an empty string. 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /packaging/windows/patch_libtiff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) 2 | 3 | PROJECT(patch_libtiff) 4 | 5 | GET_FILENAME_COMPONENT(outer_dir "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE) 6 | 7 | FILE(GLOB tiff_dirs "${outer_dir}/tiff-[0-9]*.[0-9]*.[0-9]*") 8 | FIND_PATH( 9 | TIFF_DIR libtiff/tiff.h PATHS ${tiff_dirs} 10 | DOC "Path to top-level tiff source directory." 11 | ) 12 | 13 | FIND_PROGRAM( 14 | PATCH_EXE patch 15 | PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32;InstallPath]/bin" 16 | DOC "Full path to patch.exe" 17 | ) 18 | 19 | IF(NOT TIFF_DIR) 20 | MESSAGE(FATAL_ERROR "TIFF source directory not found. You may specify it manually.") 21 | ELSEIF(NOT PATCH_EXE) 22 | MESSAGE(FATAL_ERROR "The patch utility wasn't found.") 23 | ENDIF(NOT TIFF_DIR) 24 | 25 | CONFIGURE_FILE( 26 | apply_individual_patches.cmake.in 27 | "${CMAKE_BINARY_DIR}/apply_individual_patches.cmake" @ONLY 28 | ) 29 | 30 | ADD_CUSTOM_TARGET( 31 | apply_patches ALL 32 | COMMAND "${CMAKE_COMMAND}" -P 33 | "${CMAKE_BINARY_DIR}/apply_individual_patches.cmake" 34 | WORKING_DIRECTORY "${TIFF_DIR}" 35 | ) 36 | -------------------------------------------------------------------------------- /OpenGLSupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OPENGL_SUPPORT_H_ 20 | #define OPENGL_SUPPORT_H_ 21 | 22 | class OpenGLSupport 23 | { 24 | public: 25 | /** 26 | * \brief Returns true if OpenGL support is present and provides the necessary features. 27 | */ 28 | static bool supported(); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /filters/output/FillZonePropFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "FillZonePropFactory.h" 20 | #include "FillColorProperty.h" 21 | 22 | namespace output 23 | { 24 | 25 | FillZonePropFactory::FillZonePropFactory() 26 | { 27 | FillColorProperty::registerIn(*this); 28 | } 29 | 30 | } // namespace output 31 | -------------------------------------------------------------------------------- /filter_dc/AbstractFilterDataCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ABSTRACTFILTERDATACOLLECTOR_H_ 20 | #define ABSTRACTFILTERDATACOLLECTOR_H_ 21 | 22 | class AbstractFilterDataCollector 23 | { 24 | public: 25 | virtual ~AbstractFilterDataCollector() {} 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /filters/output/PictureZonePropFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PictureZonePropFactory.h" 20 | #include "PictureLayerProperty.h" 21 | 22 | namespace output 23 | { 24 | 25 | PictureZonePropFactory::PictureZonePropFactory() 26 | { 27 | PictureLayerProperty::registerIn(*this); 28 | } 29 | 30 | } // namespace output 31 | -------------------------------------------------------------------------------- /filters/select_content/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Select Content Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | FILE(GLOB ui_files "ui/*.ui") 6 | QT4_WRAP_UI(ui_sources ${ui_files}) 7 | SET_SOURCE_FILES_PROPERTIES(${ui_sources} PROPERTIES GENERATED TRUE) 8 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 9 | SOURCE_GROUP("Generated" FILES ${ui_sources}) 10 | 11 | SET( 12 | sources 13 | ImageView.cpp ImageView.h 14 | Filter.cpp Filter.h 15 | OptionsWidget.cpp OptionsWidget.h 16 | ApplyDialog.cpp ApplyDialog.h 17 | ContentBoxFinder.cpp ContentBoxFinder.h 18 | Task.cpp Task.h 19 | CacheDrivenTask.cpp CacheDrivenTask.h 20 | Dependencies.cpp Dependencies.h 21 | Params.cpp Params.h 22 | Settings.cpp Settings.h 23 | Thumbnail.cpp Thumbnail.h 24 | PhysSizeCalc.cpp PhysSizeCalc.h 25 | OrderByWidthProvider.cpp OrderByWidthProvider.h 26 | OrderByHeightProvider.cpp OrderByHeightProvider.h 27 | ) 28 | SOURCE_GROUP("Sources" FILES ${sources}) 29 | QT4_AUTOMOC(${sources}) 30 | 31 | ADD_LIBRARY(select_content STATIC ${sources} ${ui_sources}) 32 | 33 | TRANSLATION_SOURCES(scantailor ${sources} ${ui_files}) 34 | -------------------------------------------------------------------------------- /imageproc/BWColor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BWCOLOR_H_ 20 | #define BWCOLOR_H_ 21 | 22 | namespace imageproc 23 | { 24 | 25 | enum BWColor { WHITE = 0, BLACK = 1 }; 26 | 27 | inline BWColor operator!(BWColor c) 28 | { 29 | return static_cast(~c & 1); 30 | } 31 | 32 | } // namespace imageproc 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /TaskStatus.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef TASKSTATUS_H_ 20 | #define TASKSTATUS_H_ 21 | 22 | class TaskStatus 23 | { 24 | public: 25 | virtual ~TaskStatus() {} 26 | 27 | virtual void cancel() = 0; 28 | 29 | virtual bool isCancelled() const = 0; 30 | 31 | virtual void throwIfCancelled() const = 0; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /Application.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef APPLICATION_H_ 20 | #define APPLICATION_H_ 21 | 22 | #include 23 | 24 | class Application : public QApplication 25 | { 26 | Q_OBJECT 27 | public: 28 | Application(int& argc, char** argv); 29 | 30 | virtual bool notify(QObject* receiver, QEvent* e); 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /filters/output/FillZonePropFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_FILL_ZONE_PROP_FACTORY_H_ 20 | #define OUTPUT_FILL_ZONE_PROP_FACTORY_H_ 21 | 22 | #include "PropertyFactory.h" 23 | 24 | namespace output 25 | { 26 | 27 | class FillZonePropFactory : public PropertyFactory 28 | { 29 | public: 30 | FillZonePropFactory(); 31 | }; 32 | 33 | } // namespace output 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /filters/output/ImageViewTab.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_IMAGE_VIEW_TAB_H_ 20 | #define OUTPUT_IMAGE_VIEW_TAB_H_ 21 | 22 | namespace output 23 | { 24 | 25 | enum ImageViewTab { 26 | TAB_OUTPUT, 27 | TAB_PICTURE_ZONES, 28 | TAB_FILL_ZONES, 29 | TAB_DEWARPING, 30 | TAB_DESPECKLING 31 | }; 32 | 33 | } // namespace output 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /BackgroundTask.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "BackgroundTask.h" 20 | 21 | char const* 22 | BackgroundTask::CancelledException::what() const throw() 23 | { 24 | return "BackgroundTask cancelled"; 25 | } 26 | 27 | void 28 | BackgroundTask::throwIfCancelled() const 29 | { 30 | if (isCancelled()) { 31 | throw CancelledException(); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /foundation/PerformanceTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PERFORMANCETIMER_H_ 20 | #define PERFORMANCETIMER_H_ 21 | 22 | #include 23 | 24 | class PerformanceTimer 25 | { 26 | public: 27 | PerformanceTimer() : m_start(clock()) {} 28 | 29 | void print(char const* prefix = ""); 30 | private: 31 | clock_t const m_start; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /filters/output/PictureZonePropFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_PICTURE_ZONE_PROP_FACTORY_H_ 20 | #define OUTPUT_PICTURE_ZONE_PROP_FACTORY_H_ 21 | 22 | #include "PropertyFactory.h" 23 | 24 | namespace output 25 | { 26 | 27 | class PictureZonePropFactory : public PropertyFactory 28 | { 29 | public: 30 | PictureZonePropFactory(); 31 | }; 32 | 33 | } // namespace output 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /filters/page_split/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Page Split Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | FILE(GLOB ui_files "ui/*.ui") 6 | QT4_WRAP_UI(ui_sources ${ui_files}) 7 | SET_SOURCE_FILES_PROPERTIES(${ui_sources} PROPERTIES GENERATED TRUE) 8 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 9 | SOURCE_GROUP("Generated" FILES ${ui_sources}) 10 | 11 | SET( 12 | sources 13 | SplitLineObject.h 14 | ImageView.cpp ImageView.h 15 | Thumbnail.cpp Thumbnail.h 16 | Params.cpp Params.h 17 | Dependencies.cpp Dependencies.h 18 | PageLayout.cpp PageLayout.h 19 | PageLayoutEstimator.cpp PageLayoutEstimator.h 20 | VertLineFinder.cpp VertLineFinder.h 21 | Filter.cpp Filter.h 22 | OptionsWidget.cpp OptionsWidget.h 23 | SplitModeDialog.cpp SplitModeDialog.h 24 | Settings.cpp Settings.h 25 | Task.cpp Task.h 26 | CacheDrivenTask.cpp CacheDrivenTask.h 27 | LayoutType.cpp LayoutType.h 28 | UnremoveButton.cpp UnremoveButton.h 29 | OrderBySplitTypeProvider.cpp OrderBySplitTypeProvider.h 30 | ) 31 | SOURCE_GROUP("Sources" FILES ${sources}) 32 | QT4_AUTOMOC(${sources}) 33 | 34 | ADD_LIBRARY(page_split STATIC ${sources} ${ui_sources}) 35 | 36 | TRANSLATION_SOURCES(scantailor ${sources} ${ui_files}) -------------------------------------------------------------------------------- /math/LinearSolver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "LinearSolver.h" 20 | 21 | LinearSolver::LinearSolver(size_t rows_AB, size_t cols_A_rows_X, size_t cols_BX) 22 | : m_rowsAB(rows_AB), 23 | m_colsArowsX(cols_A_rows_X), 24 | m_colsBX(cols_BX) 25 | { 26 | if (m_rowsAB < m_colsArowsX) { 27 | throw std::runtime_error("LinearSolver: can's solve underdetermined systems"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /foundation/NonCopyable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NONCOPYABLE_H_ 20 | #define NONCOPYABLE_H_ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #define DECLARE_NON_COPYABLE(Class) \ 27 | private: \ 28 | /** \brief Copying is forbidden. */ \ 29 | Class(Class const&); \ 30 | /** \brief Copying is forbidden. */ \ 31 | Class& operator=(Class const&); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /PageRange.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_RANGE_H_ 20 | #define PAGE_RANGE_H_ 21 | 22 | #include "PageId.h" 23 | #include 24 | #include 25 | 26 | class PageRange 27 | { 28 | public: 29 | /** 30 | * \brief Ordered list of consecutive pages. 31 | */ 32 | std::vector pages; 33 | 34 | std::set selectEveryOther(PageId const& base) const; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /filters/output/Thumbnail.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Thumbnail.h" 20 | 21 | namespace output 22 | { 23 | 24 | Thumbnail::Thumbnail( 25 | IntrusivePtr const& thumbnail_cache, 26 | QSizeF const& max_size, ImageId const& image_id, 27 | ImageTransformation const& xform) 28 | : ThumbnailBase(thumbnail_cache, max_size, image_id, xform) 29 | { 30 | } 31 | 32 | } // namespace output 33 | -------------------------------------------------------------------------------- /foundation/Property.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PROPERTY_H_ 20 | #define PROPERTY_H_ 21 | 22 | #include "RefCountable.h" 23 | #include "IntrusivePtr.h" 24 | 25 | class QDomDocument; 26 | class QDomElement; 27 | 28 | class Property : public RefCountable 29 | { 30 | public: 31 | virtual IntrusivePtr clone() const = 0; 32 | 33 | virtual QDomElement toXml(QDomDocument& doc, QString const& name) const = 0; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /foundation/ScopedDecInc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SCOPEDDECINC_H_ 20 | #define SCOPEDDECINC_H_ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | template 27 | class ScopedDecInc 28 | { 29 | public: 30 | ScopedDecInc(T& counter) : m_counter(counter) { --counter; } 31 | 32 | ~ScopedDecInc() { ++m_counter; } 33 | private: 34 | T& m_counter; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /foundation/ScopedIncDec.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SCOPEDINCDEC_H_ 20 | #define SCOPEDINCDEC_H_ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | template 27 | class ScopedIncDec 28 | { 29 | public: 30 | ScopedIncDec(T& counter) : m_counter(counter) { ++counter; } 31 | 32 | ~ScopedIncDec() { --m_counter; } 33 | private: 34 | T& m_counter; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /foundation/QtSignalForwarder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "QtSignalForwarder.h" 20 | #include "QtSignalForwarder.h.moc" 21 | 22 | QtSignalForwarder::QtSignalForwarder( 23 | QObject* emitter, char const* signal, boost::function const& slot) 24 | : QObject(emitter), 25 | m_slot(slot) 26 | { 27 | connect(emitter, signal, SLOT(handleSignal())); 28 | } 29 | 30 | void 31 | QtSignalForwarder::handleSignal() 32 | { 33 | m_slot(); 34 | } 35 | -------------------------------------------------------------------------------- /NonOwningWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "NonOwningWidget.h" 20 | #include 21 | 22 | NonOwningWidget::NonOwningWidget(QWidget* parent) 23 | : QWidget(parent) 24 | { 25 | } 26 | 27 | NonOwningWidget::~NonOwningWidget() 28 | { 29 | BOOST_FOREACH(QObject* child, children()) { 30 | if (QWidget* widget = dynamic_cast(child)) { 31 | widget->setParent(0); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /filter_dc/PageOrientationCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_ORIENTATION_COLLECTOR_H_ 20 | #define PAGE_ORIENTATION_COLLECTOR_H_ 21 | 22 | #include "AbstractFilterDataCollector.h" 23 | 24 | class OrthogonalRotation; 25 | 26 | class PageOrientationCollector : public AbstractFilterDataCollector 27 | { 28 | public: 29 | virtual void process(OrthogonalRotation const& orientation) = 0; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /ImageFileInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ImageFileInfo.h" 20 | #include 21 | #include 22 | #include 23 | 24 | bool 25 | ImageFileInfo::isDpiOK() const 26 | { 27 | using namespace boost::lambda; 28 | 29 | return std::find_if( 30 | m_imageInfo.begin(), m_imageInfo.end(), 31 | !bind(&ImageMetadata::isDpiOK, _1) 32 | ) == m_imageInfo.end(); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /RelinkingSortingModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RELINKING_SORTING_MODEL_H_ 20 | #define RELINKING_SORTING_MODEL_H_ 21 | 22 | #include 23 | 24 | class RelinkingSortingModel : public QSortFilterProxyModel 25 | { 26 | public: 27 | RelinkingSortingModel(QObject* parent = 0); 28 | protected: 29 | virtual bool lessThan(QModelIndex const& left, QModelIndex const& right) const; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /ImageLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGELOADER_H_ 20 | #define IMAGELOADER_H_ 21 | 22 | class ImageId; 23 | class QImage; 24 | class QString; 25 | class QIODevice; 26 | 27 | class ImageLoader 28 | { 29 | public: 30 | static QImage load(QString const& file_path, int page_num = 0); 31 | 32 | static QImage load(ImageId const& image_id); 33 | 34 | static QImage load(QIODevice& io_dev, int page_num); 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /SettingsDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SETTINGS_DIALOG_H_ 20 | #define SETTINGS_DIALOG_H_ 21 | 22 | #include "ui_SettingsDialog.h" 23 | #include 24 | 25 | class SettingsDialog : public QDialog 26 | { 27 | Q_OBJECT 28 | public: 29 | SettingsDialog(QWidget* parent = 0); 30 | 31 | virtual ~SettingsDialog(); 32 | private slots: 33 | void commitChanges(); 34 | private: 35 | Ui::SettingsDialog ui; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /PayloadEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAYLOAD_EVENT_H_ 20 | #define PAYLOAD_EVENT_H_ 21 | 22 | #include 23 | 24 | template 25 | class PayloadEvent : public QEvent 26 | { 27 | public: 28 | PayloadEvent(T const& payload) : QEvent(User), m_payload(payload) {} 29 | 30 | T const& payload() const { return m_payload; } 31 | 32 | T& payload() { return m_payload; } 33 | private: 34 | T m_payload; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /filter_dc/ContentBoxCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef CONTENTBOXCOLLECTOR_H_ 20 | #define CONTENTBOXCOLLECTOR_H_ 21 | 22 | #include "AbstractFilterDataCollector.h" 23 | 24 | class ImageTransformation; 25 | class QRectF; 26 | 27 | class ContentBoxCollector : public AbstractFilterDataCollector 28 | { 29 | public: 30 | virtual void process( 31 | ImageTransformation const& xform, 32 | QRectF const& content_rect) = 0; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /NonOwningWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NON_OWNING_WIDGET_H_ 20 | #define NON_OWNING_WIDGET_H_ 21 | 22 | #include 23 | 24 | /** 25 | * \brief Your normal QWidget, except it doesn't delete its children with itself, 26 | * rather it calls setParent(0) on them. 27 | */ 28 | class NonOwningWidget : public QWidget 29 | { 30 | public: 31 | NonOwningWidget(QWidget* parent = 0); 32 | 33 | virtual ~NonOwningWidget(); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /math/LineBoundedByRect.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LINE_BOUNDED_BY_RECT_H_ 20 | #define LINE_BOUNDED_BY_RECT_H_ 21 | 22 | #include 23 | #include 24 | 25 | /** 26 | * If \p line (not line segment!) intersects with \p rect, 27 | * writes intersection points as the new \p line endpoints 28 | * and returns true. Otherwise returns false and leaves 29 | * \p line unmodified. 30 | */ 31 | bool lineBoundedByRect(QLineF& line, QRectF const& rect); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /math/SidesOfLine.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "SidesOfLine.h" 20 | 21 | qreal sidesOfLine(QLineF const& line, QPointF const& p1, QPointF const& p2) 22 | { 23 | QPointF const normal(line.normalVector().p2() - line.p1()); 24 | QPointF const vec1(p1 - line.p1()); 25 | QPointF const vec2(p2 - line.p1()); 26 | qreal const dot1 = normal.x() * vec1.x() + normal.y() * vec1.y(); 27 | qreal const dot2 = normal.x() * vec2.x() + normal.y() * vec2.y(); 28 | return dot1 * dot2; 29 | } 30 | -------------------------------------------------------------------------------- /filters/output/DespeckleLevel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DESPECKLE_LEVEL_H_ 20 | #define DESPECKLE_LEVEL_H_ 21 | 22 | class QString; 23 | 24 | namespace output 25 | { 26 | 27 | enum DespeckleLevel { 28 | DESPECKLE_OFF, 29 | DESPECKLE_CAUTIOUS, 30 | DESPECKLE_NORMAL, 31 | DESPECKLE_AGGRESSIVE 32 | }; 33 | 34 | QString despeckleLevelToString(DespeckleLevel level); 35 | 36 | DespeckleLevel despeckleLevelFromString(QString const& str); 37 | 38 | } // namespace output 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /CompositeCacheDrivenTask.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef COMPOSITECACHEDRIVENTASK_H_ 20 | #define COMPOSITECACHEDRIVENTASK_H_ 21 | 22 | #include "RefCountable.h" 23 | 24 | class PageInfo; 25 | class AbstractFilterDataCollector; 26 | 27 | class CompositeCacheDrivenTask : public RefCountable 28 | { 29 | public: 30 | virtual ~CompositeCacheDrivenTask() {} 31 | 32 | virtual void process( 33 | PageInfo const& page_info, 34 | AbstractFilterDataCollector* collector) = 0; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /filters/page_split/LayoutType.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_SPLIT_LAYOUT_TYPE_H_ 20 | #define PAGE_SPLIT_LAYOUT_TYPE_H_ 21 | 22 | #include 23 | 24 | namespace page_split 25 | { 26 | 27 | enum LayoutType { 28 | AUTO_LAYOUT_TYPE, 29 | SINGLE_PAGE_UNCUT, 30 | PAGE_PLUS_OFFCUT, 31 | TWO_PAGES 32 | }; 33 | 34 | QString layoutTypeToString(LayoutType type); 35 | 36 | LayoutType layoutTypeFromString(QString const& layout_type); 37 | 38 | } // namespace page_split 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /PhysicalTransformation.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PhysicalTransformation.h" 20 | #include "Dpi.h" 21 | #include "imageproc/Constants.h" 22 | 23 | using namespace imageproc::constants; 24 | 25 | PhysicalTransformation::PhysicalTransformation(Dpi const& dpi) 26 | { 27 | double const xscale = dpi.horizontal() * (DPI2DPM / 1000.0); 28 | double const yscale = dpi.vertical() * (DPI2DPM / 1000.0); 29 | m_mmToPixels.scale(xscale, yscale); 30 | m_pixelsToMM.scale(1.0 / xscale, 1.0 / yscale); 31 | } 32 | -------------------------------------------------------------------------------- /zones/SplineSegment.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "SplineSegment.h" 20 | #include 21 | 22 | SplineSegment::SplineSegment( 23 | SplineVertex::Ptr const& prev, SplineVertex::Ptr const& next) 24 | : prev(prev), 25 | next(next) 26 | { 27 | } 28 | 29 | SplineVertex::Ptr 30 | SplineSegment::splitAt(QPointF const& pt) 31 | { 32 | assert(isValid()); 33 | return prev->insertAfter(pt); 34 | } 35 | 36 | bool 37 | SplineSegment::isValid() const 38 | { 39 | return prev && next && prev->next(SplineVertex::LOOP_IF_BRIDGED) == next; 40 | } 41 | -------------------------------------------------------------------------------- /filters/output/FillZoneComparator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FILL_ZONE_COMPARATOR_H_ 20 | #define FILL_ZONE_COMPARATOR_H_ 21 | 22 | class ZoneSet; 23 | class Zone; 24 | class PropertySet; 25 | 26 | namespace output 27 | { 28 | 29 | class FillZoneComparator 30 | { 31 | public: 32 | static bool equal(ZoneSet const& lhs, ZoneSet const& rhs); 33 | 34 | static bool equal(Zone const& lhs, Zone const& rhs); 35 | 36 | static bool equal(PropertySet const& lhs, PropertySet const& rhs); 37 | }; 38 | 39 | } // namespace output 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /PhysicalTransformation.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PHYSICALTRANSFORMATION_H_ 20 | #define PHYSICALTRANSFORMATION_H_ 21 | 22 | #include 23 | 24 | class Dpi; 25 | 26 | class PhysicalTransformation 27 | { 28 | public: 29 | PhysicalTransformation(Dpi const& dpi); 30 | 31 | QTransform const& pixelsToMM() const { return m_pixelsToMM; } 32 | 33 | QTransform const& mmToPixels() const { return m_mmToPixels; } 34 | private: 35 | QTransform m_pixelsToMM; 36 | QTransform m_mmToPixels; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /filters/output/PictureZoneComparator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PICTURE_ZONE_COMPARATOR_H_ 20 | #define PICTURE_ZONE_COMPARATOR_H_ 21 | 22 | class ZoneSet; 23 | class Zone; 24 | class PropertySet; 25 | 26 | namespace output 27 | { 28 | 29 | class PictureZoneComparator 30 | { 31 | public: 32 | static bool equal(ZoneSet const& lhs, ZoneSet const& rhs); 33 | 34 | static bool equal(Zone const& lhs, Zone const& rhs); 35 | 36 | static bool equal(PropertySet const& lhs, PropertySet const& rhs); 37 | }; 38 | 39 | } // namespace output 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /ErrorWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ERRORWIDGET_H_ 20 | #define ERRORWIDGET_H_ 21 | 22 | #include "ui_ErrorWidget.h" 23 | #include 24 | #include 25 | 26 | class QString; 27 | 28 | class ErrorWidget : public QWidget, private Ui::ErrorWidget 29 | { 30 | Q_OBJECT 31 | public: 32 | ErrorWidget(QString const& text, Qt::TextFormat fmt = Qt::AutoText); 33 | private slots: 34 | /** 35 | * \see QLabel::linkActivated() 36 | */ 37 | virtual void linkActivated(QString const& link) {} 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /foundation/PerformanceTimer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PerformanceTimer.h" 20 | #include 21 | 22 | void 23 | PerformanceTimer::print(char const* prefix) 24 | { 25 | clock_t const now = clock(); 26 | double const sec = double(now - m_start) / CLOCKS_PER_SEC; 27 | if (sec > 10.0) { 28 | qDebug() << prefix << (long)sec << " sec"; 29 | } else if (sec > 0.01) { 30 | qDebug() << prefix << (long)(sec * 1000) << " msec"; 31 | } else { 32 | qDebug() << prefix << (long)(sec * 1000000) << " usec"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ImageInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ImageInfo.h" 20 | 21 | ImageInfo::ImageInfo() 22 | : m_numSubPages(0), 23 | m_leftHalfRemoved(false), 24 | m_rightHalfRemoved(false) 25 | { 26 | } 27 | 28 | ImageInfo::ImageInfo( 29 | ImageId const& id, ImageMetadata const& metadata, 30 | int num_sub_pages, bool left_half_removed, bool right_half_removed) 31 | : m_id(id), 32 | m_metadata(metadata), 33 | m_numSubPages(num_sub_pages), 34 | m_leftHalfRemoved(left_half_removed), 35 | m_rightHalfRemoved(right_half_removed) 36 | { 37 | } 38 | -------------------------------------------------------------------------------- /imageproc/Connectivity.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_CONNECTIVITY_H_ 20 | #define IMAGEPROC_CONNECTIVITY_H_ 21 | 22 | namespace imageproc 23 | { 24 | 25 | /** 26 | * \brief Defines which neighbouring pixels are considered to be connected. 27 | */ 28 | enum Connectivity { 29 | /** North, east, south and west neighbours of a pixel 30 | are considered to be connected to it. */ 31 | CONN4, 32 | /** All 8 neighbours are considered to be connected. */ 33 | CONN8 34 | }; 35 | 36 | } // namespace imageproc 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /imageproc/GrayImage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "GrayImage.h" 20 | #include "Grayscale.h" 21 | #include 22 | 23 | namespace imageproc 24 | { 25 | 26 | GrayImage::GrayImage(QSize size) 27 | { 28 | if (size.isEmpty()) { 29 | return; 30 | } 31 | 32 | m_image = QImage(size, QImage::Format_Indexed8); 33 | m_image.setColorTable(createGrayscalePalette()); 34 | if (m_image.isNull()) { 35 | throw std::bad_alloc(); 36 | } 37 | } 38 | 39 | GrayImage::GrayImage(QImage const& image) 40 | : m_image(toGrayscale(image)) 41 | { 42 | } 43 | 44 | } // namespace imageproc 45 | -------------------------------------------------------------------------------- /Application.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Application.h" 20 | #include "Application.h.moc" 21 | #include "OutOfMemoryHandler.h" 22 | #include 23 | 24 | Application::Application(int& argc, char** argv) 25 | : QApplication(argc, argv) 26 | { 27 | } 28 | 29 | bool 30 | Application::notify(QObject* receiver, QEvent* e) 31 | { 32 | try { 33 | return QApplication::notify(receiver, e); 34 | } catch (std::bad_alloc const&) { 35 | OutOfMemoryHandler::instance().handleOutOfMemorySituation(); 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /PageInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PageInfo.h" 20 | 21 | PageInfo::PageInfo() 22 | : m_imageSubPages(0), 23 | m_leftHalfRemoved(false), 24 | m_rightHalfRemoved(false) 25 | { 26 | } 27 | 28 | PageInfo::PageInfo( 29 | PageId const& page_id, ImageMetadata const& metadata, 30 | int image_sub_pages, bool left_half_removed, bool right_half_removed) 31 | : m_pageId(page_id), 32 | m_metadata(metadata), 33 | m_imageSubPages(image_sub_pages), 34 | m_leftHalfRemoved(left_half_removed), 35 | m_rightHalfRemoved(right_half_removed) 36 | { 37 | } 38 | -------------------------------------------------------------------------------- /ErrorWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ErrorWidget.h" 20 | #include "ErrorWidget.h.moc" 21 | #include 22 | #include 23 | 24 | ErrorWidget::ErrorWidget(QString const& text, Qt::TextFormat fmt) 25 | { 26 | setupUi(this); 27 | textLabel->setTextFormat(fmt); 28 | textLabel->setText(text); 29 | QIcon icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning)); 30 | imageLabel->setPixmap(icon.pixmap(48, 48)); 31 | 32 | connect(textLabel, SIGNAL(linkActivated(QString const&)), SLOT(linkActivated(QString const&))); 33 | } 34 | -------------------------------------------------------------------------------- /PageSelectionProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_SELECTION_PROVIDER_H_ 20 | #define PAGE_SELECTION_PROVIDER_H_ 21 | 22 | #include "RefCountable.h" 23 | #include 24 | #include 25 | 26 | class PageSequence; 27 | class PageId; 28 | class PageRange; 29 | 30 | class PageSelectionProvider : public RefCountable 31 | { 32 | public: 33 | virtual PageSequence allPages() const = 0; 34 | 35 | virtual std::set selectedPages() const = 0; 36 | 37 | virtual std::vector selectedRanges() const = 0; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /filters/output/Utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_UTILS_H_ 20 | #define OUTPUT_UTILS_H_ 21 | 22 | class Dpi; 23 | class QString; 24 | class QTransform; 25 | 26 | namespace output 27 | { 28 | 29 | class Utils 30 | { 31 | public: 32 | static QString automaskDir(QString const& out_dir); 33 | 34 | static QString predespeckleDir(QString const& out_dir); 35 | 36 | static QString specklesDir(QString const& out_dir); 37 | 38 | static QTransform scaleFromToDpi(Dpi const& from, Dpi const& to); 39 | }; 40 | 41 | } // namespace output 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /filters/output/DewarpingMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_DEWARPING_MODE_H_ 20 | #define OUTPUT_DEWARPING_MODE_H_ 21 | 22 | #include 23 | 24 | namespace output 25 | { 26 | 27 | class DewarpingMode 28 | { 29 | public: 30 | enum Mode { OFF, AUTO, MANUAL }; 31 | 32 | DewarpingMode(Mode mode = OFF) : m_mode(mode) {} 33 | 34 | explicit DewarpingMode(QString const& str); 35 | 36 | QString toString() const; 37 | 38 | operator Mode() const { return m_mode; } 39 | private: 40 | Mode m_mode; 41 | }; 42 | 43 | } // namespace output 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /foundation/PropertyFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PropertyFactory.h" 20 | #include 21 | #include 22 | 23 | void 24 | PropertyFactory::registerProperty(QString const& property, PropertyConstructor constructor) 25 | { 26 | m_registry[property] = constructor; 27 | } 28 | 29 | IntrusivePtr 30 | PropertyFactory::construct(QDomElement const& el) const 31 | { 32 | Registry::const_iterator it(m_registry.find(el.attribute("type"))); 33 | if (it != m_registry.end()) { 34 | return (*it->second)(el); 35 | } else { 36 | return IntrusivePtr(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /imageproc/ColorInterpolation.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_COLORINTERPOLATION_H_ 20 | #define IMAGEPROC_COLORINTERPOLATION_H_ 21 | 22 | #include 23 | 24 | namespace imageproc 25 | { 26 | 27 | /** 28 | * \brief Returns a color between the provided two. 29 | * 30 | * Returns a color between \p from and \p to according to \p dist. 31 | * \p dist 0 corresponds to \p from, while \p dist 1 corresponds to \p to. 32 | */ 33 | QColor colorInterpolation(QColor const& from, QColor const& to, double dist); 34 | 35 | } // namespace imageproc 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /AbstractRelinker.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ABSTRACT_RELINKER_H_ 20 | #define ABSTRACT_RELINKER_H_ 21 | 22 | #include "RefCountable.h" 23 | 24 | class RelinkablePath; 25 | class QString; 26 | 27 | class AbstractRelinker : public RefCountable 28 | { 29 | public: 30 | virtual ~AbstractRelinker() {} 31 | 32 | /** 33 | * Returns the path to be used instead of the given path. 34 | * The same path will be returned if no substitution is to be made. 35 | */ 36 | virtual QString substitutionPathFor(RelinkablePath const& orig_path) const = 0; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /SelectedPage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "SelectedPage.h" 20 | 21 | SelectedPage::SelectedPage(PageId const& page_id, PageView view) 22 | { 23 | set(page_id, view); 24 | } 25 | 26 | void 27 | SelectedPage::set(PageId const& page_id, PageView view) 28 | { 29 | if (view == PAGE_VIEW || page_id.imageId() != m_pageId.imageId()) { 30 | m_pageId = page_id; 31 | } 32 | } 33 | 34 | PageId 35 | SelectedPage::get(PageView view) const 36 | { 37 | if (view == PAGE_VIEW) { 38 | return m_pageId; 39 | } else { 40 | return PageId(m_pageId.imageId(), PageId::SINGLE_PAGE); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /filter_dc/ThumbnailCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef THUMBNAILCOLLECTOR_H_ 20 | #define THUMBNAILCOLLECTOR_H_ 21 | 22 | #include "AbstractFilterDataCollector.h" 23 | #include 24 | 25 | class ThumbnailPixmapCache; 26 | class QGraphicsItem; 27 | class QSizeF; 28 | 29 | class ThumbnailCollector : public AbstractFilterDataCollector 30 | { 31 | public: 32 | virtual void processThumbnail(std::auto_ptr) = 0; 33 | 34 | virtual IntrusivePtr thumbnailCache() = 0; 35 | 36 | virtual QSizeF maxLogicalThumbSize() const = 0; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /imageproc/Constants.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Constants.h" 20 | 21 | namespace imageproc 22 | { 23 | 24 | namespace constants 25 | { 26 | 27 | double const SQRT_2 = 1.4142135623730950488016887242097; 28 | 29 | double const PI = 3.141592653589793; 30 | 31 | double const DEG2RAD = PI / 180.0; 32 | 33 | double const RAD2DEG = 180.0 / PI; 34 | 35 | double const INCH2MM = 25.4; 36 | 37 | double const MM2INCH = 1.0 / INCH2MM; 38 | 39 | double const DPM2DPI = 0.0254; 40 | 41 | double const DPI2DPM = 1.0 / DPM2DPI; 42 | 43 | } // namespace constants 44 | 45 | } // namespace imageproc 46 | -------------------------------------------------------------------------------- /dewarping/RasterDewarper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DEWARPING_RASTER_DEWARPER_H_ 20 | #define DEWARPING_RASTER_DEWARPER_H_ 21 | 22 | class QImage; 23 | class QSize; 24 | class QRectF; 25 | class QColor; 26 | 27 | namespace dewarping 28 | { 29 | 30 | class CylindricalSurfaceDewarper; 31 | 32 | class RasterDewarper 33 | { 34 | public: 35 | static QImage dewarp( 36 | QImage const& src, QSize const& dst_size, 37 | CylindricalSurfaceDewarper const& distortion_model, 38 | QRectF const& model_domain, QColor const& background_color 39 | ); 40 | }; 41 | 42 | } // namespace dewarping 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /TiffMetadataLoader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "TiffMetadataLoader.h" 20 | #include "TiffReader.h" 21 | 22 | void 23 | TiffMetadataLoader::registerMyself() 24 | { 25 | static bool registered = false; 26 | if (!registered) { 27 | ImageMetadataLoader::registerLoader( 28 | IntrusivePtr(new TiffMetadataLoader) 29 | ); 30 | registered = true; 31 | } 32 | } 33 | 34 | ImageMetadataLoader::Status 35 | TiffMetadataLoader::loadMetadata( 36 | QIODevice& io_device, 37 | VirtualFunction1& out) 38 | { 39 | return TiffReader::readMetadata(io_device, out); 40 | } 41 | -------------------------------------------------------------------------------- /filters/output/Thumbnail.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_THUMBNAIL_H_ 20 | #define OUTPUT_THUMBNAIL_H_ 21 | 22 | #include "ThumbnailBase.h" 23 | #include "IntrusivePtr.h" 24 | 25 | class ThumbnailPixmapCache; 26 | class ImageTransformation; 27 | class ImageId; 28 | class QSizeF; 29 | 30 | namespace output 31 | { 32 | 33 | class Thumbnail : public ThumbnailBase 34 | { 35 | public: 36 | Thumbnail(IntrusivePtr const& thumbnail_cache, 37 | QSizeF const& max_size, ImageId const& image_id, 38 | ImageTransformation const& xform); 39 | }; 40 | 41 | } // namespace output 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /filters/output/ImageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_IMAGEVIEW_H_ 20 | #define OUTPUT_IMAGEVIEW_H_ 21 | 22 | #include "ImageViewBase.h" 23 | #include "DragHandler.h" 24 | #include "ZoomHandler.h" 25 | #include 26 | 27 | class ImageTransformation; 28 | 29 | namespace output 30 | { 31 | 32 | class ImageView : public ImageViewBase 33 | { 34 | Q_OBJECT 35 | public: 36 | ImageView(QImage const& image, QImage const& downscaled_image); 37 | 38 | virtual ~ImageView(); 39 | private: 40 | DragHandler m_dragHandler; 41 | ZoomHandler m_zoomHandler; 42 | }; 43 | 44 | } // namespace output 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /imageproc/tests/TestBinarize.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Binarize.h" 20 | #include "BinaryImage.h" 21 | #include "Utils.h" 22 | #include 23 | #include 24 | #include 25 | 26 | namespace imageproc 27 | { 28 | 29 | namespace tests 30 | { 31 | 32 | using namespace utils; 33 | 34 | BOOST_AUTO_TEST_SUITE(BinarizeTestSuite); 35 | #if 0 36 | BOOST_AUTO_TEST_CASE(test) 37 | { 38 | QImage img("test.png"); 39 | binarizeWolf(img).toQImage().save("out.png"); 40 | } 41 | #endif 42 | BOOST_AUTO_TEST_SUITE_END(); 43 | 44 | } // namespace tests 45 | 46 | } // namespace imageproc 47 | -------------------------------------------------------------------------------- /filters/output/OutputMargins.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_OUTPUT_MARGINS_H_ 20 | #define OUTPUT_OUTPUT_MARGINS_H_ 21 | 22 | #include "Margins.h" 23 | 24 | namespace output 25 | { 26 | 27 | /** 28 | * Having margins on the Output stage is useful when creating zones 29 | * that are meant to cover a corner or an edge of a page. 30 | * We use the same margins on all tabs to preserve their geometrical 31 | * one-to-one relationship. 32 | */ 33 | class OutputMargins : public Margins 34 | { 35 | public: 36 | OutputMargins() : Margins(10.0, 10.0, 10.0, 10.0) {} 37 | }; 38 | 39 | } // namespace output 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /foundation/GridLineTraverser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef GRID_LINE_TRAVERSER_H_ 20 | #define GRID_LINE_TRAVERSER_H_ 21 | 22 | #include 23 | 24 | /** 25 | * \brief Traverses a grid along a line segment. 26 | * 27 | * Think about drawing a line on an image. 28 | */ 29 | class GridLineTraverser 30 | { 31 | // Member-wise copying is OK. 32 | public: 33 | GridLineTraverser(QLineF const& line); 34 | 35 | bool hasNext() const { return m_stopsDone < m_totalStops; } 36 | 37 | QPoint next(); 38 | private: 39 | QLineF m_line; 40 | double m_dt; 41 | int m_totalStops; 42 | int m_stopsDone; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /filters/select_content/PhysSizeCalc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SELECT_CONTENT_PHYS_SIZE_CALC_H_ 20 | #define SELECT_CONTENT_PHYS_SIZE_CALC_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | class ImageTransformation; 27 | 28 | namespace select_content 29 | { 30 | 31 | class PhysSizeCalc 32 | { 33 | // Member-wise copying is OK. 34 | public: 35 | PhysSizeCalc(); 36 | 37 | explicit PhysSizeCalc(ImageTransformation const& xform); 38 | 39 | QSizeF sizeMM(QRectF const& rect_px) const; 40 | private: 41 | QTransform m_virtToPhys; 42 | }; 43 | 44 | } // namespace select_content 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /compat/QAtomicInt: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef QATOMICINT_H_ 20 | #define QATOMICINT_H_ 21 | 22 | #include 23 | 24 | class QAtomicInt 25 | { 26 | public: 27 | QAtomicInt() : m_val(0) {} 28 | 29 | QAtomicInt(int val) : m_val(val) {} 30 | 31 | int fetchAndStoreRelaxed(int new_val) { 32 | return q_atomic_set_int(&m_val, new_val); 33 | } 34 | 35 | int fetchAndAddRelaxed(int delta) { 36 | return q_atomic_fetch_and_add_int(&m_val, delta); 37 | } 38 | 39 | bool ref() { return q_atomic_increment(&m_val) != 0; } 40 | 41 | bool deref() { return q_atomic_decrement(&m_val) != 0; } 42 | private: 43 | int m_val; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /imageproc/Scale.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_SCALE_H_ 20 | #define IMAGEPROC_SCALE_H_ 21 | 22 | class QSize; 23 | 24 | namespace imageproc 25 | { 26 | 27 | class GrayImage; 28 | 29 | /** 30 | * \brief Converts an image to grayscale and scales it to dst_size. 31 | * 32 | * \param src The source image. 33 | * \param dst_size The size to scale the image to. 34 | * \return The scaled image. 35 | * 36 | * This function is a faster replacement for QImage::scaled(), when 37 | * dealing with grayscale images. 38 | */ 39 | GrayImage scaleToGray(GrayImage const& src, QSize const& dst_size); 40 | 41 | } // namespace imageproc 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /FilterData.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "FilterData.h" 20 | #include "Dpm.h" 21 | #include "Dpi.h" 22 | #include "imageproc/Grayscale.h" 23 | 24 | using namespace imageproc; 25 | 26 | FilterData::FilterData(QImage const& image) 27 | : m_origImage(image), 28 | m_grayImage(toGrayscale(m_origImage)), 29 | m_xform(image.rect(), Dpm(image)), 30 | m_bwThreshold(BinaryThreshold::otsuThreshold(m_grayImage)) 31 | { 32 | } 33 | 34 | FilterData::FilterData(FilterData const& other, ImageTransformation const& xform) 35 | : m_origImage(other.m_origImage), 36 | m_grayImage(other.m_grayImage), 37 | m_xform(xform), 38 | m_bwThreshold(other.m_bwThreshold) 39 | { 40 | } 41 | -------------------------------------------------------------------------------- /SystemLoadWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SYSTEM_LOAD_WIDGET_H_ 20 | #define SYSTEM_LOAD_WIDGET_H_ 21 | 22 | #include "ui_SystemLoadWidget.h" 23 | #include 24 | 25 | class SystemLoadWidget : public QWidget 26 | { 27 | Q_OBJECT 28 | public: 29 | SystemLoadWidget(QWidget* parent = 0); 30 | private slots: 31 | void sliderPressed(); 32 | 33 | void sliderMoved(int prio); 34 | 35 | void valueChanged(int prio); 36 | 37 | void decreasePriority(); 38 | 39 | void increasePriority(); 40 | private: 41 | void showHideToolTip(int prio); 42 | 43 | static QString tooltipText(int prio); 44 | 45 | Ui::SystemLoadWidget ui; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /BasicImageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BASICIMAGEVIEW_H_ 20 | #define BASICIMAGEVIEW_H_ 21 | 22 | #include "ImageViewBase.h" 23 | #include "DragHandler.h" 24 | #include "ZoomHandler.h" 25 | #include "ImagePixmapUnion.h" 26 | #include "Margins.h" 27 | #include 28 | 29 | class BasicImageView : public ImageViewBase 30 | { 31 | Q_OBJECT 32 | public: 33 | BasicImageView( 34 | QImage const& image, 35 | ImagePixmapUnion const& downscaled_image = ImagePixmapUnion(), 36 | Margins const& margins = Margins()); 37 | 38 | virtual ~BasicImageView(); 39 | private: 40 | DragHandler m_dragHandler; 41 | ZoomHandler m_zoomHandler; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /NewOpenProjectPanel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NEW_OPEN_PROJECT_PANEL_H_ 20 | #define NEW_OPEN_PROJECT_PANEL_H_ 21 | 22 | #include "ui_NewOpenProjectPanel.h" 23 | #include 24 | 25 | class QString; 26 | 27 | class NewOpenProjectPanel : public QWidget, private Ui::NewOpenProjectPanel 28 | { 29 | Q_OBJECT 30 | public: 31 | NewOpenProjectPanel(QWidget* parent = 0); 32 | signals: 33 | void newProject(); 34 | 35 | void openProject(); 36 | 37 | void openRecentProject(QString const& project_file); 38 | protected: 39 | virtual void paintEvent(QPaintEvent* event); 40 | private: 41 | void addRecentProject(QString const& file_path); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /PageSelectionAccessor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PageSelectionAccessor.h" 20 | #include "PageSequence.h" 21 | 22 | PageSelectionAccessor::PageSelectionAccessor( 23 | IntrusivePtr const& provider) 24 | : m_ptrProvider(provider) 25 | { 26 | } 27 | 28 | PageSequence 29 | PageSelectionAccessor::allPages() const 30 | { 31 | return m_ptrProvider->allPages(); 32 | } 33 | 34 | std::set 35 | PageSelectionAccessor::selectedPages() const 36 | { 37 | return m_ptrProvider->selectedPages(); 38 | } 39 | 40 | std::vector 41 | PageSelectionAccessor::selectedRanges() const 42 | { 43 | return m_ptrProvider->selectedRanges(); 44 | } 45 | -------------------------------------------------------------------------------- /filters/output/DewarpingMode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "DewarpingMode.h" 20 | #include 21 | 22 | namespace output 23 | { 24 | 25 | DewarpingMode::DewarpingMode(QString const& str) 26 | { 27 | if (str == "auto") { 28 | m_mode = AUTO; 29 | } else if (str == "manual") { 30 | m_mode = MANUAL; 31 | } else { 32 | m_mode = OFF; 33 | } 34 | } 35 | 36 | QString 37 | DewarpingMode::toString() const 38 | { 39 | switch (m_mode) { 40 | case OFF: 41 | return "off"; 42 | case AUTO: 43 | return "auto"; 44 | case MANUAL: 45 | return "manual"; 46 | } 47 | 48 | assert(!"Unreachable"); 49 | return QString(); 50 | } 51 | 52 | } // namespace output 53 | -------------------------------------------------------------------------------- /imageproc/ColorInterpolation.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ColorInterpolation.h" 20 | #include 21 | 22 | namespace imageproc 23 | { 24 | 25 | QColor colorInterpolation(QColor const& from, QColor const& to, double dist) 26 | { 27 | dist = qBound(0.0, dist, 1.0); 28 | 29 | qreal r1, g1, b1, a1, r2, g2, b2, a2; 30 | from.getRgbF(&r1, &g1, &b1, &a1); 31 | to.getRgbF(&r2, &g2, &b2, &a2); 32 | 33 | qreal const r = r1 + (r2 - r1) * dist; 34 | qreal const g = g1 + (g2 - g1) * dist; 35 | qreal const b = b1 + (b2 - b1) * dist; 36 | qreal const a = a1 + (a2 - a1) * dist; 37 | 38 | return QColor::fromRgbF(r, g, b, a); 39 | } 40 | 41 | } // namespace imageproc 42 | -------------------------------------------------------------------------------- /math/spfit/FrenetFrame.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "FrenetFrame.h" 20 | #include 21 | 22 | namespace spfit 23 | { 24 | 25 | FrenetFrame::FrenetFrame(Vec2d const& origin, Vec2d const& tangent_vector, YAxisDirection ydir) 26 | : m_origin(origin) 27 | { 28 | double const sqlen = tangent_vector.squaredNorm(); 29 | if (sqlen > 1e-6) { 30 | m_unitTangent = tangent_vector / sqrt(sqlen); 31 | if (ydir == Y_POINTS_UP) { 32 | m_unitNormal[0] = -m_unitTangent[1]; 33 | m_unitNormal[1] = m_unitTangent[0]; 34 | } else { 35 | m_unitNormal[0] = m_unitTangent[1]; 36 | m_unitNormal[1] = -m_unitTangent[0]; 37 | } 38 | } 39 | } 40 | 41 | } // namespace spfit 42 | -------------------------------------------------------------------------------- /LoadFilesStatusDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LOAD_FILES_STATUS_DIALOG_H_ 20 | #define LOAD_FILES_STATUS_DIALOG_H_ 21 | 22 | #include "ui_LoadFilesStatusDialog.h" 23 | #include 24 | #include 25 | 26 | class LoadFilesStatusDialog : public QDialog 27 | { 28 | public: 29 | LoadFilesStatusDialog(QWidget* parent = 0); 30 | 31 | void setLoadedFiles(std::vector const& files); 32 | 33 | void setFailedFiles(std::vector const& failed); 34 | 35 | void setOkButtonName(QString const& name); 36 | private: 37 | Ui::LoadFilesStatusDialog ui; 38 | QString m_loadedTabNameTemplate; 39 | QString m_failedTabNameTemplate; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /PageOrderProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_ORDER_PROVIDER_H_ 20 | #define PAGE_ORDER_PROVIDER_H_ 21 | 22 | #include "RefCountable.h" 23 | 24 | class PageId; 25 | 26 | /** 27 | * A base class for different page ordering strategies. 28 | */ 29 | class PageOrderProvider : public RefCountable 30 | { 31 | public: 32 | /** 33 | * Returns true if \p lhs_page precedes \p rhs_page. 34 | * \p lhs_incomplete and \p rhs_incomplete indicate whether 35 | * a page is represented by IncompleteThumbnail. 36 | */ 37 | virtual bool precedes( 38 | PageId const& lhs_page, bool lhs_incomplete, 39 | PageId const& rhs_page, bool rhs_incomplete) const = 0; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /zones/SplineSegment.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SPLINE_SEGMENT_H_ 20 | #define SPLINE_SEGMENT_H_ 21 | 22 | #include "SplineVertex.h" 23 | #include 24 | #include 25 | 26 | class SplineSegment 27 | { 28 | public: 29 | SplineVertex::Ptr prev; 30 | SplineVertex::Ptr next; 31 | 32 | SplineSegment() {} 33 | 34 | SplineSegment(SplineVertex::Ptr const& prev, SplineVertex::Ptr const& next); 35 | 36 | SplineVertex::Ptr splitAt(QPointF const& pt); 37 | 38 | bool isValid() const; 39 | 40 | bool operator==(SplineSegment const& other) const { 41 | return prev == other.prev && next == other.next; 42 | } 43 | 44 | QLineF toLine() const { return QLineF(prev->point(), next->point()); } 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /BasicImageView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "BasicImageView.h.moc" 20 | #include "ImageTransformation.h" 21 | #include "ImagePresentation.h" 22 | #include "Dpm.h" 23 | #include "Dpi.h" 24 | 25 | BasicImageView::BasicImageView( 26 | QImage const& image, ImagePixmapUnion const& downscaled_image, Margins const& margins) 27 | : ImageViewBase( 28 | image, downscaled_image, 29 | ImagePresentation(QTransform(), QRectF(image.rect())), margins 30 | ), 31 | m_dragHandler(*this), 32 | m_zoomHandler(*this) 33 | { 34 | rootInteractionHandler().makeLastFollower(m_dragHandler); 35 | rootInteractionHandler().makeLastFollower(m_zoomHandler); 36 | } 37 | 38 | BasicImageView::~BasicImageView() 39 | { 40 | } 41 | -------------------------------------------------------------------------------- /ImagePixmapUnion.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGE_PIXMAP_UNION_H_ 20 | #define IMAGE_PIXMAP_UNION_H_ 21 | 22 | #include 23 | #include 24 | 25 | class ImagePixmapUnion 26 | { 27 | // Member-wise copying is OK. 28 | public: 29 | ImagePixmapUnion() {} 30 | 31 | ImagePixmapUnion(QImage const& image) : m_image(image) {} 32 | 33 | ImagePixmapUnion(QPixmap const& pixmap) : m_pixmap(pixmap) {} 34 | 35 | QImage const& image() const { return m_image; } 36 | 37 | QPixmap const& pixmap() const { return m_pixmap; } 38 | 39 | bool isNull() const { return m_image.isNull() && m_pixmap.isNull(); } 40 | private: 41 | QImage m_image; 42 | QPixmap m_pixmap; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /filters/output/ImageView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ImageView.h" 20 | #include "ImageView.h.moc" 21 | #include "ImagePresentation.h" 22 | #include "OutputMargins.h" 23 | 24 | namespace output 25 | { 26 | 27 | ImageView::ImageView(QImage const& image, QImage const& downscaled_image) 28 | : ImageViewBase( 29 | image, downscaled_image, 30 | ImagePresentation(QTransform(), QRectF(image.rect())), 31 | OutputMargins() 32 | ), 33 | m_dragHandler(*this), 34 | m_zoomHandler(*this) 35 | { 36 | rootInteractionHandler().makeLastFollower(m_dragHandler); 37 | rootInteractionHandler().makeLastFollower(m_zoomHandler); 38 | } 39 | 40 | ImageView::~ImageView() 41 | { 42 | } 43 | 44 | } // namespace output 45 | -------------------------------------------------------------------------------- /PageSequence.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_SEQUENCE_H_ 20 | #define PAGE_SEQUENCE_H_ 21 | 22 | #include "PageInfo.h" 23 | #include 24 | #include 25 | #include 26 | 27 | class PageSequence 28 | { 29 | // Member-wise copying is OK. 30 | public: 31 | void append(PageInfo const& page_info); 32 | 33 | size_t numPages() const { return m_pages.size(); } 34 | 35 | PageInfo const& pageAt(size_t idx) const; 36 | 37 | std::set selectAll() const; 38 | 39 | std::set selectPagePlusFollowers(PageId const& page) const; 40 | 41 | std::set selectEveryOther(PageId const& base) const; 42 | private: 43 | std::vector m_pages; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /filters/page_layout/OrderByWidthProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_LAYOUT_ORDER_BY_WIDTH_PROVIDER_H_ 20 | #define PAGE_LAYOUT_ORDER_BY_WIDTH_PROVIDER_H_ 21 | 22 | #include "Settings.h" 23 | #include "IntrusivePtr.h" 24 | #include "PageOrderProvider.h" 25 | 26 | namespace page_layout 27 | { 28 | 29 | class OrderByWidthProvider : public PageOrderProvider 30 | { 31 | public: 32 | OrderByWidthProvider(IntrusivePtr const& settings); 33 | 34 | virtual bool precedes( 35 | PageId const& lhs_page, bool lhs_incomplete, 36 | PageId const& rhs_page, bool rhs_incomplete) const; 37 | private: 38 | IntrusivePtr m_ptrSettings; 39 | }; 40 | 41 | } // namespace page_layout 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /foundation/PropertyFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PROPERTY_FACTORY_H_ 20 | #define PROPERTY_FACTORY_H_ 21 | 22 | #include "Property.h" 23 | #include "IntrusivePtr.h" 24 | #include 25 | #include 26 | 27 | class QDomElement; 28 | 29 | class PropertyFactory 30 | { 31 | // Member-wise copying is OK. 32 | public: 33 | virtual ~PropertyFactory() {} 34 | 35 | typedef IntrusivePtr (*PropertyConstructor)(QDomElement const& el); 36 | 37 | void registerProperty(QString const& property, PropertyConstructor constructor); 38 | 39 | IntrusivePtr construct(QDomElement const& el) const; 40 | private: 41 | typedef std::map Registry; 42 | Registry m_registry; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /imageproc/LeastSquaresFit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_LEAST_SQUARES_FIT_H_ 20 | #define IMAGEPROC_LEAST_SQUARES_FIT_H_ 21 | 22 | class QSize; 23 | 24 | namespace imageproc 25 | { 26 | 27 | /** 28 | * \brief Solves C * x - d = r, |r| = min! 29 | * 30 | * \param C_size Dimensions of the C matrix. 31 | * \param C The C matrix stored linearly in row-major order. It's contents 32 | * won't be preserved. 33 | * \param x The resulting vector of C_size.width() elements. 34 | * \param d The d vector of C_size.height() elements. It's contents won't 35 | * be preserved. 36 | */ 37 | void leastSquaresFit(QSize const& C_size, double* C, double* x, double* d); 38 | 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /PngMetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PNGMETADATALOADER_H_ 20 | #define PNGMETADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class PngMetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /RelinkingListView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RELINKING_LIST_VIEW_H_ 20 | #define RELINKING_LIST_VIEW_H_ 21 | 22 | #include 23 | 24 | class QPainter; 25 | class QRect; 26 | class QModelIndex; 27 | 28 | class RelinkingListView : public QListView 29 | { 30 | public: 31 | RelinkingListView(QWidget* parent = 0); 32 | protected: 33 | virtual void paintEvent(QPaintEvent* e); 34 | private: 35 | class Delegate; 36 | class IndicationGroup; 37 | class GroupAggregator; 38 | 39 | void maybeDrawStatusLayer(QPainter* painter, 40 | QModelIndex const& item_index, QRect const& item_paint_rect); 41 | 42 | void drawStatusLayer(QPainter* painter); 43 | 44 | bool m_statusLayerDrawn; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /filters/page_layout/OrderByHeightProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_LAYOUT_ORDER_BY_HEIGHT_PROVIDER_H_ 20 | #define PAGE_LAYOUT_ORDER_BY_HEIGHT_PROVIDER_H_ 21 | 22 | #include "Settings.h" 23 | #include "IntrusivePtr.h" 24 | #include "PageOrderProvider.h" 25 | 26 | namespace page_layout 27 | { 28 | 29 | class OrderByHeightProvider : public PageOrderProvider 30 | { 31 | public: 32 | OrderByHeightProvider(IntrusivePtr const& settings); 33 | 34 | virtual bool precedes( 35 | PageId const& lhs_page, bool lhs_incomplete, 36 | PageId const& rhs_page, bool rhs_incomplete) const; 37 | private: 38 | IntrusivePtr m_ptrSettings; 39 | }; 40 | 41 | } // namespace page_layout 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /JpegMetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef JPEGMETADATALOADER_H_ 20 | #define JPEGMETADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class JpegMetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /TiffMetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef TIFFMETADATALOADER_H_ 20 | #define TIFFMETADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class TiffMetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /filters/select_content/OrderByWidthProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SELECT_CONTENT_ORDER_BY_WIDTH_PROVIDER_H_ 20 | #define SELECT_CONTENT_ORDER_BY_WIDTH_PROVIDER_H_ 21 | 22 | #include "Settings.h" 23 | #include "IntrusivePtr.h" 24 | #include "PageOrderProvider.h" 25 | 26 | namespace select_content 27 | { 28 | 29 | class OrderByWidthProvider : public PageOrderProvider 30 | { 31 | public: 32 | OrderByWidthProvider(IntrusivePtr const& settings); 33 | 34 | virtual bool precedes( 35 | PageId const& lhs_page, bool lhs_incomplete, 36 | PageId const& rhs_page, bool rhs_incomplete) const; 37 | private: 38 | IntrusivePtr m_ptrSettings; 39 | }; 40 | 41 | } // namespace select_content 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Dpi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Dpi.h" 20 | #include "Dpm.h" 21 | #include "imageproc/Constants.h" 22 | #include 23 | 24 | using namespace imageproc; 25 | 26 | Dpi::Dpi(QSize const size) 27 | : m_xDpi(size.width()), 28 | m_yDpi(size.height()) 29 | { 30 | } 31 | 32 | Dpi::Dpi(Dpm const dpm) 33 | : m_xDpi(qRound(dpm.horizontal() * constants::DPM2DPI)), 34 | m_yDpi(qRound(dpm.vertical() * constants::DPM2DPI)) 35 | { 36 | } 37 | 38 | QSize 39 | Dpi::toSize() const 40 | { 41 | if (isNull()) { 42 | return QSize(); 43 | } else { 44 | return QSize(m_xDpi, m_yDpi); 45 | } 46 | } 47 | 48 | bool 49 | Dpi::operator==(Dpi const& other) const 50 | { 51 | return m_xDpi == other.m_xDpi && m_yDpi == other.m_yDpi; 52 | } 53 | -------------------------------------------------------------------------------- /filters/select_content/OrderByHeightProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SELECT_CONTENT_ORDER_BY_HEIGHT_PROVIDER_H_ 20 | #define SELECT_CONTENT_ORDER_BY_HEIGHT_PROVIDER_H_ 21 | 22 | #include "Settings.h" 23 | #include "IntrusivePtr.h" 24 | #include "PageOrderProvider.h" 25 | 26 | namespace select_content 27 | { 28 | 29 | class OrderByHeightProvider : public PageOrderProvider 30 | { 31 | public: 32 | OrderByHeightProvider(IntrusivePtr const& settings); 33 | 34 | virtual bool precedes( 35 | PageId const& lhs_page, bool lhs_incomplete, 36 | PageId const& rhs_page, bool rhs_incomplete) const; 37 | private: 38 | IntrusivePtr m_ptrSettings; 39 | }; 40 | 41 | } // namespace select_content 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /filters/output/PictureZonePropDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_PICTURE_ZONE_PROP_DIALOG_H_ 20 | #define OUTPUT_PICTURE_ZONE_PROP_DIALOG_H_ 21 | 22 | #include "ui_PictureZonePropDialog.h" 23 | #include "PropertySet.h" 24 | #include "IntrusivePtr.h" 25 | #include 26 | 27 | namespace output 28 | { 29 | 30 | class PictureZonePropDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | public: 34 | PictureZonePropDialog(IntrusivePtr const& props, QWidget* parent = 0); 35 | signals: 36 | void updated(); 37 | private slots: 38 | void itemToggled(bool selected); 39 | private: 40 | Ui::PictureZonePropDialog ui; 41 | IntrusivePtr m_ptrProps; 42 | }; 43 | 44 | } // namespace output 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /math/LineIntersectionScalar.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LINE_INTERSECTION_SCALAR_H_ 20 | #define LINE_INTERSECTION_SCALAR_H_ 21 | 22 | #include 23 | 24 | /** 25 | * Finds such scalars s1 and s2, so that "line1.pointAt(s1)" and "line2.pointAt(s2)" 26 | * would be the intersection point between line1 and line2. Returns false if the 27 | * lines are parallel or if any of the lines have zero length and therefore no direction. 28 | */ 29 | bool lineIntersectionScalar(QLineF const& line1, QLineF const& line2, double& s1, double& s2); 30 | 31 | /** 32 | * Same as the one above, but doesn't bother to calculate s2. 33 | */ 34 | bool lineIntersectionScalar(QLineF const& line1, QLineF const& line2, double& s1); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /filters/output/TabbedImageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_TABBED_IMAGE_VIEW_H_ 20 | #define OUTPUT_TABBED_IMAGE_VIEW_H_ 21 | 22 | #include "ImageViewTab.h" 23 | #include 24 | #include 25 | 26 | namespace output 27 | { 28 | 29 | class TabbedImageView : public QTabWidget 30 | { 31 | Q_OBJECT 32 | public: 33 | TabbedImageView(QWidget* parent = 0); 34 | 35 | void addTab(QWidget* widget, QString const& label, ImageViewTab tab); 36 | public slots: 37 | void setCurrentTab(ImageViewTab tab); 38 | signals: 39 | void tabChanged(ImageViewTab tab); 40 | private slots: 41 | void tabChangedSlot(int idx); 42 | private: 43 | std::map m_registry; 44 | }; 45 | 46 | } // namespace output 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /OpenGLSupport.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "OpenGLSupport.h" 20 | #include "config.h" 21 | #include 22 | #ifdef ENABLE_OPENGL 23 | #include 24 | #include 25 | #endif 26 | 27 | bool 28 | OpenGLSupport::supported() 29 | { 30 | #ifndef ENABLE_OPENGL 31 | return false; 32 | #else 33 | if (!QGLFormat::hasOpenGL()) { 34 | return false; 35 | } 36 | 37 | QGLFormat format; 38 | format.setSampleBuffers(true); 39 | format.setStencil(true); 40 | format.setAlpha(true); 41 | 42 | QGLWidget widget(format); 43 | format = widget.format(); 44 | 45 | if (!format.sampleBuffers()) { 46 | return false; 47 | } 48 | if (!format.stencil()) { 49 | return false; 50 | } 51 | if (!format.alpha()) { 52 | return false; 53 | } 54 | 55 | return true; 56 | #endif 57 | } 58 | -------------------------------------------------------------------------------- /FilterResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FILTERRESULT_H_ 20 | #define FILTERRESULT_H_ 21 | 22 | #include "IntrusivePtr.h" 23 | #include "RefCountable.h" 24 | 25 | class AbstractFilter; 26 | class FilterUiInterface; 27 | 28 | class FilterResult : public RefCountable 29 | { 30 | public: 31 | virtual void updateUI(FilterUiInterface* ui) = 0; 32 | 33 | /** 34 | * \brief Return the filter that generated this result. 35 | * \note Returning a null smart pointer indicates that the result 36 | * was generated by a task that doesn't belong to a filter. 37 | * That would be LoadFileTask. 38 | */ 39 | 40 | virtual IntrusivePtr filter() = 0; 41 | }; 42 | 43 | typedef IntrusivePtr FilterResultPtr; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /PageRange.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PageRange.h" 20 | #include 21 | 22 | std::set 23 | PageRange::selectEveryOther(PageId const& base) const 24 | { 25 | std::set selection; 26 | 27 | std::vector::const_iterator it(pages.begin()); 28 | std::vector::const_iterator const end(pages.end()); 29 | for (; it != end && *it != base; ++it) { 30 | // Continue until we have a match. 31 | } 32 | if (it == end) { 33 | return selection; 34 | } 35 | 36 | int const base_idx = it - pages.begin(); 37 | int idx = 0; 38 | BOOST_FOREACH(PageId const& page_id, pages) { 39 | if (((idx - base_idx) & 1) == 0) { 40 | selection.insert(page_id); 41 | } 42 | ++idx; 43 | } 44 | 45 | return selection; 46 | } 47 | -------------------------------------------------------------------------------- /filters/deskew/Thumbnail.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DESKEW_THUMBNAIL_H_ 20 | #define DESKEW_THUMBNAIL_H_ 21 | 22 | #include "ThumbnailBase.h" 23 | #include "IntrusivePtr.h" 24 | 25 | class QSizeF; 26 | class ThumbnailPixmapCache; 27 | class ImageId; 28 | class ImageTransformation; 29 | 30 | namespace deskew 31 | { 32 | 33 | class Thumbnail : public ThumbnailBase 34 | { 35 | public: 36 | Thumbnail(IntrusivePtr const& thumbnail_cache, 37 | QSizeF const& max_size, ImageId const& image_id, 38 | ImageTransformation const& xform); 39 | 40 | virtual void paintOverImage( 41 | QPainter& painter, 42 | QTransform const& image_to_display, 43 | QTransform const& thumb_to_display); 44 | }; 45 | 46 | } // namespace deskew 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /PageSelectionAccessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_SELECTION_ACCESSOR_H_ 20 | #define PAGE_SELECTION_ACCESSOR_H_ 21 | 22 | #include "PageSelectionProvider.h" 23 | #include "PageId.h" 24 | #include "PageRange.h" 25 | #include "IntrusivePtr.h" 26 | #include 27 | #include 28 | 29 | class PageSequence; 30 | 31 | class PageSelectionAccessor 32 | { 33 | // Member-wise copying is OK. 34 | public: 35 | explicit PageSelectionAccessor( 36 | IntrusivePtr const& provider); 37 | 38 | PageSequence allPages() const; 39 | 40 | std::set selectedPages() const; 41 | 42 | std::vector selectedRanges() const; 43 | private: 44 | IntrusivePtr m_ptrProvider; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /SmartFilenameOrdering.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SMARTFILENAMEORDERING_H_ 20 | #define SMARTFILENAMEORDERING_H_ 21 | 22 | class QFileInfo; 23 | 24 | class SmartFilenameOrdering 25 | { 26 | public: 27 | SmartFilenameOrdering() {} 28 | 29 | /** 30 | * \brief Compare filenames using a set of heuristic rules. 31 | * 32 | * This function tries to mimic the way humans would order filenames. 33 | * For example, "2.png" will go before "12.png". While doing so, 34 | * it still provides the usual guarantees of a comparison predicate, 35 | * such as two different file paths will never be ruled equivalent. 36 | * 37 | * \return true if \p lhs should go before \p rhs. 38 | */ 39 | bool operator()(QFileInfo const& lhs, QFileInfo const& rhs) const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /ImageFileInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEFILEINFO_H_ 20 | #define IMAGEFILEINFO_H_ 21 | 22 | #include "ImageMetadata.h" 23 | #include 24 | #include 25 | 26 | class ImageFileInfo 27 | { 28 | // Member-wise copying is OK. 29 | public: 30 | ImageFileInfo(QFileInfo const& file_info, std::vector const& image_info) 31 | : m_fileInfo(file_info), m_imageInfo(image_info) {} 32 | 33 | QFileInfo const& fileInfo() const { return m_fileInfo; } 34 | 35 | std::vector& imageInfo() { return m_imageInfo; } 36 | 37 | std::vector const& imageInfo() const { return m_imageInfo; } 38 | 39 | bool isDpiOK() const; 40 | private: 41 | QFileInfo m_fileInfo; 42 | std::vector m_imageInfo; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /math/SidesOfLine.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SIDES_OF_LINE_H_ 20 | #define SIDES_OF_LINE_H_ 21 | 22 | #include 23 | #include 24 | 25 | /** 26 | * This function allows you to check if a pair of points is on the same 27 | * or different sides of a line. 28 | * 29 | * Returns: 30 | * \li Negative value, if points are on different sides of line. 31 | * \li Positive value, if points are on the same side of line. 32 | * \li Zero, if one or both of the points are on the line. 33 | * 34 | * \note Line's endpoints don't matter - consider the whole line, 35 | * not a line segment. If the line is really a point, zero will 36 | * always be returned. 37 | */ 38 | qreal sidesOfLine(QLineF const& line, QPointF const& p1, QPointF const& p2); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /filters/select_content/PhysSizeCalc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PhysSizeCalc.h" 20 | #include "ImageTransformation.h" 21 | #include "PhysicalTransformation.h" 22 | #include 23 | 24 | namespace select_content 25 | { 26 | 27 | PhysSizeCalc::PhysSizeCalc() 28 | { 29 | } 30 | 31 | PhysSizeCalc::PhysSizeCalc(ImageTransformation const& xform) 32 | : m_virtToPhys(xform.transformBack() * PhysicalTransformation(xform.origDpi()).pixelsToMM()) 33 | { 34 | } 35 | 36 | QSizeF 37 | PhysSizeCalc::sizeMM(QRectF const& rect_px) const 38 | { 39 | QPolygonF const poly_mm(m_virtToPhys.map(rect_px)); 40 | QSizeF const size_mm( 41 | QLineF(poly_mm[0], poly_mm[1]).length(), 42 | QLineF(poly_mm[1], poly_mm[2]).length() 43 | ); 44 | return size_mm; 45 | } 46 | 47 | } // namespace select_content 48 | -------------------------------------------------------------------------------- /imageproc/MorphGradientDetect.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "MorphGradientDetect.h" 20 | #include "Morphology.h" 21 | #include "Grayscale.h" 22 | #include "GrayRasterOp.h" 23 | #include 24 | #include 25 | 26 | namespace imageproc 27 | { 28 | 29 | GrayImage morphGradientDetectDarkSide(GrayImage const& image, QSize const& area) 30 | { 31 | GrayImage lighter(erodeGray(image, area, 0x00)); 32 | grayRasterOp >(lighter, image); 33 | return lighter; 34 | } 35 | 36 | GrayImage morphGradientDetectLightSide(GrayImage const& image, QSize const& area) 37 | { 38 | GrayImage darker(dilateGray(image, area, 0xff)); 39 | grayRasterOp >(darker, image); 40 | return darker; 41 | } 42 | 43 | } // namespace imageproc 44 | 45 | -------------------------------------------------------------------------------- /math/spfit/ModelShape.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SPFIT_MODEL_SHAPE_H_ 20 | #define SPFIT_MODEL_SHAPE_H_ 21 | 22 | #include "SqDistApproximant.h" 23 | #include "FittableSpline.h" 24 | #include 25 | 26 | namespace spfit 27 | { 28 | 29 | /** 30 | * \brief A shape we are trying to fit a spline to. 31 | * 32 | * Could be a polyline or maybe a point cloud. 33 | */ 34 | class ModelShape 35 | { 36 | public: 37 | virtual ~ModelShape() {} 38 | 39 | /** 40 | * Returns a function that approximates the squared distance to the model. 41 | * The function is only accurate in the neighbourhood of \p pt. 42 | */ 43 | virtual SqDistApproximant localSqDistApproximant( 44 | QPointF const& pt, FittableSpline::SampleFlags flags) const = 0; 45 | }; 46 | 47 | } // namespace spfit 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /foundation/RefCountable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef REFCOUNTABLE_H_ 20 | #define REFCOUNTABLE_H_ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | 28 | class RefCountable 29 | { 30 | public: 31 | RefCountable() : m_refCounter(0) {} 32 | 33 | RefCountable(RefCountable const& other) { 34 | // don't copy the reference counter! 35 | } 36 | 37 | void operator=(RefCountable const& other) { 38 | // don't copy the reference counter! 39 | } 40 | 41 | virtual ~RefCountable() {} 42 | 43 | void ref() const { m_refCounter.fetchAndAddRelaxed(1); } 44 | 45 | void unref() const { 46 | if (m_refCounter.fetchAndAddRelease(-1) == 1) { 47 | delete this; 48 | } 49 | } 50 | private: 51 | mutable QAtomicInt m_refCounter; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /TabbedDebugImages.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "TabbedDebugImages.h.moc" 20 | #include "DebugImageView.h" 21 | 22 | TabbedDebugImages::TabbedDebugImages(QWidget* parent) 23 | : QTabWidget(parent) 24 | { 25 | setDocumentMode(true); 26 | connect(this, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int))); 27 | } 28 | 29 | void 30 | TabbedDebugImages::currentTabChanged(int const idx) 31 | { 32 | if (DebugImageView* div = dynamic_cast(widget(idx))) { 33 | div->unlink(); 34 | m_liveViews.push_back(*div); 35 | removeExcessLiveViews(); 36 | div->setLive(true); 37 | } 38 | } 39 | 40 | void 41 | TabbedDebugImages::removeExcessLiveViews() 42 | { 43 | int remaining = m_liveViews.size(); 44 | for (; remaining > MAX_LIVE_VIEWS; --remaining) { 45 | m_liveViews.front().setLive(false); 46 | m_liveViews.erase(m_liveViews.begin()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /filters/output/DepthPerception.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_DEPTH_PERCEPTION_H_ 20 | #define OUTPUT_DEPTH_PERCEPTION_H_ 21 | 22 | #include 23 | 24 | namespace output 25 | { 26 | 27 | /** 28 | * \see imageproc::CylindricalSurfaceDewarper 29 | */ 30 | class DepthPerception 31 | { 32 | public: 33 | DepthPerception(); 34 | 35 | DepthPerception(double value); 36 | 37 | explicit DepthPerception(QString const& from_string); 38 | 39 | QString toString() const; 40 | 41 | void setValue(double value); 42 | 43 | double value() const { return m_value; } 44 | 45 | static double minValue() { return 1.0; } 46 | 47 | static double defaultValue() { return 2.0; } 48 | 49 | static double maxValue() { return 3.0; } 50 | private: 51 | double m_value; 52 | }; 53 | 54 | } // namespace output 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /filters/select_content/PhysContentSizeCalc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PhysSizeCalc.h" 20 | #include "ImageTransformation.h" 21 | #include "PhysicalTransformation.h" 22 | #include 23 | #include 24 | 25 | namespace select_content 26 | { 27 | 28 | PhysSizeCalc::PhysSizeCalc() 29 | { 30 | } 31 | 32 | PhysSizeCalc::PhysSizeCalc(ImageTransformation const& xform) 33 | : m_virtToPhys(xform.transformBack() * PhysicalTransformation(xform.origDpi()).pixelsToMM()) 34 | { 35 | } 36 | 37 | QSizeF 38 | PhysSizeCalc::sizeMM(QRectF const& rect_px) const 39 | { 40 | QPolygonF const poly_mm(m_virtToPhys.map(rect_px)); 41 | QSizeF const size_mm( 42 | QLineF(poly_mm[0], poly_mm[1]).length(), 43 | QLineF(poly_mm[1], poly_mm[2]).length() 44 | ); 45 | return size_mm; 46 | } 47 | 48 | } // namespace select_content 49 | -------------------------------------------------------------------------------- /AbstractCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ABSTRACTCOMMAND_H_ 20 | #define ABSTRACTCOMMAND_H_ 21 | 22 | #include "RefCountable.h" 23 | #include "IntrusivePtr.h" 24 | 25 | template 26 | class AbstractCommand0 : public RefCountable 27 | { 28 | public: 29 | typedef IntrusivePtr Ptr; 30 | 31 | virtual R operator()() = 0; 32 | }; 33 | 34 | template 35 | class AbstractCommand1 : public RefCountable 36 | { 37 | public: 38 | typedef IntrusivePtr Ptr; 39 | 40 | virtual R operator()(A1 arg1) = 0; 41 | }; 42 | 43 | template 44 | class AbstractCommand2 : public RefCountable 45 | { 46 | public: 47 | typedef IntrusivePtr Ptr; 48 | 49 | virtual R operator()(T1 arg1, T2 arg2) = 0; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Dpi.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DPI_H_ 20 | #define DPI_H_ 21 | 22 | #include 23 | 24 | class Dpm; 25 | 26 | /** 27 | * \brief Dots per inch (horizontal and vertical). 28 | */ 29 | class Dpi 30 | { 31 | public: 32 | Dpi() : m_xDpi(0), m_yDpi(0) {} 33 | 34 | Dpi(int horizontal, int vertical) : m_xDpi(horizontal), m_yDpi(vertical) {} 35 | 36 | Dpi(Dpm dpm); 37 | 38 | explicit Dpi(QSize size); 39 | 40 | int horizontal() const { return m_xDpi; } 41 | 42 | int vertical() const { return m_yDpi; } 43 | 44 | QSize toSize() const; 45 | 46 | bool isNull() const { return m_xDpi <= 1 || m_yDpi <= 1; } 47 | 48 | bool operator==(Dpi const& other) const; 49 | 50 | bool operator!=(Dpi const& other) const { return !(*this == other); } 51 | private: 52 | int m_xDpi; 53 | int m_yDpi; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /filters/fix_orientation/ImageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FIX_ORIENTATION_IMAGEVIEW_H_ 20 | #define FIX_ORIENTATION_IMAGEVIEW_H_ 21 | 22 | #include "ImageViewBase.h" 23 | #include "OrthogonalRotation.h" 24 | #include "ImageTransformation.h" 25 | #include "DragHandler.h" 26 | #include "ZoomHandler.h" 27 | 28 | namespace fix_orientation 29 | { 30 | 31 | class ImageView : public ImageViewBase 32 | { 33 | Q_OBJECT 34 | public: 35 | ImageView( 36 | QImage const& image, QImage const& downscaled_image, 37 | ImageTransformation const& xform); 38 | 39 | virtual ~ImageView(); 40 | public slots: 41 | void setPreRotation(OrthogonalRotation rotation); 42 | private: 43 | DragHandler m_dragHandler; 44 | ZoomHandler m_zoomHandler; 45 | ImageTransformation m_xform; 46 | }; 47 | 48 | } // namespace fix_orientation 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /math/spfit/OptimizationResult.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "OptimizationResult.h" 20 | #include 21 | #include 22 | 23 | namespace spfit 24 | { 25 | 26 | OptimizationResult::OptimizationResult( 27 | double force_before, double force_after) 28 | : m_forceBefore(std::max(force_before, 0)), 29 | m_forceAfter(std::max(force_after, 0)) 30 | { 31 | // In theory, these distances can't be negative, but in practice they can. 32 | // We are going to treat negative ones as they are zeros. 33 | } 34 | 35 | double 36 | OptimizationResult::improvementPercentage() const 37 | { 38 | double improvement = m_forceBefore - m_forceAfter; 39 | improvement /= (m_forceBefore + std::numeric_limits::epsilon()); 40 | return improvement * 100; // Convert to percents. 41 | } 42 | 43 | } // namespace spfit 44 | -------------------------------------------------------------------------------- /PageOrderOption.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_ORDER_OPTION_H_ 20 | #define PAGE_ORDER_OPTION_H_ 21 | 22 | #include "IntrusivePtr.h" 23 | #include "PageOrderProvider.h" 24 | #include 25 | 26 | class PageOrderOption 27 | { 28 | // Member-wise copying is OK. 29 | public: 30 | typedef IntrusivePtr ProviderPtr; 31 | 32 | PageOrderOption(QString const& name, ProviderPtr const& provider) 33 | : m_name(name), m_ptrProvider(provider) {} 34 | 35 | QString const& name() const { return m_name; } 36 | 37 | /** 38 | * Returns the ordering information provider. 39 | * A null provider is OK and is to be interpreted as default order. 40 | */ 41 | ProviderPtr const& provider() const { return m_ptrProvider; } 42 | private: 43 | QString m_name; 44 | ProviderPtr m_ptrProvider; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /filters/page_split/OrderBySplitTypeProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | Copyright (C) Vadim Kuznetsov ()DikBSD 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef PAGE_SPLIT_ORDER_BY_SPLIT_TYPE_PROVIDER_H_ 21 | #define PAGE_SPLIT_ORDER_BY_SPLIT_TYPE_PROVIDER_H_ 22 | 23 | #include "Settings.h" 24 | #include "IntrusivePtr.h" 25 | #include "PageOrderProvider.h" 26 | 27 | namespace page_split 28 | { 29 | 30 | class OrderBySplitTypeProvider : public PageOrderProvider 31 | { 32 | public: 33 | OrderBySplitTypeProvider(IntrusivePtr const& settings); 34 | 35 | virtual bool precedes( 36 | PageId const& lhs_page, bool lhs_incomplete, 37 | PageId const& rhs_page, bool rhs_incomplete) const; 38 | private: 39 | IntrusivePtr m_ptrSettings; 40 | }; 41 | 42 | } // namespace page_split 43 | 44 | #endif //PAGE_SPLIT_ORDER_BY_SPLIT_TYPE_PROVIDER_H_ 45 | -------------------------------------------------------------------------------- /TabbedDebugImages.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef TABBED_DEBUG_IMAGES_H_ 20 | #define TABBED_DEBUG_IMAGES_H_ 21 | 22 | #include "DebugImageView.h" 23 | #include 24 | #include 25 | 26 | class TabbedDebugImages : public QTabWidget 27 | { 28 | Q_OBJECT 29 | public: 30 | TabbedDebugImages(QWidget* parent = 0); 31 | private slots: 32 | void currentTabChanged(int idx); 33 | private: 34 | typedef boost::intrusive::list< 35 | DebugImageView, boost::intrusive::constant_time_size 36 | > DebugViewList; 37 | 38 | enum { MAX_LIVE_VIEWS = 3 }; 39 | 40 | void removeExcessLiveViews(); 41 | 42 | /** 43 | * We don't want to keep all the debug images in memory. We normally keep 44 | * only a few of them. This list holds references to them in the order 45 | * they become live. 46 | */ 47 | DebugViewList m_liveViews; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /packaging/osx/makeapp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$#" -lt 3 ] 4 | then 5 | echo "Usage: makeapp.sh " 6 | echo " " 7 | echo "dest_dir is where the output files are created." 8 | echo "scantailor_source_dir is where the scantailor source files are." 9 | echo "build_dir is the working directory where dependency libs are built." 10 | echo "" 11 | exit 0 12 | fi 13 | 14 | DESTDIR=$1 15 | SRCDIR=$2 16 | BUILDDIR=$3 17 | 18 | export APP=$DESTDIR/ScanTailor.app 19 | export APPC=$APP/Contents 20 | export APPM=$APPC/MacOS 21 | export APPR=$APPC/Resources 22 | export APPF=$APPC/Frameworks 23 | 24 | rm -rf $APP 25 | mkdir -p $APPC 26 | mkdir -p $APPM 27 | mkdir -p $APPR 28 | mkdir -p $APPF 29 | 30 | cp $SRCDIR/packaging/osx/ScanTailor.icns $APPR 31 | cp $SRCDIR/scantailor_*.qm $APPR 32 | cp $SRCDIR/scantailor $APPM/ScanTailor 33 | 34 | stver=`cat version.h | grep 'VERSION "' | cut -d ' ' -f 3 | tr -d '"'` 35 | cat $SRCDIR/packaging/osx/Info.plist.in | sed "s/@VERSION@/$stver/" > $APPC/Info.plist 36 | 37 | otool -L $APPM/ScanTailor | tail -n +2 | tr -d '\t' | cut -f 1 -d ' ' | while read line; do 38 | case $line in 39 | $BUILDDIR/*) 40 | ourlib=`basename $line` 41 | cp $line $APPF >/dev/null 2>&1 42 | install_name_tool -change $line @executable_path/../Frameworks/$ourlib $APPM/ScanTailor 43 | install_name_tool -id @executable_path/../Frameworks/$ourlib $APPF/$ourlib 44 | ;; 45 | esac 46 | done 47 | 48 | rm -rf ScanTailor.dmg $DESTDIR/ScanTailor-$stver.dmg 49 | cd $DESTDIR 50 | macdeployqt $DESTDIR/ScanTailor.app -dmg >/dev/null 2>&1 51 | mv ScanTailor.dmg $DESTDIR/ScanTailor-$stver.dmg 52 | 53 | --------------------------------------------------------------------------------