├── .clang-format ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── AddDynamicLibraryLocations.cmake ├── CopyToBuildDir.cmake ├── ListItemsPrepend.cmake ├── SetDefaultBuildType.cmake ├── UpdateTranslations.cmake ├── cmake_uninstall.cmake.in └── copy_to_build_dir.cmake.in ├── config.h.in ├── src ├── CMakeLists.txt ├── app │ ├── AboutDialog.ui │ ├── BatchProcessingLowerPanel.ui │ ├── CMakeLists.txt │ ├── DefaultParamsDialog.cpp │ ├── DefaultParamsDialog.h │ ├── DefaultParamsDialog.ui │ ├── FixDpiDialog.cpp │ ├── FixDpiDialog.h │ ├── FixDpiDialog.ui │ ├── LoadFilesStatusDialog.cpp │ ├── LoadFilesStatusDialog.h │ ├── LoadFilesStatusDialog.ui │ ├── MainWindow.cpp │ ├── MainWindow.h │ ├── MainWindow.ui │ ├── NewOpenProjectPanel.cpp │ ├── NewOpenProjectPanel.h │ ├── NewOpenProjectPanel.ui │ ├── OutOfMemoryDialog.cpp │ ├── OutOfMemoryDialog.h │ ├── OutOfMemoryDialog.ui │ ├── ProjectCreationContext.cpp │ ├── ProjectCreationContext.h │ ├── ProjectFilesDialog.cpp │ ├── ProjectFilesDialog.h │ ├── ProjectFilesDialog.ui │ ├── ProjectOpeningContext.cpp │ ├── ProjectOpeningContext.h │ ├── RelinkablePathVisualization.cpp │ ├── RelinkablePathVisualization.h │ ├── RelinkingDialog.cpp │ ├── RelinkingDialog.h │ ├── RelinkingDialog.ui │ ├── RelinkingListView.cpp │ ├── RelinkingListView.h │ ├── RelinkingModel.cpp │ ├── RelinkingModel.h │ ├── RelinkingSortingModel.cpp │ ├── RelinkingSortingModel.h │ ├── RemovePagesDialog.ui │ ├── SettingsDialog.cpp │ ├── SettingsDialog.h │ ├── SettingsDialog.ui │ ├── StatusBarPanel.cpp │ ├── StatusBarPanel.h │ ├── StatusBarPanel.ui │ ├── SystemLoadWidget.cpp │ ├── SystemLoadWidget.h │ ├── SystemLoadWidget.ui │ ├── ThumbnailSequence.cpp │ ├── ThumbnailSequence.h │ └── main.cpp ├── core │ ├── AbstractCommand.h │ ├── AbstractFilter.h │ ├── AbstractFilterDataCollector.h │ ├── AbstractIconPack.cpp │ ├── AbstractIconPack.h │ ├── AbstractRelinker.h │ ├── Application.cpp │ ├── Application.h │ ├── ApplicationSettings.cpp │ ├── ApplicationSettings.h │ ├── AtomicFileOverwriter.cpp │ ├── AtomicFileOverwriter.h │ ├── AutoManualMode.cpp │ ├── AutoManualMode.h │ ├── BackgroundExecutor.cpp │ ├── BackgroundExecutor.h │ ├── BackgroundTask.cpp │ ├── BackgroundTask.h │ ├── BasicImageView.cpp │ ├── BasicImageView.h │ ├── BeforeOrAfter.h │ ├── BlackOnWhiteEstimator.cpp │ ├── BlackOnWhiteEstimator.h │ ├── BubbleAnimation.cpp │ ├── BubbleAnimation.h │ ├── CMakeLists.txt │ ├── ChangedStateItemDelegate.h │ ├── CollapsibleGroupBox.cpp │ ├── CollapsibleGroupBox.h │ ├── ColorScheme.h │ ├── ColorSchemeFactory.cpp │ ├── ColorSchemeFactory.h │ ├── ColorSchemeManager.cpp │ ├── ColorSchemeManager.h │ ├── CompositeCacheDrivenTask.h │ ├── ConnectionManager.cpp │ ├── ConnectionManager.h │ ├── ContentBoxCollector.h │ ├── ContentBoxPropagator.cpp │ ├── ContentBoxPropagator.h │ ├── ContentMask.cpp │ ├── ContentMask.h │ ├── ContentSpanFinder.cpp │ ├── ContentSpanFinder.h │ ├── DarkColorScheme.cpp │ ├── DarkColorScheme.h │ ├── DebugImageView.cpp │ ├── DebugImageView.h │ ├── DebugImagesImpl.cpp │ ├── DebugImagesImpl.h │ ├── DefaultParams.cpp │ ├── DefaultParams.h │ ├── DefaultParamsProfileManager.cpp │ ├── DefaultParamsProfileManager.h │ ├── DefaultParamsProvider.cpp │ ├── DefaultParamsProvider.h │ ├── Despeckle.cpp │ ├── Despeckle.h │ ├── DeviationProvider.h │ ├── ErrorWidget.cpp │ ├── ErrorWidget.h │ ├── ErrorWidget.ui │ ├── EstimateBackground.cpp │ ├── EstimateBackground.h │ ├── FileNameDisambiguator.cpp │ ├── FileNameDisambiguator.h │ ├── FilterData.cpp │ ├── FilterData.h │ ├── FilterOptionsWidget.cpp │ ├── FilterOptionsWidget.h │ ├── FilterResult.h │ ├── FilterUiInterface.h │ ├── FontIconPack.cpp │ ├── FontIconPack.h │ ├── IconPack.h │ ├── IconProvider.cpp │ ├── IconProvider.h │ ├── ImageFileInfo.cpp │ ├── ImageFileInfo.h │ ├── ImageId.cpp │ ├── ImageId.h │ ├── ImageInfo.cpp │ ├── ImageInfo.h │ ├── ImageLoader.cpp │ ├── ImageLoader.h │ ├── ImageMetadata.cpp │ ├── ImageMetadata.h │ ├── ImageMetadataLoader.cpp │ ├── ImageMetadataLoader.h │ ├── ImagePixmapUnion.h │ ├── ImagePresentation.h │ ├── ImageSettings.cpp │ ├── ImageSettings.h │ ├── ImageTransformation.cpp │ ├── ImageTransformation.h │ ├── ImageViewBase.cpp │ ├── ImageViewBase.h │ ├── ImageViewInfoListener.h │ ├── ImageViewInfoProvider.cpp │ ├── ImageViewInfoProvider.h │ ├── IncompleteThumbnail.cpp │ ├── IncompleteThumbnail.h │ ├── JpegMetadataLoader.cpp │ ├── JpegMetadataLoader.h │ ├── LightColorScheme.cpp │ ├── LightColorScheme.h │ ├── LoadFileTask.cpp │ ├── LoadFileTask.h │ ├── Margins.cpp │ ├── Margins.h │ ├── NativeColorScheme.cpp │ ├── NativeColorScheme.h │ ├── NonOwningWidget.cpp │ ├── NonOwningWidget.h │ ├── NullTaskStatus.h │ ├── OpenGLSupport.cpp │ ├── OpenGLSupport.h │ ├── OrderByCompletenessProvider.cpp │ ├── OrderByCompletenessProvider.h │ ├── OrderByDeviationProvider.cpp │ ├── OrderByDeviationProvider.h │ ├── OrthogonalRotation.cpp │ ├── OrthogonalRotation.h │ ├── OutOfMemoryHandler.cpp │ ├── OutOfMemoryHandler.h │ ├── OutputFileNameGenerator.cpp │ ├── OutputFileNameGenerator.h │ ├── PageId.cpp │ ├── PageId.h │ ├── PageInfo.cpp │ ├── PageInfo.h │ ├── PageOrderOption.h │ ├── PageOrderProvider.cpp │ ├── PageOrderProvider.h │ ├── PageOrientationCollector.h │ ├── PageOrientationPropagator.cpp │ ├── PageOrientationPropagator.h │ ├── PageRange.cpp │ ├── PageRange.h │ ├── PageSelectionAccessor.cpp │ ├── PageSelectionAccessor.h │ ├── PageSelectionProvider.h │ ├── PageSequence.cpp │ ├── PageSequence.h │ ├── PageView.h │ ├── PayloadEvent.h │ ├── PixmapRenderer.cpp │ ├── PixmapRenderer.h │ ├── PngMetadataLoader.cpp │ ├── PngMetadataLoader.h │ ├── ProcessingIndicationWidget.cpp │ ├── ProcessingIndicationWidget.h │ ├── ProcessingTaskQueue.cpp │ ├── ProcessingTaskQueue.h │ ├── ProjectPages.cpp │ ├── ProjectPages.h │ ├── ProjectReader.cpp │ ├── ProjectReader.h │ ├── ProjectWriter.cpp │ ├── ProjectWriter.h │ ├── RecentProjects.cpp │ ├── RecentProjects.h │ ├── RelinkablePath.cpp │ ├── RelinkablePath.h │ ├── SelectedPage.cpp │ ├── SelectedPage.h │ ├── SkinnedButton.cpp │ ├── SkinnedButton.h │ ├── SmartFilenameOrdering.cpp │ ├── SmartFilenameOrdering.h │ ├── StageListView.cpp │ ├── StageListView.h │ ├── StageSequence.cpp │ ├── StageSequence.h │ ├── StyledIconPack.cpp │ ├── StyledIconPack.h │ ├── TabbedDebugImages.cpp │ ├── TabbedDebugImages.h │ ├── ThumbnailBase.cpp │ ├── ThumbnailBase.h │ ├── ThumbnailCollector.h │ ├── ThumbnailFactory.cpp │ ├── ThumbnailFactory.h │ ├── ThumbnailLoadResult.h │ ├── ThumbnailPixmapCache.cpp │ ├── ThumbnailPixmapCache.h │ ├── TiffMetadataLoader.cpp │ ├── TiffMetadataLoader.h │ ├── TiffReader.cpp │ ├── TiffReader.h │ ├── TiffWriter.cpp │ ├── TiffWriter.h │ ├── Units.cpp │ ├── Units.h │ ├── UnitsConverter.cpp │ ├── UnitsConverter.h │ ├── UnitsListener.cpp │ ├── UnitsListener.h │ ├── UnitsProvider.cpp │ ├── UnitsProvider.h │ ├── Utils.cpp │ ├── Utils.h │ ├── WorkerThreadPool.cpp │ ├── WorkerThreadPool.h │ ├── ZoneEditorBase.cpp │ ├── ZoneEditorBase.h │ ├── ZoneModeListener.h │ ├── filters │ │ ├── deskew │ │ │ ├── ApplyDialog.cpp │ │ │ ├── ApplyDialog.h │ │ │ ├── ApplyDialog.ui │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Dependencies.cpp │ │ │ ├── Dependencies.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OptionsWidget.ui │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── Utils.cpp │ │ │ └── Utils.h │ │ ├── fix_orientation │ │ │ ├── ApplyDialog.cpp │ │ │ ├── ApplyDialog.h │ │ │ ├── ApplyDialog.ui │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OptionsWidget.ui │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Utils.cpp │ │ │ └── Utils.h │ │ ├── output │ │ │ ├── ApplyColorsDialog.cpp │ │ │ ├── ApplyColorsDialog.h │ │ │ ├── ApplyColorsDialog.ui │ │ │ ├── BinarizationOptionsWidget.h │ │ │ ├── BlackWhiteOptions.cpp │ │ │ ├── BlackWhiteOptions.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── ChangeDewarpingDialog.cpp │ │ │ ├── ChangeDewarpingDialog.h │ │ │ ├── ChangeDewarpingDialog.ui │ │ │ ├── ChangeDpiDialog.cpp │ │ │ ├── ChangeDpiDialog.h │ │ │ ├── ChangeDpiDialog.ui │ │ │ ├── ColorCommonOptions.cpp │ │ │ ├── ColorCommonOptions.h │ │ │ ├── ColorParams.cpp │ │ │ ├── ColorParams.h │ │ │ ├── ColorPickupInteraction.cpp │ │ │ ├── ColorPickupInteraction.h │ │ │ ├── DepthPerception.cpp │ │ │ ├── DepthPerception.h │ │ │ ├── DespeckleLevel.cpp │ │ │ ├── DespeckleLevel.h │ │ │ ├── DespeckleState.cpp │ │ │ ├── DespeckleState.h │ │ │ ├── DespeckleView.cpp │ │ │ ├── DespeckleView.h │ │ │ ├── DespeckleVisualization.cpp │ │ │ ├── DespeckleVisualization.h │ │ │ ├── DewarpingOptions.cpp │ │ │ ├── DewarpingOptions.h │ │ │ ├── DewarpingView.cpp │ │ │ ├── DewarpingView.h │ │ │ ├── FillColorProperty.cpp │ │ │ ├── FillColorProperty.h │ │ │ ├── FillZoneComparator.cpp │ │ │ ├── FillZoneComparator.h │ │ │ ├── FillZoneEditor.cpp │ │ │ ├── FillZoneEditor.h │ │ │ ├── FillZonePropFactory.cpp │ │ │ ├── FillZonePropFactory.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ForegroundType.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── ImageViewTab.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OptionsWidget.ui │ │ │ ├── OtsuBinarizationOptionsWidget.cpp │ │ │ ├── OtsuBinarizationOptionsWidget.h │ │ │ ├── OtsuBinarizationOptionsWidget.ui │ │ │ ├── OutputFileParams.cpp │ │ │ ├── OutputFileParams.h │ │ │ ├── OutputGenerator.cpp │ │ │ ├── OutputGenerator.h │ │ │ ├── OutputImage.h │ │ │ ├── OutputImageBuilder.cpp │ │ │ ├── OutputImageBuilder.h │ │ │ ├── OutputImageParams.cpp │ │ │ ├── OutputImageParams.h │ │ │ ├── OutputImagePlain.cpp │ │ │ ├── OutputImagePlain.h │ │ │ ├── OutputImageWithForeground.h │ │ │ ├── OutputImageWithForegroundMask.cpp │ │ │ ├── OutputImageWithForegroundMask.h │ │ │ ├── OutputImageWithOriginalBackground.h │ │ │ ├── OutputImageWithOriginalBackgroundMask.cpp │ │ │ ├── OutputImageWithOriginalBackgroundMask.h │ │ │ ├── OutputMargins.h │ │ │ ├── OutputParams.cpp │ │ │ ├── OutputParams.h │ │ │ ├── OutputProcessingParams.cpp │ │ │ ├── OutputProcessingParams.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── PictureLayerProperty.cpp │ │ │ ├── PictureLayerProperty.h │ │ │ ├── PictureShapeOptions.cpp │ │ │ ├── PictureShapeOptions.h │ │ │ ├── PictureZoneComparator.cpp │ │ │ ├── PictureZoneComparator.h │ │ │ ├── PictureZoneEditor.cpp │ │ │ ├── PictureZoneEditor.h │ │ │ ├── PictureZonePropDialog.cpp │ │ │ ├── PictureZonePropDialog.h │ │ │ ├── PictureZonePropDialog.ui │ │ │ ├── PictureZonePropFactory.cpp │ │ │ ├── PictureZonePropFactory.h │ │ │ ├── RenderParams.cpp │ │ │ ├── RenderParams.h │ │ │ ├── SauvolaBinarizationOptionsWidget.cpp │ │ │ ├── SauvolaBinarizationOptionsWidget.h │ │ │ ├── SauvolaBinarizationOptionsWidget.ui │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── SplittingOptions.cpp │ │ │ ├── SplittingOptions.h │ │ │ ├── TabbedImageView.cpp │ │ │ ├── TabbedImageView.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── Utils.cpp │ │ │ ├── Utils.h │ │ │ ├── WolfBinarizationOptionsWidget.cpp │ │ │ ├── WolfBinarizationOptionsWidget.h │ │ │ ├── WolfBinarizationOptionsWidget.ui │ │ │ ├── ZoneCategoryProperty.cpp │ │ │ └── ZoneCategoryProperty.h │ │ ├── page_layout │ │ │ ├── Alignment.cpp │ │ │ ├── Alignment.h │ │ │ ├── ApplyDialog.cpp │ │ │ ├── ApplyDialog.h │ │ │ ├── ApplyDialog.ui │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── Guide.cpp │ │ │ ├── Guide.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OptionsWidget.ui │ │ │ ├── OrderByHeightProvider.cpp │ │ │ ├── OrderByHeightProvider.h │ │ │ ├── OrderByWidthProvider.cpp │ │ │ ├── OrderByWidthProvider.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── Utils.cpp │ │ │ └── Utils.h │ │ ├── page_split │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Dependencies.cpp │ │ │ ├── Dependencies.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── LayoutType.cpp │ │ │ ├── LayoutType.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OptionsWidget.ui │ │ │ ├── OrderBySplitTypeProvider.cpp │ │ │ ├── OrderBySplitTypeProvider.h │ │ │ ├── PageLayout.cpp │ │ │ ├── PageLayout.h │ │ │ ├── PageLayoutAdapter.cpp │ │ │ ├── PageLayoutAdapter.h │ │ │ ├── PageLayoutEstimator.cpp │ │ │ ├── PageLayoutEstimator.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── SplitLineObject.h │ │ │ ├── SplitModeDialog.cpp │ │ │ ├── SplitModeDialog.h │ │ │ ├── SplitModeDialog.ui │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── UnremoveButton.cpp │ │ │ ├── UnremoveButton.h │ │ │ ├── Utils.cpp │ │ │ ├── Utils.h │ │ │ ├── VertLineFinder.cpp │ │ │ └── VertLineFinder.h │ │ └── select_content │ │ │ ├── ApplyDialog.cpp │ │ │ ├── ApplyDialog.h │ │ │ ├── ApplyDialog.ui │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── ContentBoxFinder.cpp │ │ │ ├── ContentBoxFinder.h │ │ │ ├── Dependencies.cpp │ │ │ ├── Dependencies.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OptionsWidget.ui │ │ │ ├── OrderByHeightProvider.cpp │ │ │ ├── OrderByHeightProvider.h │ │ │ ├── OrderByWidthProvider.cpp │ │ │ ├── OrderByWidthProvider.h │ │ │ ├── PageFinder.cpp │ │ │ ├── PageFinder.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── PhysSizeCalc.cpp │ │ │ ├── PhysSizeCalc.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── Utils.cpp │ │ │ └── Utils.h │ ├── interaction │ │ ├── CMakeLists.txt │ │ ├── DragHandler.cpp │ │ ├── DragHandler.h │ │ ├── DragWatcher.cpp │ │ ├── DragWatcher.h │ │ ├── DraggableLineSegment.cpp │ │ ├── DraggableLineSegment.h │ │ ├── DraggableObject.h │ │ ├── DraggablePoint.cpp │ │ ├── DraggablePoint.h │ │ ├── DraggablePolygon.cpp │ │ ├── DraggablePolygon.h │ │ ├── InteractionHandler.cpp │ │ ├── InteractionHandler.h │ │ ├── InteractionState.cpp │ │ ├── InteractionState.h │ │ ├── InteractiveXSpline.cpp │ │ ├── InteractiveXSpline.h │ │ ├── ObjectDragHandler.cpp │ │ ├── ObjectDragHandler.h │ │ ├── ZoomHandler.cpp │ │ └── ZoomHandler.h │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── TestContentSpanFinder.cpp │ │ ├── TestSmartFilenameOrdering.cpp │ │ └── main.cpp │ └── zones │ │ ├── BasicSplineVisualizer.cpp │ │ ├── BasicSplineVisualizer.h │ │ ├── CMakeLists.txt │ │ ├── EditableSpline.cpp │ │ ├── EditableSpline.h │ │ ├── EditableZoneSet.cpp │ │ ├── EditableZoneSet.h │ │ ├── SerializableSpline.cpp │ │ ├── SerializableSpline.h │ │ ├── SplineSegment.cpp │ │ ├── SplineSegment.h │ │ ├── SplineVertex.cpp │ │ ├── SplineVertex.h │ │ ├── Zone.cpp │ │ ├── Zone.h │ │ ├── ZoneContextMenuInteraction.cpp │ │ ├── ZoneContextMenuInteraction.h │ │ ├── ZoneContextMenuItem.h │ │ ├── ZoneCreationInteraction.cpp │ │ ├── ZoneCreationInteraction.h │ │ ├── ZoneCreationMode.h │ │ ├── ZoneDefaultInteraction.cpp │ │ ├── ZoneDefaultInteraction.h │ │ ├── ZoneDragInteraction.cpp │ │ ├── ZoneDragInteraction.h │ │ ├── ZoneInteractionContext.cpp │ │ ├── ZoneInteractionContext.h │ │ ├── ZoneSet.cpp │ │ ├── ZoneSet.h │ │ ├── ZoneVertexDragInteraction.cpp │ │ └── ZoneVertexDragInteraction.h ├── dewarping │ ├── CMakeLists.txt │ ├── Curve.cpp │ ├── Curve.h │ ├── CylindricalSurfaceDewarper.cpp │ ├── CylindricalSurfaceDewarper.h │ ├── DetectVertContentBounds.cpp │ ├── DetectVertContentBounds.h │ ├── DewarpingPointMapper.cpp │ ├── DewarpingPointMapper.h │ ├── DistortionModel.cpp │ ├── DistortionModel.h │ ├── DistortionModelBuilder.cpp │ ├── DistortionModelBuilder.h │ ├── RasterDewarper.cpp │ ├── RasterDewarper.h │ ├── TextLineRefiner.cpp │ ├── TextLineRefiner.h │ ├── TextLineTracer.cpp │ ├── TextLineTracer.h │ ├── TopBottomEdgeTracer.cpp │ ├── TopBottomEdgeTracer.h │ ├── TowardsLineTracer.cpp │ └── TowardsLineTracer.h ├── foundation │ ├── AlignedArray.h │ ├── AutoRemovingFile.cpp │ ├── AutoRemovingFile.h │ ├── CMakeLists.txt │ ├── Constants.cpp │ ├── Constants.h │ ├── DynamicPool.h │ ├── FastQueue.h │ ├── FlagOps.h │ ├── Grid.h │ ├── GridLineTraverser.cpp │ ├── GridLineTraverser.h │ ├── Hashes.h │ ├── LineIntersectionScalar.cpp │ ├── LineIntersectionScalar.h │ ├── MatMNT.h │ ├── MatT.h │ ├── NonCopyable.h │ ├── NumericTraits.h │ ├── PerformanceTimer.cpp │ ├── PerformanceTimer.h │ ├── PriorityQueue.h │ ├── Property.h │ ├── PropertyFactory.cpp │ ├── PropertyFactory.h │ ├── PropertySet.cpp │ ├── PropertySet.h │ ├── Proximity.cpp │ ├── Proximity.h │ ├── SafeDeletingQObjectPtr.h │ ├── ScopedIncDec.h │ ├── Span.h │ ├── StaticPool.h │ ├── TaskStatus.h │ ├── Utils.cpp │ ├── Utils.h │ ├── ValueConv.h │ ├── VecNT.h │ ├── VecT.h │ ├── VirtualFunction.h │ ├── XmlMarshaller.cpp │ ├── XmlMarshaller.h │ ├── XmlUnmarshaller.cpp │ └── XmlUnmarshaller.h ├── imageproc │ ├── AdjustBrightness.cpp │ ├── AdjustBrightness.h │ ├── BWColor.h │ ├── BackgroundColorCalculator.cpp │ ├── BackgroundColorCalculator.h │ ├── BadAllocIfNull.cpp │ ├── BadAllocIfNull.h │ ├── Binarize.cpp │ ├── Binarize.h │ ├── BinaryImage.cpp │ ├── BinaryImage.h │ ├── BinaryThreshold.cpp │ ├── BinaryThreshold.h │ ├── BitOps.cpp │ ├── BitOps.h │ ├── ByteOrder.h │ ├── CMakeLists.txt │ ├── ColorForId.h │ ├── ColorInterpolation.cpp │ ├── ColorInterpolation.h │ ├── ColorMixer.h │ ├── ColorSegmenter.cpp │ ├── ColorSegmenter.h │ ├── ConnComp.h │ ├── ConnCompEraser.cpp │ ├── ConnCompEraser.h │ ├── ConnCompEraserExt.cpp │ ├── ConnCompEraserExt.h │ ├── Connectivity.h │ ├── ConnectivityMap.cpp │ ├── ConnectivityMap.h │ ├── DebugImages.h │ ├── Dpi.cpp │ ├── Dpi.h │ ├── Dpm.cpp │ ├── Dpm.h │ ├── DrawOver.cpp │ ├── DrawOver.h │ ├── FindPeaksGeneric.h │ ├── GaussBlur.cpp │ ├── GaussBlur.h │ ├── GrayImage.cpp │ ├── GrayImage.h │ ├── GrayRasterOp.h │ ├── Grayscale.cpp │ ├── Grayscale.h │ ├── HoughLineDetector.cpp │ ├── HoughLineDetector.h │ ├── ImageCombination.cpp │ ├── ImageCombination.h │ ├── InfluenceMap.cpp │ ├── InfluenceMap.h │ ├── IntegralImage.h │ ├── LocalMinMaxGeneric.h │ ├── MaxWhitespaceFinder.cpp │ ├── MaxWhitespaceFinder.h │ ├── MorphGradientDetect.cpp │ ├── MorphGradientDetect.h │ ├── Morphology.cpp │ ├── Morphology.h │ ├── OrthogonalRotation.cpp │ ├── OrthogonalRotation.h │ ├── PolygonRasterizer.cpp │ ├── PolygonRasterizer.h │ ├── PolygonUtils.cpp │ ├── PolygonUtils.h │ ├── PolynomialLine.cpp │ ├── PolynomialLine.h │ ├── PolynomialSurface.cpp │ ├── PolynomialSurface.h │ ├── Posterizer.cpp │ ├── Posterizer.h │ ├── RastLineFinder.cpp │ ├── RastLineFinder.h │ ├── RasterOp.h │ ├── RasterOpGeneric.h │ ├── ReduceThreshold.cpp │ ├── ReduceThreshold.h │ ├── SEDM.cpp │ ├── SEDM.h │ ├── SavGolFilter.cpp │ ├── SavGolFilter.h │ ├── SavGolKernel.cpp │ ├── SavGolKernel.h │ ├── Scale.cpp │ ├── Scale.h │ ├── SeedFill.cpp │ ├── SeedFill.h │ ├── SeedFillGeneric.cpp │ ├── SeedFillGeneric.h │ ├── Shear.cpp │ ├── Shear.h │ ├── SkewFinder.cpp │ ├── SkewFinder.h │ ├── SlicedHistogram.cpp │ ├── SlicedHistogram.h │ ├── Sobel.h │ ├── Transform.cpp │ ├── Transform.h │ ├── UpscaleIntegerTimes.cpp │ ├── UpscaleIntegerTimes.h │ └── tests │ │ ├── CMakeLists.txt │ │ ├── TestBinarize.cpp │ │ ├── TestBinaryImage.cpp │ │ ├── TestConnCompEraser.cpp │ │ ├── TestConnCompEraserExt.cpp │ │ ├── TestGrayscale.cpp │ │ ├── TestMorphology.cpp │ │ ├── TestOrthogonalRotation.cpp │ │ ├── TestPolygonRasterizer.cpp │ │ ├── TestRastLineFinder.cpp │ │ ├── TestRasterOp.cpp │ │ ├── TestReduceThreshold.cpp │ │ ├── TestSEDM.cpp │ │ ├── TestScale.cpp │ │ ├── TestSeedFill.cpp │ │ ├── TestShear.cpp │ │ ├── TestSkewFinder.cpp │ │ ├── TestSlicedHistogram.cpp │ │ ├── TestTransform.cpp │ │ ├── Utils.cpp │ │ ├── Utils.h │ │ └── main.cpp ├── math │ ├── ArcLengthMapper.cpp │ ├── ArcLengthMapper.h │ ├── CMakeLists.txt │ ├── HomographicTransform.h │ ├── LineBoundedByRect.cpp │ ├── LineBoundedByRect.h │ ├── LinearFunction.cpp │ ├── LinearFunction.h │ ├── LinearSolver.cpp │ ├── LinearSolver.h │ ├── MatrixCalc.h │ ├── PolylineIntersector.cpp │ ├── PolylineIntersector.h │ ├── QuadraticFunction.cpp │ ├── QuadraticFunction.h │ ├── SidesOfLine.cpp │ ├── SidesOfLine.h │ ├── ToLineProjector.cpp │ ├── ToLineProjector.h │ ├── XSpline.cpp │ ├── XSpline.h │ ├── adiff │ │ ├── Function.cpp │ │ ├── Function.h │ │ ├── SparseMap.cpp │ │ ├── SparseMap.h │ │ └── references.txt │ ├── spfit │ │ ├── ConstraintSet.cpp │ │ ├── ConstraintSet.h │ │ ├── FittableSpline.h │ │ ├── FrenetFrame.cpp │ │ ├── FrenetFrame.h │ │ ├── LinearForceBalancer.cpp │ │ ├── LinearForceBalancer.h │ │ ├── ModelShape.h │ │ ├── OptimizationResult.cpp │ │ ├── OptimizationResult.h │ │ ├── Optimizer.cpp │ │ ├── Optimizer.h │ │ ├── PolylineModelShape.cpp │ │ ├── PolylineModelShape.h │ │ ├── SplineFitter.cpp │ │ ├── SplineFitter.h │ │ ├── SqDistApproximant.cpp │ │ ├── SqDistApproximant.h │ │ └── references.txt │ └── tests │ │ ├── CMakeLists.txt │ │ ├── TestHessians.cpp │ │ ├── TestMatrixCalc.cpp │ │ ├── TestSqDistApproximant.cpp │ │ └── main.cpp ├── resources │ ├── GPLv3.html │ ├── appicon.svg │ ├── dark_scheme │ │ ├── dark_scheme.qrc │ │ ├── icons │ │ │ ├── branch_closed.svg │ │ │ ├── branch_end.svg │ │ │ ├── branch_more.svg │ │ │ ├── branch_open.svg │ │ │ ├── checkbox_checked.svg │ │ │ ├── checkbox_checked_disabled.svg │ │ │ ├── checkbox_checked_pressed.svg │ │ │ ├── checkbox_indeterminate.svg │ │ │ ├── checkbox_indeterminate_disabled.svg │ │ │ ├── checkbox_indeterminate_pressed.svg │ │ │ ├── down_arrow.svg │ │ │ ├── down_arrow_pressed.svg │ │ │ ├── radiobutton_checked.svg │ │ │ ├── radiobutton_checked_disabled.svg │ │ │ ├── radiobutton_checked_pressed.svg │ │ │ ├── scroll_bar_down_arrow.svg │ │ │ ├── scroll_bar_left_arrow.svg │ │ │ ├── scroll_bar_right_arrow.svg │ │ │ ├── scroll_bar_up_arrow.svg │ │ │ ├── slider_handle.svg │ │ │ ├── up_arrow.svg │ │ │ ├── up_arrow_pressed.svg │ │ │ ├── vline.svg │ │ │ ├── window_close.svg │ │ │ ├── window_close_disabled.svg │ │ │ ├── window_restore.svg │ │ │ └── window_restore_disabled.svg │ │ └── stylesheet │ │ │ └── stylesheet.qss │ ├── font-icons.xml │ ├── icons.xml │ ├── icons │ │ ├── aqua-sphere.svg │ │ ├── ascending_sorting_order.svg │ │ ├── big-down-arrow.svg │ │ ├── big-left-arrow.svg │ │ ├── big-right-arrow.svg │ │ ├── big-up-arrow.svg │ │ ├── check-mark-disabled.svg │ │ ├── check-mark.svg │ │ ├── checkbox-styled.svg │ │ ├── collapse.svg │ │ ├── descending_sorting_order.svg │ │ ├── diminishing-glass.svg │ │ ├── expand.svg │ │ ├── eye-disabled.svg │ │ ├── eye.svg │ │ ├── file.svg │ │ ├── folder.svg │ │ ├── insert-after.svg │ │ ├── insert-before.svg │ │ ├── insert-here.svg │ │ ├── lasso-zone-mode.svg │ │ ├── layout_type_auto.svg │ │ ├── left-arrow-inscribed.svg │ │ ├── left_page_plus_offcut.svg │ │ ├── left_page_thumb.svg │ │ ├── magnifying-glass.svg │ │ ├── minus.svg │ │ ├── multi-column-view.svg │ │ ├── object-rotate-left.svg │ │ ├── object-rotate-right.svg │ │ ├── play-hovered.svg │ │ ├── play-pressed.svg │ │ ├── play.svg │ │ ├── plus.svg │ │ ├── polygonal-zone-mode.svg │ │ ├── rectangular-zone-mode.svg │ │ ├── right-arrow-inscribed.svg │ │ ├── right-pointing.svg │ │ ├── right_page_plus_offcut.svg │ │ ├── right_page_thumb.svg │ │ ├── single-column-view.svg │ │ ├── single_page_uncut.svg │ │ ├── six-spoked-asterisk-disabled.svg │ │ ├── six-spoked-asterisk.svg │ │ ├── stock-center.svg │ │ ├── stock-gravity-east.svg │ │ ├── stock-gravity-north-east.svg │ │ ├── stock-gravity-north-west.svg │ │ ├── stock-gravity-north.svg │ │ ├── stock-gravity-south-east.svg │ │ ├── stock-gravity-south-west.svg │ │ ├── stock-gravity-south.svg │ │ ├── stock-gravity-west.svg │ │ ├── stock-vchain-broken.svg │ │ ├── stock-vchain.svg │ │ ├── stop-hovered.svg │ │ ├── stop-pressed.svg │ │ ├── stop.svg │ │ ├── trashed.svg │ │ ├── triangle-down-arrow.svg │ │ ├── triangle-up-arrow.svg │ │ ├── two_pages.svg │ │ ├── undo.svg │ │ ├── untrash.svg │ │ └── user-trash.svg │ ├── light_scheme │ │ ├── icons │ │ │ ├── branch_closed.svg │ │ │ ├── branch_end.svg │ │ │ ├── branch_more.svg │ │ │ ├── branch_open.svg │ │ │ ├── checkbox_checked.svg │ │ │ ├── checkbox_checked_disabled.svg │ │ │ ├── checkbox_checked_pressed.svg │ │ │ ├── checkbox_indeterminate.svg │ │ │ ├── checkbox_indeterminate_disabled.svg │ │ │ ├── checkbox_indeterminate_pressed.svg │ │ │ ├── down_arrow.svg │ │ │ ├── down_arrow_pressed.svg │ │ │ ├── radiobutton_checked.svg │ │ │ ├── radiobutton_checked_disabled.svg │ │ │ ├── radiobutton_checked_pressed.svg │ │ │ ├── scroll_bar_down_arrow.svg │ │ │ ├── scroll_bar_left_arrow.svg │ │ │ ├── scroll_bar_right_arrow.svg │ │ │ ├── scroll_bar_up_arrow.svg │ │ │ ├── slider_handle.svg │ │ │ ├── up_arrow.svg │ │ │ ├── up_arrow_pressed.svg │ │ │ ├── vline.svg │ │ │ ├── window_close.svg │ │ │ ├── window_close_disabled.svg │ │ │ ├── window_restore.svg │ │ │ └── window_restore_disabled.svg │ │ ├── light_scheme.qrc │ │ └── stylesheet │ │ │ └── stylesheet.qss │ ├── resources.qrc │ ├── unix │ │ ├── mime │ │ │ └── scantailor-project.xml │ │ └── scantailor.desktop │ └── win32 │ │ ├── resources.rc.in │ │ └── scantailor.ico └── translations │ ├── scantailor_es.ts │ ├── scantailor_pt.ts │ ├── scantailor_ru.ts │ └── scantailor_untranslated.ts └── version.h.in /cmake/ListItemsPrepend.cmake: -------------------------------------------------------------------------------- 1 | function (list_items_prepend List Prefix) 2 | set(${List}_temp) 3 | foreach (_item ${${List}}) 4 | list(APPEND ${List}_temp "${Prefix}${_item}") 5 | endforeach() 6 | set(${List} "${${List}_temp}" PARENT_SCOPE) 7 | endfunction() -------------------------------------------------------------------------------- /cmake/SetDefaultBuildType.cmake: -------------------------------------------------------------------------------- 1 | macro (st_set_default_build_type DefaultBuildType) 2 | if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 3 | set(CMAKE_BUILD_TYPE "${DefaultBuildType}" CACHE STRING 4 | "Choose the type of build." FORCE) 5 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 6 | "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 7 | endif() 8 | endmacro() 9 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") 3 | endif() 4 | 5 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach (file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if (IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval) 14 | if (NOT "${rm_retval}" STREQUAL 0) 15 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 16 | endif() 17 | else() 18 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 19 | endif() 20 | endforeach() -------------------------------------------------------------------------------- /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() 21 | -------------------------------------------------------------------------------- /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 TRANSLATION_DIRS "@TRANSLATION_DIRS@" 7 | #define PLUGIN_DIRS "@PLUGIN_DIRS@" 8 | 9 | #define PORTABLE_CONFIG_DIR "@PORTABLE_CONFIG_DIR@" 10 | #define ENABLE_DEBUG_FEATURES 11 | #define APPLICATION_NAME "@APPLICATION_NAME@" 12 | #define ORGANIZATION_NAME APPLICATION_NAME 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}") 2 | 3 | add_subdirectory(foundation) 4 | add_subdirectory(math) 5 | add_subdirectory(imageproc) 6 | add_subdirectory(dewarping) 7 | add_subdirectory(core) 8 | add_subdirectory(app) -------------------------------------------------------------------------------- /src/app/LoadFilesStatusDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_APP_LOADFILESSTATUSDIALOG_H_ 5 | #define SCANTAILOR_APP_LOADFILESSTATUSDIALOG_H_ 6 | 7 | #include 8 | #include 9 | 10 | #include "ui_LoadFilesStatusDialog.h" 11 | 12 | class LoadFilesStatusDialog : public QDialog { 13 | public: 14 | explicit LoadFilesStatusDialog(QWidget* parent = nullptr); 15 | 16 | void setLoadedFiles(const std::vector& files); 17 | 18 | void setFailedFiles(const std::vector& failed); 19 | 20 | void setOkButtonName(const QString& name); 21 | 22 | private: 23 | Ui::LoadFilesStatusDialog ui; 24 | QString m_loadedTabNameTemplate; 25 | QString m_failedTabNameTemplate; 26 | }; 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/app/NewOpenProjectPanel.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_APP_NEWOPENPROJECTPANEL_H_ 5 | #define SCANTAILOR_APP_NEWOPENPROJECTPANEL_H_ 6 | 7 | #include 8 | #include 9 | 10 | #include "ui_NewOpenProjectPanel.h" 11 | 12 | class QString; 13 | 14 | class NewOpenProjectPanel : public QWidget, private Ui::NewOpenProjectPanel { 15 | Q_OBJECT 16 | public: 17 | explicit NewOpenProjectPanel(QWidget* parent = nullptr); 18 | 19 | signals: 20 | 21 | void newProject(); 22 | 23 | void openProject(); 24 | 25 | void openRecentProject(const QString& projectFile); 26 | 27 | protected: 28 | void paintEvent(QPaintEvent*) override; 29 | 30 | private: 31 | void addRecentProject(const QString& filePath); 32 | }; 33 | 34 | 35 | #endif // ifndef SCANTAILOR_APP_NEWOPENPROJECTPANEL_H_ 36 | -------------------------------------------------------------------------------- /src/app/RelinkingListView.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_APP_RELINKINGLISTVIEW_H_ 5 | #define SCANTAILOR_APP_RELINKINGLISTVIEW_H_ 6 | 7 | #include 8 | 9 | class QPainter; 10 | class QRect; 11 | class QModelIndex; 12 | 13 | class RelinkingListView : public QListView { 14 | public: 15 | explicit RelinkingListView(QWidget* parent = nullptr); 16 | 17 | protected: 18 | void paintEvent(QPaintEvent* e) override; 19 | 20 | private: 21 | class Delegate; 22 | class IndicationGroup; 23 | 24 | class GroupAggregator; 25 | 26 | void maybeDrawStatusLayer(QPainter* painter, const QModelIndex& itemIndex, const QRect& itemPaintRect); 27 | 28 | void drawStatusLayer(QPainter* painter); 29 | 30 | bool m_statusLayerDrawn; 31 | }; 32 | 33 | 34 | #endif // ifndef SCANTAILOR_APP_RELINKINGLISTVIEW_H_ 35 | -------------------------------------------------------------------------------- /src/app/RelinkingSortingModel.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_APP_RELINKINGSORTINGMODEL_H_ 5 | #define SCANTAILOR_APP_RELINKINGSORTINGMODEL_H_ 6 | 7 | #include 8 | 9 | class RelinkingSortingModel : public QSortFilterProxyModel { 10 | public: 11 | explicit RelinkingSortingModel(QObject* parent = nullptr); 12 | 13 | protected: 14 | bool lessThan(const QModelIndex& left, const QModelIndex& right) const override; 15 | }; 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/app/SettingsDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_APP_SETTINGSDIALOG_H_ 5 | #define SCANTAILOR_APP_SETTINGSDIALOG_H_ 6 | 7 | #include 8 | 9 | #include "ui_SettingsDialog.h" 10 | 11 | class SettingsDialog : public QDialog { 12 | Q_OBJECT 13 | public: 14 | explicit SettingsDialog(QWidget* parent = nullptr); 15 | 16 | ~SettingsDialog() override; 17 | 18 | signals: 19 | void settingsChanged(); 20 | 21 | private slots: 22 | void commitChanges(); 23 | 24 | void blackOnWhiteDetectionToggled(bool checked); 25 | 26 | private: 27 | Ui::SettingsDialog ui; 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/app/SystemLoadWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_APP_SYSTEMLOADWIDGET_H_ 5 | #define SCANTAILOR_APP_SYSTEMLOADWIDGET_H_ 6 | 7 | #include 8 | 9 | #include "ui_SystemLoadWidget.h" 10 | 11 | class SystemLoadWidget : public QWidget { 12 | Q_OBJECT 13 | public: 14 | explicit SystemLoadWidget(QWidget* parent = nullptr); 15 | 16 | private slots: 17 | 18 | void sliderPressed(); 19 | 20 | void sliderMoved(int threads); 21 | 22 | void valueChanged(int threads); 23 | 24 | void decreaseLoad(); 25 | 26 | void increaseLoad(); 27 | 28 | private: 29 | void showHideToolTip(int threads); 30 | 31 | void setupIcons(); 32 | 33 | Ui::SystemLoadWidget ui; 34 | int m_maxThreads; 35 | }; 36 | 37 | 38 | #endif // ifndef SCANTAILOR_APP_SYSTEMLOADWIDGET_H_ 39 | -------------------------------------------------------------------------------- /src/core/AbstractCommand.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ABSTRACTCOMMAND_H_ 5 | #define SCANTAILOR_CORE_ABSTRACTCOMMAND_H_ 6 | 7 | #include 8 | 9 | template 10 | class AbstractCommand { 11 | public: 12 | using Ptr = std::shared_ptr; 13 | 14 | virtual ~AbstractCommand() = default; 15 | 16 | virtual Res operator()(ArgTypes... args) = 0; 17 | }; 18 | 19 | #endif // ifndef SCANTAILOR_CORE_ABSTRACTCOMMAND_H_ 20 | -------------------------------------------------------------------------------- /src/core/AbstractFilterDataCollector.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ABSTRACTFILTERDATACOLLECTOR_H_ 5 | #define SCANTAILOR_CORE_ABSTRACTFILTERDATACOLLECTOR_H_ 6 | 7 | class AbstractFilterDataCollector { 8 | public: 9 | virtual ~AbstractFilterDataCollector() = default; 10 | }; 11 | 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/core/AbstractIconPack.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ABSTRACTICONPACK_H_ 5 | #define SCANTAILOR_CORE_ABSTRACTICONPACK_H_ 6 | 7 | #include "IconPack.h" 8 | 9 | class AbstractIconPack : public IconPack { 10 | public: 11 | QIcon getIcon(const QString& iconKey) const override; 12 | 13 | void mergeWith(std::unique_ptr pack) override; 14 | 15 | protected: 16 | static QIcon::Mode iconModeFromString(const QString& mode); 17 | 18 | static QIcon::State iconStateFromString(const QString& state); 19 | 20 | private: 21 | std::unique_ptr m_parentIconPack; 22 | }; 23 | 24 | 25 | #endif // SCANTAILOR_CORE_ABSTRACTICONPACK_H_ 26 | -------------------------------------------------------------------------------- /src/core/AbstractRelinker.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ABSTRACTRELINKER_H_ 5 | #define SCANTAILOR_CORE_ABSTRACTRELINKER_H_ 6 | 7 | 8 | class RelinkablePath; 9 | class QString; 10 | 11 | class AbstractRelinker { 12 | public: 13 | virtual ~AbstractRelinker() = default; 14 | 15 | /** 16 | * Returns the path to be used instead of the given path. 17 | * The same path will be returned if no substitution is to be made. 18 | */ 19 | virtual QString substitutionPathFor(const RelinkablePath& origPath) const = 0; 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/core/AutoManualMode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "AutoManualMode.h" 5 | 6 | QString autoManualModeToString(AutoManualMode mode) { 7 | QString str; 8 | switch (mode) { 9 | case MODE_AUTO: 10 | str = "auto"; 11 | break; 12 | case MODE_MANUAL: 13 | str = "manual"; 14 | break; 15 | case MODE_DISABLED: 16 | str = "disabled"; 17 | break; 18 | } 19 | return str; 20 | } 21 | 22 | AutoManualMode stringToAutoManualMode(const QString& str) { 23 | if (str == "disabled") { 24 | return MODE_DISABLED; 25 | } else if (str == "manual") { 26 | return MODE_MANUAL; 27 | } else { 28 | return MODE_AUTO; 29 | } 30 | } -------------------------------------------------------------------------------- /src/core/AutoManualMode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_AUTOMANUALMODE_H_ 5 | #define SCANTAILOR_CORE_AUTOMANUALMODE_H_ 6 | 7 | #include 8 | 9 | enum AutoManualMode { MODE_AUTO, MODE_MANUAL, MODE_DISABLED }; 10 | 11 | QString autoManualModeToString(AutoManualMode mode); 12 | 13 | AutoManualMode stringToAutoManualMode(const QString& str); 14 | 15 | #endif // SCANTAILOR_CORE_AUTOMANUALMODE_H_ 16 | -------------------------------------------------------------------------------- /src/core/BackgroundTask.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "BackgroundTask.h" 5 | 6 | const char* BackgroundTask::CancelledException::what() const noexcept { 7 | return "BackgroundTask cancelled"; 8 | } 9 | 10 | void BackgroundTask::throwIfCancelled() const { 11 | if (isCancelled()) { 12 | throw CancelledException(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/core/BasicImageView.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "BasicImageView.h" 5 | 6 | #include "Dpm.h" 7 | #include "ImagePresentation.h" 8 | #include "ImageTransformation.h" 9 | 10 | BasicImageView::BasicImageView(const QImage& image, const ImagePixmapUnion& downscaledImage, const Margins& margins) 11 | : ImageViewBase(image, downscaledImage, ImagePresentation(QTransform(), QRectF(image.rect())), margins), 12 | m_dragHandler(*this), 13 | m_zoomHandler(*this) { 14 | rootInteractionHandler().makeLastFollower(m_dragHandler); 15 | rootInteractionHandler().makeLastFollower(m_zoomHandler); 16 | } 17 | 18 | BasicImageView::~BasicImageView() = default; 19 | -------------------------------------------------------------------------------- /src/core/BasicImageView.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_BASICIMAGEVIEW_H_ 5 | #define SCANTAILOR_CORE_BASICIMAGEVIEW_H_ 6 | 7 | #include 8 | 9 | #include "DragHandler.h" 10 | #include "ImagePixmapUnion.h" 11 | #include "ImageViewBase.h" 12 | #include "Margins.h" 13 | #include "ZoomHandler.h" 14 | 15 | class BasicImageView : public ImageViewBase { 16 | Q_OBJECT 17 | public: 18 | explicit BasicImageView(const QImage& image, 19 | const ImagePixmapUnion& downscaledImage = ImagePixmapUnion(), 20 | const Margins& margins = Margins()); 21 | 22 | ~BasicImageView() override; 23 | 24 | private: 25 | DragHandler m_dragHandler; 26 | ZoomHandler m_zoomHandler; 27 | }; 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/core/BeforeOrAfter.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_BEFOREORAFTER_H_ 5 | #define SCANTAILOR_CORE_BEFOREORAFTER_H_ 6 | 7 | enum BeforeOrAfter { BEFORE, AFTER }; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/core/ColorSchemeFactory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "ColorSchemeFactory.h" 5 | 6 | #include "ColorScheme.h" 7 | #include "DarkColorScheme.h" 8 | #include "LightColorScheme.h" 9 | #include "NativeColorScheme.h" 10 | 11 | ColorSchemeFactory::ColorSchemeFactory() { 12 | registerColorScheme("native", []() { return std::make_unique(); }); 13 | registerColorScheme("light", []() { return std::make_unique(); }); 14 | registerColorScheme("dark", []() { return std::make_unique(); }); 15 | } 16 | 17 | void ColorSchemeFactory::registerColorScheme(const QString& scheme, const ColorSchemeConstructor& constructor) { 18 | m_registry[scheme] = constructor; 19 | } 20 | 21 | std::unique_ptr ColorSchemeFactory::create(const QString& scheme) const { 22 | return m_registry.at(scheme)(); 23 | } 24 | -------------------------------------------------------------------------------- /src/core/CompositeCacheDrivenTask.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_COMPOSITECACHEDRIVENTASK_H_ 5 | #define SCANTAILOR_CORE_COMPOSITECACHEDRIVENTASK_H_ 6 | 7 | 8 | class PageInfo; 9 | class AbstractFilterDataCollector; 10 | 11 | class CompositeCacheDrivenTask { 12 | public: 13 | virtual ~CompositeCacheDrivenTask() = default; 14 | 15 | virtual void process(const PageInfo& pageInfo, AbstractFilterDataCollector* collector) = 0; 16 | }; 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/core/ContentBoxCollector.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_CONTENTBOXCOLLECTOR_H_ 5 | #define SCANTAILOR_CORE_CONTENTBOXCOLLECTOR_H_ 6 | 7 | #include "AbstractFilterDataCollector.h" 8 | 9 | class ImageTransformation; 10 | class QRectF; 11 | 12 | class ContentBoxCollector : public AbstractFilterDataCollector { 13 | public: 14 | virtual void process(const ImageTransformation& xform, const QRectF& contentRect) = 0; 15 | }; 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/core/DarkColorScheme.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_DARKCOLORSCHEME_H_ 5 | #define SCANTAILOR_CORE_DARKCOLORSCHEME_H_ 6 | 7 | #include 8 | #include 9 | 10 | #include "ColorScheme.h" 11 | 12 | class DarkColorScheme : public ColorScheme { 13 | public: 14 | DarkColorScheme(); 15 | 16 | QStyle* getStyle() const override; 17 | 18 | const QPalette* getPalette() const override; 19 | 20 | const QString* getStyleSheet() const override; 21 | 22 | const ColorParams* getColorParams() const override; 23 | 24 | private: 25 | void loadPalette(); 26 | 27 | void loadStyleSheet(); 28 | 29 | void loadColorParams(); 30 | 31 | QPalette m_palette; 32 | QString m_styleSheet; 33 | ColorParams m_customColors; 34 | }; 35 | 36 | 37 | #endif // SCANTAILOR_CORE_DARKCOLORSCHEME_H_ 38 | -------------------------------------------------------------------------------- /src/core/DefaultParamsProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_DEFAULTPARAMSPROVIDER_H_ 5 | #define SCANTAILOR_CORE_DEFAULTPARAMSPROVIDER_H_ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | class DefaultParams; 13 | 14 | class DefaultParamsProvider { 15 | DECLARE_NON_COPYABLE(DefaultParamsProvider) 16 | private: 17 | DefaultParamsProvider(); 18 | 19 | public: 20 | static DefaultParamsProvider& getInstance(); 21 | 22 | const QString& getProfileName() const; 23 | 24 | const DefaultParams& getParams() const; 25 | 26 | void setParams(std::unique_ptr params, const QString& name); 27 | 28 | private: 29 | QString m_profileName; 30 | std::unique_ptr m_params; 31 | }; 32 | 33 | 34 | #endif // SCANTAILOR_CORE_DEFAULTPARAMSPROVIDER_H_ 35 | -------------------------------------------------------------------------------- /src/core/ErrorWidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "ErrorWidget.h" 5 | 6 | #include 7 | #include 8 | 9 | #include "ui_ErrorWidget.h" 10 | 11 | ErrorWidget::ErrorWidget(const QString& text, Qt::TextFormat fmt) : ui(std::make_unique()) { 12 | ui->setupUi(this); 13 | ui->textLabel->setTextFormat(fmt); 14 | ui->textLabel->setText(text); 15 | QIcon icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning)); 16 | ui->imageLabel->setPixmap(icon.pixmap(48, 48)); 17 | 18 | connect(ui->textLabel, SIGNAL(linkActivated(const QString&)), SLOT(linkActivated(const QString&))); 19 | } 20 | 21 | ErrorWidget::~ErrorWidget() = default; -------------------------------------------------------------------------------- /src/core/ErrorWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ERRORWIDGET_H_ 5 | #define SCANTAILOR_CORE_ERRORWIDGET_H_ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | class QString; 12 | namespace Ui { 13 | class ErrorWidget; 14 | } 15 | 16 | class ErrorWidget : public QWidget { 17 | Q_OBJECT 18 | public: 19 | explicit ErrorWidget(const QString& text, Qt::TextFormat fmt = Qt::AutoText); 20 | 21 | virtual ~ErrorWidget(); 22 | 23 | private slots: 24 | 25 | /** 26 | * \see QLabel::linkActivated() 27 | */ 28 | virtual void linkActivated(const QString& link) {} 29 | 30 | private: 31 | std::unique_ptr ui; 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/core/FilterOptionsWidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | -------------------------------------------------------------------------------- /src/core/FilterResult.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_FILTERRESULT_H_ 5 | #define SCANTAILOR_CORE_FILTERRESULT_H_ 6 | 7 | #include 8 | 9 | class AbstractFilter; 10 | class FilterUiInterface; 11 | 12 | class FilterResult { 13 | public: 14 | virtual ~FilterResult() = default; 15 | 16 | virtual void updateUI(FilterUiInterface* ui) = 0; 17 | 18 | /** 19 | * \brief Return the filter that generated this result. 20 | * \note Returning a null smart pointer indicates that the result 21 | * was generated by a task that doesn't belong to a filter. 22 | * That would be LoadFileTask. 23 | */ 24 | 25 | virtual std::shared_ptr filter() = 0; 26 | }; 27 | 28 | 29 | using FilterResultPtr = std::shared_ptr; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/core/FontIconPack.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_FONTICONPACK_H_ 5 | #define SCANTAILOR_CORE_FONTICONPACK_H_ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include "AbstractIconPack.h" 13 | 14 | class QDomElement; 15 | 16 | class FontIconPack : public AbstractIconPack { 17 | public: 18 | static std::unique_ptr createDefault(); 19 | 20 | explicit FontIconPack(const QString& iconSheetPath); 21 | 22 | QIcon getIcon(const QString& iconKey) const override; 23 | 24 | private: 25 | void addIconFromElement(const QDomElement& iconElement); 26 | 27 | std::unordered_map> m_iconMap; 28 | }; 29 | 30 | 31 | #endif // SCANTAILOR_CORE_FONTICONPACK_H_ 32 | -------------------------------------------------------------------------------- /src/core/IconPack.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ICONPACK_H_ 5 | #define SCANTAILOR_CORE_ICONPACK_H_ 6 | 7 | #include 8 | #include 9 | 10 | class QString; 11 | 12 | class IconPack { 13 | public: 14 | virtual ~IconPack() = default; 15 | 16 | virtual QIcon getIcon(const QString& iconKey) const = 0; 17 | 18 | virtual void mergeWith(std::unique_ptr pack) = 0; 19 | }; 20 | 21 | #endif // SCANTAILOR_CORE_ICONPACK_H_ 22 | -------------------------------------------------------------------------------- /src/core/IconProvider.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "IconProvider.h" 5 | 6 | #include "IconPack.h" 7 | 8 | IconProvider::IconProvider() = default; 9 | 10 | IconProvider::~IconProvider() = default; 11 | 12 | IconProvider& IconProvider::getInstance() { 13 | static IconProvider instance; 14 | return instance; 15 | } 16 | 17 | void IconProvider::setIconPack(std::unique_ptr pack) { 18 | m_iconPack = std::move(pack); 19 | } 20 | 21 | void IconProvider::addIconPack(std::unique_ptr pack) { 22 | if (pack) { 23 | pack->mergeWith(std::move(m_iconPack)); 24 | m_iconPack = std::move(pack); 25 | } 26 | } 27 | 28 | QIcon IconProvider::getIcon(const QString& iconKey) const { 29 | return m_iconPack ? m_iconPack->getIcon(iconKey) : QIcon(); 30 | } 31 | -------------------------------------------------------------------------------- /src/core/IconProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ICONPROVIDER_H_ 5 | #define SCANTAILOR_CORE_ICONPROVIDER_H_ 6 | 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | class IconPack; 14 | 15 | class IconProvider { 16 | DECLARE_NON_COPYABLE(IconProvider) 17 | private: 18 | IconProvider(); 19 | 20 | ~IconProvider(); 21 | 22 | public: 23 | static IconProvider& getInstance(); 24 | 25 | void setIconPack(std::unique_ptr pack); 26 | 27 | void addIconPack(std::unique_ptr pack); 28 | 29 | QIcon getIcon(const QString& iconKey) const; 30 | 31 | private: 32 | std::unique_ptr m_iconPack; 33 | }; 34 | 35 | 36 | #endif // SCANTAILOR_CORE_ICONPROVIDER_H_ 37 | -------------------------------------------------------------------------------- /src/core/ImageFileInfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "ImageFileInfo.h" 5 | 6 | #include 7 | #include 8 | 9 | bool ImageFileInfo::isDpiOK() const { 10 | using namespace boost::lambda; 11 | return std::find_if(m_imageInfo.begin(), m_imageInfo.end(), !bind(&ImageMetadata::isDpiOK, _1)) == m_imageInfo.end(); 12 | } 13 | -------------------------------------------------------------------------------- /src/core/ImageId.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "ImageId.h" 5 | 6 | #include 7 | 8 | ImageId::ImageId(const QString& filePath, const int page) : m_filePath(filePath), m_page(page) {} 9 | 10 | ImageId::ImageId(const QFileInfo& fileInfo, const int page) : m_filePath(fileInfo.absoluteFilePath()), m_page(page) {} 11 | 12 | bool operator==(const ImageId& lhs, const ImageId& rhs) { 13 | return ((lhs.page() == rhs.page()) && (lhs.filePath() == rhs.filePath())); 14 | } 15 | 16 | bool operator!=(const ImageId& lhs, const ImageId& rhs) { 17 | return !(lhs == rhs); 18 | } 19 | 20 | bool operator<(const ImageId& lhs, const ImageId& rhs) { 21 | const int comp = lhs.filePath().compare(rhs.filePath()); 22 | if (comp < 0) { 23 | return true; 24 | } else if (comp > 0) { 25 | return false; 26 | } 27 | return lhs.page() < rhs.page(); 28 | } 29 | -------------------------------------------------------------------------------- /src/core/ImageInfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "ImageInfo.h" 5 | 6 | ImageInfo::ImageInfo() : m_numSubPages(0), m_leftHalfRemoved(false), m_rightHalfRemoved(false) {} 7 | 8 | ImageInfo::ImageInfo(const ImageId& id, 9 | const ImageMetadata& metadata, 10 | int numSubPages, 11 | bool leftHalfRemoved, 12 | bool rightHalfRemoved) 13 | : m_id(id), 14 | m_metadata(metadata), 15 | m_numSubPages(numSubPages), 16 | m_leftHalfRemoved(leftHalfRemoved), 17 | m_rightHalfRemoved(rightHalfRemoved) {} 18 | -------------------------------------------------------------------------------- /src/core/ImageLoader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_IMAGELOADER_H_ 5 | #define SCANTAILOR_CORE_IMAGELOADER_H_ 6 | 7 | class ImageId; 8 | class QImage; 9 | class QString; 10 | class QIODevice; 11 | 12 | class ImageLoader { 13 | public: 14 | static QImage load(const QString& filePath, int pageNum = 0); 15 | 16 | static QImage load(const ImageId& imageId); 17 | 18 | static QImage load(QIODevice& ioDev, int pageNum); 19 | }; 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/core/ImagePixmapUnion.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_IMAGEPIXMAPUNION_H_ 5 | #define SCANTAILOR_CORE_IMAGEPIXMAPUNION_H_ 6 | 7 | #include 8 | #include 9 | 10 | class ImagePixmapUnion { 11 | // Member-wise copying is OK. 12 | public: 13 | ImagePixmapUnion() = default; 14 | 15 | ImagePixmapUnion(const QImage& image) : m_image(image) {} 16 | 17 | ImagePixmapUnion(const QPixmap& pixmap) : m_pixmap(pixmap) {} 18 | 19 | const QImage& image() const { return m_image; } 20 | 21 | const QPixmap& pixmap() const { return m_pixmap; } 22 | 23 | bool isNull() const { return m_image.isNull() && m_pixmap.isNull(); } 24 | 25 | private: 26 | QImage m_image; 27 | QPixmap m_pixmap; 28 | }; 29 | 30 | 31 | #endif // ifndef SCANTAILOR_CORE_IMAGEPIXMAPUNION_H_ 32 | -------------------------------------------------------------------------------- /src/core/ImageViewInfoListener.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_IMAGEVIEWINFOLISTENER_H_ 5 | #define SCANTAILOR_CORE_IMAGEVIEWINFOLISTENER_H_ 6 | 7 | 8 | #include 9 | #include 10 | 11 | class Dpi; 12 | 13 | class ImageViewInfoListener { 14 | public: 15 | virtual ~ImageViewInfoListener() = default; 16 | 17 | virtual void onMousePosChanged(const QPointF& mousePos) = 0; 18 | 19 | virtual void onPhysSizeChanged(const QSizeF& physSize) = 0; 20 | 21 | virtual void onDpiChanged(const Dpi& dpi) = 0; 22 | 23 | virtual void onImageViewInfoProviderStopped() = 0; 24 | }; 25 | 26 | 27 | #endif // SCANTAILOR_CORE_IMAGEVIEWINFOLISTENER_H_ 28 | -------------------------------------------------------------------------------- /src/core/JpegMetadataLoader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_JPEGMETADATALOADER_H_ 5 | #define SCANTAILOR_CORE_JPEGMETADATALOADER_H_ 6 | 7 | #include 8 | 9 | #include "ImageMetadataLoader.h" 10 | #include "VirtualFunction.h" 11 | 12 | class QIODevice; 13 | class ImageMetadata; 14 | 15 | class JpegMetadataLoader : public ImageMetadataLoader { 16 | protected: 17 | Status loadMetadata(QIODevice& ioDevice, const VirtualFunction& out) override; 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/core/LightColorScheme.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_LIGHTCOLORSCHEME_H_ 5 | #define SCANTAILOR_CORE_LIGHTCOLORSCHEME_H_ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "ColorScheme.h" 12 | 13 | class LightColorScheme : public ColorScheme { 14 | public: 15 | LightColorScheme(); 16 | 17 | QStyle* getStyle() const override; 18 | 19 | const QPalette* getPalette() const override; 20 | 21 | const QString* getStyleSheet() const override; 22 | 23 | const ColorParams* getColorParams() const override; 24 | 25 | private: 26 | void loadPalette(); 27 | 28 | void loadStyleSheet(); 29 | 30 | void loadColorParams(); 31 | 32 | QPalette m_palette; 33 | QString m_styleSheet; 34 | ColorParams m_customColors; 35 | }; 36 | 37 | 38 | #endif // SCANTAILOR_CORE_LIGHTCOLORSCHEME_H_ 39 | -------------------------------------------------------------------------------- /src/core/NativeColorScheme.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_NATIVECOLORSCHEME_H_ 5 | #define SCANTAILOR_CORE_NATIVECOLORSCHEME_H_ 6 | 7 | #include 8 | 9 | #include "ColorScheme.h" 10 | 11 | class NativeColorScheme : public ColorScheme { 12 | public: 13 | NativeColorScheme(); 14 | 15 | QStyle* getStyle() const override; 16 | 17 | const QPalette* getPalette() const override; 18 | 19 | const QString* getStyleSheet() const override; 20 | 21 | const ColorParams* getColorParams() const override; 22 | 23 | private: 24 | void loadStyleSheet(); 25 | 26 | void loadColorParams(); 27 | 28 | QString m_styleSheet; 29 | ColorParams m_customColors; 30 | }; 31 | 32 | #endif // SCANTAILOR_CORE_NATIVECOLORSCHEME_H_ 33 | -------------------------------------------------------------------------------- /src/core/NonOwningWidget.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "NonOwningWidget.h" 5 | 6 | NonOwningWidget::NonOwningWidget(QWidget* parent) : QWidget(parent) {} 7 | 8 | NonOwningWidget::~NonOwningWidget() { 9 | for (QObject* child : children()) { 10 | if (auto* widget = dynamic_cast(child)) { 11 | widget->setParent(nullptr); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/core/NonOwningWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_NONOWNINGWIDGET_H_ 5 | #define SCANTAILOR_CORE_NONOWNINGWIDGET_H_ 6 | 7 | #include 8 | 9 | /** 10 | * \brief Your normal QWidget, except it doesn't delete its children with itself, 11 | * rather it calls setParent(0) on them. 12 | */ 13 | class NonOwningWidget : public QWidget { 14 | public: 15 | explicit NonOwningWidget(QWidget* parent = nullptr); 16 | 17 | ~NonOwningWidget() override; 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/core/NullTaskStatus.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_NULLTASKSTATUS_H_ 5 | #define SCANTAILOR_CORE_NULLTASKSTATUS_H_ 6 | 7 | #include "TaskStatus.h" 8 | 9 | class NullTaskStatus : public TaskStatus { 10 | void cancel() override {} 11 | 12 | bool isCancelled() const override { return false; } 13 | 14 | void throwIfCancelled() const override {} 15 | }; 16 | 17 | #endif // SCANTAILOR_CORE_NULLTASKSTATUS_H_ 18 | -------------------------------------------------------------------------------- /src/core/OpenGLSupport.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_OPENGLSUPPORT_H_ 5 | #define SCANTAILOR_CORE_OPENGLSUPPORT_H_ 6 | 7 | #include 8 | 9 | class OpenGLSupport { 10 | public: 11 | /** 12 | * \brief Returns true if OpenGL support is present and provides the necessary features. 13 | */ 14 | static bool supported(); 15 | 16 | /** 17 | * \brief Returns the device name (GL_RENDERER) associated with the default OpenGL context. 18 | * 19 | * \note This function has to be called from the GUI thread only. 20 | */ 21 | static QString deviceName(); 22 | }; 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/core/OrderByCompletenessProvider.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "OrderByCompletenessProvider.h" 5 | 6 | bool OrderByCompletenessProvider::precedes(const PageId&, bool lhsIncomplete, const PageId&, bool rhsIncomplete) const { 7 | if (lhsIncomplete != rhsIncomplete) { 8 | // Incomplete pages go to the back. 9 | return rhsIncomplete; 10 | } 11 | return true; 12 | } 13 | -------------------------------------------------------------------------------- /src/core/OrderByCompletenessProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ORDERBYCOMPLETENESSPROVIDER_H_ 5 | #define SCANTAILOR_CORE_ORDERBYCOMPLETENESSPROVIDER_H_ 6 | 7 | #include "PageOrderProvider.h" 8 | 9 | class OrderByCompletenessProvider : public PageOrderProvider { 10 | public: 11 | OrderByCompletenessProvider() = default; 12 | 13 | bool precedes(const PageId&, bool lhsIncomplete, const PageId&, bool rhsIncomplete) const override; 14 | }; 15 | 16 | 17 | #endif // SCANTAILOR_CORE_ORDERBYCOMPLETENESSPROVIDER_H_ 18 | -------------------------------------------------------------------------------- /src/core/OrderByDeviationProvider.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "OrderByDeviationProvider.h" 5 | 6 | OrderByDeviationProvider::OrderByDeviationProvider(const DeviationProvider& deviationProvider) 7 | : m_deviationProvider(&deviationProvider) {} 8 | 9 | bool OrderByDeviationProvider::precedes(const PageId& lhsPage, 10 | bool lhsIncomplete, 11 | const PageId& rhsPage, 12 | bool rhsIncomplete) const { 13 | if (lhsIncomplete != rhsIncomplete) { 14 | // Invalid (unknown) sizes go to the back. 15 | return lhsIncomplete; 16 | } 17 | return (m_deviationProvider->getDeviationValue(lhsPage) > m_deviationProvider->getDeviationValue(rhsPage)); 18 | } 19 | -------------------------------------------------------------------------------- /src/core/OrderByDeviationProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ORDERBYDEVIATIONPROVIDER_H_ 5 | #define SCANTAILOR_CORE_ORDERBYDEVIATIONPROVIDER_H_ 6 | 7 | #include "DeviationProvider.h" 8 | #include "PageId.h" 9 | #include "PageOrderProvider.h" 10 | 11 | class OrderByDeviationProvider : public PageOrderProvider { 12 | public: 13 | explicit OrderByDeviationProvider(const DeviationProvider& deviationProvider); 14 | 15 | bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const override; 16 | 17 | private: 18 | const DeviationProvider* m_deviationProvider; 19 | }; 20 | 21 | 22 | #endif // SCANTAILOR_CORE_ORDERBYDEVIATIONPROVIDER_H_ 23 | -------------------------------------------------------------------------------- /src/core/PageInfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PageInfo.h" 5 | 6 | PageInfo::PageInfo() : m_imageSubPages(0), m_leftHalfRemoved(false), m_rightHalfRemoved(false) {} 7 | 8 | PageInfo::PageInfo(const PageId& pageId, 9 | const ImageMetadata& metadata, 10 | int imageSubPages, 11 | bool leftHalfRemoved, 12 | bool rightHalfRemoved) 13 | : m_pageId(pageId), 14 | m_metadata(metadata), 15 | m_imageSubPages(imageSubPages), 16 | m_leftHalfRemoved(leftHalfRemoved), 17 | m_rightHalfRemoved(rightHalfRemoved) {} 18 | -------------------------------------------------------------------------------- /src/core/PageOrderProvider.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PageOrderProvider.h" 5 | 6 | std::shared_ptr PageOrderProvider::reversed() const { 7 | class ReversedPageOrderProvider : public PageOrderProvider { 8 | public: 9 | explicit ReversedPageOrderProvider(const PageOrderProvider* parent) : m_parent(parent->shared_from_this()) {} 10 | 11 | bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const override { 12 | return m_parent->precedes(rhsPage, rhsIncomplete, lhsPage, lhsIncomplete); 13 | } 14 | 15 | private: 16 | const std::shared_ptr m_parent; 17 | }; 18 | return std::make_shared(this); 19 | } 20 | -------------------------------------------------------------------------------- /src/core/PageOrderProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PAGEORDERPROVIDER_H_ 5 | #define SCANTAILOR_CORE_PAGEORDERPROVIDER_H_ 6 | 7 | #include 8 | 9 | class PageId; 10 | 11 | /** 12 | * A base interface for different page ordering strategies. 13 | */ 14 | class PageOrderProvider : public std::enable_shared_from_this { 15 | public: 16 | virtual ~PageOrderProvider() = default; 17 | 18 | /** 19 | * Returns true if \p lhsPage precedes \p rhsPage. 20 | * \p lhsIncomplete and \p rhsIncomplete indicate whether 21 | * a page is represented by IncompleteThumbnail. 22 | */ 23 | virtual bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const = 0; 24 | 25 | virtual std::shared_ptr reversed() const; 26 | }; 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/core/PageOrientationCollector.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PAGEORIENTATIONCOLLECTOR_H_ 5 | #define SCANTAILOR_CORE_PAGEORIENTATIONCOLLECTOR_H_ 6 | 7 | #include "AbstractFilterDataCollector.h" 8 | 9 | class OrthogonalRotation; 10 | 11 | class PageOrientationCollector : public AbstractFilterDataCollector { 12 | public: 13 | virtual void process(const OrthogonalRotation& orientation) = 0; 14 | }; 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/core/PageRange.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PageRange.h" 5 | 6 | std::set PageRange::selectEveryOther(const PageId& base) const { 7 | std::set selection; 8 | 9 | auto it(pages.begin()); 10 | const auto end(pages.end()); 11 | for (; it != end && *it != base; ++it) { 12 | // Continue until we have a match. 13 | } 14 | if (it == end) { 15 | return selection; 16 | } 17 | 18 | const int baseIdx = static_cast(it - pages.begin()); 19 | int idx = 0; 20 | for (const PageId& pageId : pages) { 21 | if (((idx - baseIdx) & 1) == 0) { 22 | selection.insert(pageId); 23 | } 24 | ++idx; 25 | } 26 | return selection; 27 | } 28 | -------------------------------------------------------------------------------- /src/core/PageRange.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PAGERANGE_H_ 5 | #define SCANTAILOR_CORE_PAGERANGE_H_ 6 | 7 | #include 8 | #include 9 | 10 | #include "PageId.h" 11 | 12 | class PageRange { 13 | public: 14 | /** 15 | * \brief Ordered list of consecutive pages. 16 | */ 17 | std::vector pages; 18 | 19 | std::set selectEveryOther(const PageId& base) const; 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/core/PageSelectionAccessor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PageSelectionAccessor.h" 5 | 6 | #include 7 | 8 | #include "PageSequence.h" 9 | 10 | PageSelectionAccessor::PageSelectionAccessor(std::shared_ptr provider) 11 | : m_provider(std::move(provider)) {} 12 | 13 | PageSequence PageSelectionAccessor::allPages() const { 14 | return m_provider->allPages(); 15 | } 16 | 17 | std::set PageSelectionAccessor::selectedPages() const { 18 | return m_provider->selectedPages(); 19 | } 20 | 21 | std::vector PageSelectionAccessor::selectedRanges() const { 22 | return m_provider->selectedRanges(); 23 | } 24 | -------------------------------------------------------------------------------- /src/core/PageSelectionAccessor.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PAGESELECTIONACCESSOR_H_ 5 | #define SCANTAILOR_CORE_PAGESELECTIONACCESSOR_H_ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "PageId.h" 12 | #include "PageRange.h" 13 | #include "PageSelectionProvider.h" 14 | 15 | class PageSequence; 16 | 17 | class PageSelectionAccessor { 18 | // Member-wise copying is OK. 19 | public: 20 | explicit PageSelectionAccessor(std::shared_ptr provider); 21 | 22 | PageSequence allPages() const; 23 | 24 | std::set selectedPages() const; 25 | 26 | std::vector selectedRanges() const; 27 | 28 | private: 29 | std::shared_ptr m_provider; 30 | }; 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/core/PageSelectionProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PAGESELECTIONPROVIDER_H_ 5 | #define SCANTAILOR_CORE_PAGESELECTIONPROVIDER_H_ 6 | 7 | #include 8 | #include 9 | 10 | 11 | class PageSequence; 12 | class PageId; 13 | class PageRange; 14 | 15 | class PageSelectionProvider { 16 | public: 17 | virtual ~PageSelectionProvider() = default; 18 | 19 | virtual PageSequence allPages() const = 0; 20 | 21 | virtual std::set selectedPages() const = 0; 22 | 23 | virtual std::vector selectedRanges() const = 0; 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/core/PageView.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PAGEVIEW_H_ 5 | #define SCANTAILOR_CORE_PAGEVIEW_H_ 6 | 7 | enum PageView { IMAGE_VIEW, PAGE_VIEW }; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/core/PayloadEvent.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PAYLOADEVENT_H_ 5 | #define SCANTAILOR_CORE_PAYLOADEVENT_H_ 6 | 7 | #include 8 | 9 | template 10 | class PayloadEvent : public QEvent { 11 | public: 12 | explicit PayloadEvent(const T& payload) : QEvent(User), m_payload(payload) {} 13 | 14 | const T& payload() const { return m_payload; } 15 | 16 | T& payload() { return m_payload; } 17 | 18 | private: 19 | T m_payload; 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/core/PixmapRenderer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PixmapRenderer.h" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | void PixmapRenderer::drawPixmap(QPainter& painter, const QPixmap& pixmap) { 13 | const QTransform invTransform(painter.worldTransform().inverted()); 14 | const QRectF srcRect(invTransform.map(QRectF(painter.viewport())).boundingRect()); 15 | const QRectF boundedSrcRect(srcRect.intersected(pixmap.rect())); 16 | painter.drawPixmap(boundedSrcRect, pixmap, boundedSrcRect); 17 | } 18 | -------------------------------------------------------------------------------- /src/core/PixmapRenderer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PIXMAPRENDERER_H_ 5 | #define SCANTAILOR_CORE_PIXMAPRENDERER_H_ 6 | 7 | class QPainter; 8 | class QPixmap; 9 | 10 | class PixmapRenderer { 11 | public: 12 | /** 13 | * \brief Workarounds an issue with QPainter::drawPixmap(). 14 | * 15 | * This method is more or less equivalent to: 16 | * \code 17 | * QPainter::drawPixmap(0, 0, pixmap); 18 | * \endcode 19 | * However, Qt's raster paint engine for some reason refuses to draw 20 | * the pixmap at all if a very strong zoom is applied (as of Qt 5.4.0). 21 | * This method solves the problem above by calculating the visible area 22 | * of the pixmap and communicating that information to QPainter. 23 | */ 24 | static void drawPixmap(QPainter& painter, const QPixmap& pixmap); 25 | }; 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/core/PngMetadataLoader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_PNGMETADATALOADER_H_ 5 | #define SCANTAILOR_CORE_PNGMETADATALOADER_H_ 6 | 7 | #include 8 | 9 | #include "ImageMetadataLoader.h" 10 | #include "VirtualFunction.h" 11 | 12 | class QIODevice; 13 | class ImageMetadata; 14 | 15 | class PngMetadataLoader : public ImageMetadataLoader { 16 | protected: 17 | Status loadMetadata(QIODevice& ioDevice, const VirtualFunction& out) override; 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/core/SelectedPage.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "SelectedPage.h" 5 | 6 | SelectedPage::SelectedPage(const PageId& pageId, PageView view) { 7 | set(pageId, view); 8 | } 9 | 10 | void SelectedPage::set(const PageId& pageId, PageView view) { 11 | if ((view == PAGE_VIEW) || (pageId.imageId() != m_pageId.imageId())) { 12 | m_pageId = pageId; 13 | } 14 | } 15 | 16 | PageId SelectedPage::get(PageView view) const { 17 | if (view == PAGE_VIEW) { 18 | return m_pageId; 19 | } else { 20 | return PageId(m_pageId.imageId(), PageId::SINGLE_PAGE); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/core/SmartFilenameOrdering.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_SMARTFILENAMEORDERING_H_ 5 | #define SCANTAILOR_CORE_SMARTFILENAMEORDERING_H_ 6 | 7 | class QFileInfo; 8 | 9 | class SmartFilenameOrdering { 10 | public: 11 | SmartFilenameOrdering() = default; 12 | 13 | /** 14 | * \brief Compare filenames using a set of heuristic rules. 15 | * 16 | * This function tries to mimic the way humans would order filenames. 17 | * For example, "2.png" will go before "12.png". While doing so, 18 | * it still provides the usual guarantees of a comparison predicate, 19 | * such as two different file paths will never be ruled equivalent. 20 | * 21 | * \return true if \p lhs should go before \p rhs. 22 | */ 23 | bool operator()(const QFileInfo& lhs, const QFileInfo& rhs) const; 24 | }; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/core/StyledIconPack.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_STYLEDICONPACK_H_ 5 | #define SCANTAILOR_CORE_STYLEDICONPACK_H_ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include "AbstractIconPack.h" 13 | 14 | class QDomElement; 15 | 16 | class StyledIconPack : public AbstractIconPack { 17 | public: 18 | static std::unique_ptr createDefault(); 19 | 20 | explicit StyledIconPack(const QString& iconSheetPath); 21 | 22 | QIcon getIcon(const QString& iconKey) const override; 23 | 24 | private: 25 | void addIconFromElement(const QDomElement& iconElement); 26 | 27 | std::unordered_map> m_iconMap; 28 | }; 29 | 30 | 31 | #endif // SCANTAILOR_CORE_STYLEDICONPACK_H_ 32 | -------------------------------------------------------------------------------- /src/core/TabbedDebugImages.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "TabbedDebugImages.h" 5 | 6 | #include "DebugImageView.h" 7 | 8 | TabbedDebugImages::TabbedDebugImages(QWidget* parent) : QTabWidget(parent) { 9 | setDocumentMode(true); 10 | connect(this, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int))); 11 | } 12 | 13 | void TabbedDebugImages::currentTabChanged(const int idx) { 14 | if (auto* div = dynamic_cast(widget(idx))) { 15 | div->unlink(); 16 | m_liveViews.push_back(*div); 17 | removeExcessLiveViews(); 18 | div->setLive(true); 19 | } 20 | } 21 | 22 | void TabbedDebugImages::removeExcessLiveViews() { 23 | auto remaining = static_cast(m_liveViews.size()); 24 | for (; remaining > MAX_LIVE_VIEWS; --remaining) { 25 | m_liveViews.front().setLive(false); 26 | m_liveViews.erase(m_liveViews.begin()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/core/ThumbnailCollector.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_THUMBNAILCOLLECTOR_H_ 5 | #define SCANTAILOR_CORE_THUMBNAILCOLLECTOR_H_ 6 | 7 | #include 8 | 9 | #include "AbstractFilterDataCollector.h" 10 | 11 | class ThumbnailPixmapCache; 12 | class QGraphicsItem; 13 | class QSizeF; 14 | 15 | class ThumbnailCollector : public AbstractFilterDataCollector { 16 | public: 17 | virtual void processThumbnail(std::unique_ptr) = 0; 18 | 19 | virtual std::shared_ptr thumbnailCache() = 0; 20 | 21 | virtual QSizeF maxLogicalThumbSize() const = 0; 22 | }; 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/core/TiffMetadataLoader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "TiffMetadataLoader.h" 5 | 6 | #include "TiffReader.h" 7 | 8 | ImageMetadataLoader::Status TiffMetadataLoader::loadMetadata(QIODevice& ioDevice, 9 | const VirtualFunction& out) { 10 | return TiffReader::readMetadata(ioDevice, out); 11 | } 12 | -------------------------------------------------------------------------------- /src/core/TiffMetadataLoader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_TIFFMETADATALOADER_H_ 5 | #define SCANTAILOR_CORE_TIFFMETADATALOADER_H_ 6 | 7 | #include 8 | 9 | #include "ImageMetadataLoader.h" 10 | #include "VirtualFunction.h" 11 | 12 | class QIODevice; 13 | class ImageMetadata; 14 | 15 | class TiffMetadataLoader : public ImageMetadataLoader { 16 | protected: 17 | Status loadMetadata(QIODevice& ioDevice, const VirtualFunction& out) override; 18 | }; 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/core/Units.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_UNITS_H_ 5 | #define SCANTAILOR_CORE_UNITS_H_ 6 | 7 | 8 | #include 9 | 10 | enum Units { PIXELS, MILLIMETRES, CENTIMETRES, INCHES }; 11 | 12 | QString unitsToString(Units units); 13 | 14 | Units unitsFromString(const QString& string); 15 | 16 | QString unitsToLocalizedString(Units units); 17 | 18 | #endif // SCANTAILOR_CORE_UNITS_H_ 19 | -------------------------------------------------------------------------------- /src/core/UnitsConverter.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_UNITSCONVERTER_H_ 5 | #define SCANTAILOR_CORE_UNITSCONVERTER_H_ 6 | 7 | 8 | #include 9 | 10 | #include "Dpi.h" 11 | #include "Units.h" 12 | 13 | class UnitsConverter { 14 | public: 15 | UnitsConverter() = default; 16 | 17 | explicit UnitsConverter(const Dpi& dpi); 18 | 19 | void convert(double& horizontalValue, double& verticalValue, Units fromUnits, Units toUnits) const; 20 | 21 | QTransform transform(Units fromUnits, Units toUnits) const; 22 | 23 | const Dpi& getDpi() const { return m_dpi; } 24 | 25 | void setDpi(const Dpi& dpi) { m_dpi = dpi; } 26 | 27 | private: 28 | Dpi m_dpi; 29 | }; 30 | 31 | 32 | #endif // SCANTAILOR_CORE_UNITSCONVERTER_H_ 33 | -------------------------------------------------------------------------------- /src/core/UnitsListener.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "UnitsListener.h" 5 | 6 | #include "UnitsProvider.h" 7 | 8 | UnitsListener::UnitsListener() { 9 | UnitsProvider::getInstance().addListener(this); 10 | } 11 | 12 | UnitsListener::~UnitsListener() { 13 | UnitsProvider::getInstance().removeListener(this); 14 | } -------------------------------------------------------------------------------- /src/core/UnitsListener.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_UNITSLISTENER_H_ 5 | #define SCANTAILOR_CORE_UNITSLISTENER_H_ 6 | 7 | 8 | #include "Units.h" 9 | 10 | class Dpi; 11 | 12 | class UnitsListener { 13 | protected: 14 | UnitsListener(); 15 | 16 | public: 17 | virtual ~UnitsListener(); 18 | 19 | virtual void onUnitsChanged(Units units) = 0; 20 | }; 21 | 22 | #endif // SCANTAILOR_CORE_UNITSLISTENER_H_ 23 | -------------------------------------------------------------------------------- /src/core/ZoneModeListener.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_CORE_ZONEMODELISTENER_H_ 5 | #define SCANTAILOR_CORE_ZONEMODELISTENER_H_ 6 | 7 | #include 8 | 9 | class ZoneModeListener { 10 | public: 11 | virtual ~ZoneModeListener() = default; 12 | 13 | virtual void onZoneModeChanged(ZoneCreationMode mode) = 0; 14 | 15 | virtual void onZoneModeProviderStopped() = 0; 16 | }; 17 | 18 | 19 | #endif // SCANTAILOR_CORE_ZONEMODELISTENER_H_ 20 | -------------------------------------------------------------------------------- /src/core/filters/deskew/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOUIC ON) 2 | 3 | set(ui_files 4 | ApplyDialog.ui 5 | OptionsWidget.ui) 6 | 7 | set(sources 8 | ImageView.cpp ImageView.h 9 | Thumbnail.cpp Thumbnail.h 10 | Filter.cpp Filter.h 11 | OptionsWidget.cpp OptionsWidget.h 12 | Settings.cpp Settings.h 13 | Task.cpp Task.h 14 | CacheDrivenTask.cpp CacheDrivenTask.h 15 | Dependencies.cpp Dependencies.h 16 | Params.cpp Params.h 17 | ApplyDialog.cpp ApplyDialog.h 18 | Utils.cpp Utils.h) 19 | 20 | add_library(deskew STATIC ${sources} ${ui_files}) 21 | target_link_libraries(deskew PUBLIC core) 22 | 23 | translation_sources(scantailor ${sources} ${ui_files}) -------------------------------------------------------------------------------- /src/core/filters/deskew/Utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "Utils.h" 5 | 6 | #include 7 | #include 8 | 9 | #include "Params.h" 10 | 11 | using namespace deskew; 12 | 13 | Params Utils::buildDefaultParams() { 14 | const DefaultParams& defaultParams = DefaultParamsProvider::getInstance().getParams(); 15 | const DefaultParams::DeskewParams& deskewParams = defaultParams.getDeskewParams(); 16 | 17 | return Params(deskewParams.getDeskewAngleDeg(), Dependencies(), deskewParams.getMode()); 18 | } 19 | -------------------------------------------------------------------------------- /src/core/filters/deskew/Utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_DESKEW_UTILS_H_ 5 | #define SCANTAILOR_DESKEW_UTILS_H_ 6 | 7 | namespace deskew { 8 | class Params; 9 | 10 | class Utils { 11 | public: 12 | Utils() = delete; 13 | 14 | static Params buildDefaultParams(); 15 | }; 16 | } // namespace deskew 17 | 18 | #endif // SCANTAILOR_DESKEW_UTILS_H_ 19 | -------------------------------------------------------------------------------- /src/core/filters/fix_orientation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOUIC ON) 2 | 3 | set(ui_files 4 | ApplyDialog.ui 5 | OptionsWidget.ui) 6 | 7 | set(sources 8 | ImageView.cpp ImageView.h 9 | Filter.cpp Filter.h 10 | OptionsWidget.cpp OptionsWidget.h 11 | ApplyDialog.cpp ApplyDialog.h 12 | Settings.cpp Settings.h 13 | Task.cpp Task.h 14 | CacheDrivenTask.cpp CacheDrivenTask.h 15 | Utils.cpp Utils.h) 16 | 17 | add_library(fix_orientation STATIC ${sources} ${ui_files}) 18 | target_link_libraries(fix_orientation PUBLIC core) 19 | 20 | translation_sources(scantailor ${sources} ${ui_files}) -------------------------------------------------------------------------------- /src/core/filters/fix_orientation/ImageView.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FIX_ORIENTATION_IMAGEVIEW_H_ 5 | #define SCANTAILOR_FIX_ORIENTATION_IMAGEVIEW_H_ 6 | 7 | #include "DragHandler.h" 8 | #include "ImageTransformation.h" 9 | #include "ImageViewBase.h" 10 | #include "OrthogonalRotation.h" 11 | #include "ZoomHandler.h" 12 | 13 | namespace fix_orientation { 14 | class ImageView : public ImageViewBase { 15 | Q_OBJECT 16 | public: 17 | ImageView(const QImage& image, const QImage& downscaledImage, const ImageTransformation& xform); 18 | 19 | ~ImageView() override; 20 | 21 | public slots: 22 | 23 | void setPreRotation(OrthogonalRotation rotation); 24 | 25 | private: 26 | DragHandler m_dragHandler; 27 | ZoomHandler m_zoomHandler; 28 | ImageTransformation m_xform; 29 | }; 30 | } // namespace fix_orientation 31 | #endif 32 | -------------------------------------------------------------------------------- /src/core/filters/fix_orientation/Utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "Utils.h" 5 | 6 | #include 7 | #include 8 | 9 | using namespace fix_orientation; 10 | 11 | OrthogonalRotation Utils::getDefaultOrthogonalRotation() { 12 | const DefaultParams& defaultParams = DefaultParamsProvider::getInstance().getParams(); 13 | const DefaultParams::FixOrientationParams& fixOrientationParams = defaultParams.getFixOrientationParams(); 14 | 15 | return fixOrientationParams.getImageRotation(); 16 | } 17 | -------------------------------------------------------------------------------- /src/core/filters/fix_orientation/Utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FIX_ORIENTATION_UTILS_H_ 5 | #define SCANTAILOR_FIX_ORIENTATION_UTILS_H_ 6 | 7 | class OrthogonalRotation; 8 | 9 | namespace fix_orientation { 10 | class Utils { 11 | public: 12 | Utils() = delete; 13 | 14 | static OrthogonalRotation getDefaultOrthogonalRotation(); 15 | }; 16 | } // namespace fix_orientation 17 | 18 | #endif // SCANTAILOR_FIX_ORIENTATION_UTILS_H_ 19 | -------------------------------------------------------------------------------- /src/core/filters/output/BinarizationOptionsWidget.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_BINARIZATIONOPTIONSWIDGET_H_ 5 | #define SCANTAILOR_OUTPUT_BINARIZATIONOPTIONSWIDGET_H_ 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace output { 12 | class BinarizationOptionsWidget : public QWidget { 13 | Q_OBJECT 14 | public: 15 | virtual void updateUi(const PageId& m_pageId) = 0; 16 | 17 | signals: 18 | 19 | /** 20 | * \brief To be emitted by subclasses when their state has changed. 21 | */ 22 | void stateChanged(); 23 | }; 24 | } // namespace output 25 | 26 | 27 | #endif // SCANTAILOR_OUTPUT_BINARIZATIONOPTIONSWIDGET_H_ 28 | -------------------------------------------------------------------------------- /src/core/filters/output/DespeckleLevel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "DespeckleLevel.h" 5 | 6 | #include 7 | 8 | namespace output { 9 | QString despeckleLevelToString(const DespeckleLevel level) { 10 | switch (level) { 11 | case DESPECKLE_OFF: 12 | return "off"; 13 | case DESPECKLE_CAUTIOUS: 14 | return "cautious"; 15 | case DESPECKLE_NORMAL: 16 | return "normal"; 17 | case DESPECKLE_AGGRESSIVE: 18 | return "aggressive"; 19 | } 20 | return QString(); 21 | } 22 | 23 | DespeckleLevel despeckleLevelFromString(const QString& str) { 24 | if (str == "off") { 25 | return DESPECKLE_OFF; 26 | } else if (str == "cautious") { 27 | return DESPECKLE_CAUTIOUS; 28 | } else if (str == "aggressive") { 29 | return DESPECKLE_AGGRESSIVE; 30 | } else { 31 | return DESPECKLE_NORMAL; 32 | } 33 | } 34 | } // namespace output -------------------------------------------------------------------------------- /src/core/filters/output/DespeckleLevel.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_DESPECKLELEVEL_H_ 5 | #define SCANTAILOR_OUTPUT_DESPECKLELEVEL_H_ 6 | 7 | class QString; 8 | 9 | namespace output { 10 | enum DespeckleLevel { DESPECKLE_OFF, DESPECKLE_CAUTIOUS, DESPECKLE_NORMAL, DESPECKLE_AGGRESSIVE }; 11 | 12 | QString despeckleLevelToString(DespeckleLevel level); 13 | 14 | DespeckleLevel despeckleLevelFromString(const QString& str); 15 | } // namespace output 16 | #endif 17 | -------------------------------------------------------------------------------- /src/core/filters/output/FillZoneComparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_FILLZONECOMPARATOR_H_ 5 | #define SCANTAILOR_OUTPUT_FILLZONECOMPARATOR_H_ 6 | 7 | class ZoneSet; 8 | class Zone; 9 | class PropertySet; 10 | 11 | namespace output { 12 | class FillZoneComparator { 13 | public: 14 | static bool equal(const ZoneSet& lhs, const ZoneSet& rhs); 15 | 16 | static bool equal(const Zone& lhs, const Zone& rhs); 17 | 18 | static bool equal(const PropertySet& lhs, const PropertySet& rhs); 19 | }; 20 | } // namespace output 21 | #endif 22 | -------------------------------------------------------------------------------- /src/core/filters/output/FillZonePropFactory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "FillZonePropFactory.h" 5 | 6 | #include "FillColorProperty.h" 7 | 8 | namespace output { 9 | FillZonePropFactory::FillZonePropFactory() { 10 | FillColorProperty::registerIn(*this); 11 | } 12 | } // namespace output 13 | -------------------------------------------------------------------------------- /src/core/filters/output/FillZonePropFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_FILLZONEPROPFACTORY_H_ 5 | #define SCANTAILOR_OUTPUT_FILLZONEPROPFACTORY_H_ 6 | 7 | #include "PropertyFactory.h" 8 | 9 | namespace output { 10 | class FillZonePropFactory : public PropertyFactory { 11 | public: 12 | FillZonePropFactory(); 13 | }; 14 | } // namespace output 15 | #endif 16 | -------------------------------------------------------------------------------- /src/core/filters/output/ForegroundType.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_FOREGROUNDTYPE_H_ 5 | #define SCANTAILOR_OUTPUT_FOREGROUNDTYPE_H_ 6 | 7 | 8 | enum class ForegroundType { COLOR, BINARY, INDEXED }; 9 | 10 | 11 | #endif // SCANTAILOR_OUTPUT_FOREGROUNDTYPE_H_ 12 | -------------------------------------------------------------------------------- /src/core/filters/output/ImageView.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "ImageView.h" 5 | 6 | #include "ImagePresentation.h" 7 | #include "OutputMargins.h" 8 | 9 | namespace output { 10 | ImageView::ImageView(const QImage& image, const QImage& downscaledImage) 11 | : ImageViewBase(image, downscaledImage, ImagePresentation(QTransform(), QRectF(image.rect())), OutputMargins()), 12 | m_dragHandler(*this), 13 | m_zoomHandler(*this) { 14 | rootInteractionHandler().makeLastFollower(m_dragHandler); 15 | rootInteractionHandler().makeLastFollower(m_zoomHandler); 16 | } 17 | 18 | ImageView::~ImageView() = default; 19 | } // namespace output 20 | -------------------------------------------------------------------------------- /src/core/filters/output/ImageView.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_IMAGEVIEW_H_ 5 | #define SCANTAILOR_OUTPUT_IMAGEVIEW_H_ 6 | 7 | #include 8 | 9 | #include "DragHandler.h" 10 | #include "ImageViewBase.h" 11 | #include "ZoomHandler.h" 12 | 13 | class ImageTransformation; 14 | 15 | namespace output { 16 | class ImageView : public ImageViewBase { 17 | Q_OBJECT 18 | public: 19 | ImageView(const QImage& image, const QImage& downscaledImage); 20 | 21 | ~ImageView() override; 22 | 23 | private: 24 | DragHandler m_dragHandler; 25 | ZoomHandler m_zoomHandler; 26 | }; 27 | } // namespace output 28 | #endif 29 | -------------------------------------------------------------------------------- /src/core/filters/output/ImageViewTab.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_IMAGEVIEWTAB_H_ 5 | #define SCANTAILOR_OUTPUT_IMAGEVIEWTAB_H_ 6 | 7 | namespace output { 8 | enum ImageViewTab { TAB_OUTPUT, TAB_PICTURE_ZONES, TAB_FILL_ZONES, TAB_DEWARPING, TAB_DESPECKLING }; 9 | } // namespace output 10 | #endif 11 | -------------------------------------------------------------------------------- /src/core/filters/output/OutputImage.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_OUTPUTIMAGE_H_ 5 | #define SCANTAILOR_OUTPUT_OUTPUTIMAGE_H_ 6 | 7 | #include 8 | 9 | class Dpm; 10 | 11 | namespace output { 12 | class OutputImage { 13 | public: 14 | virtual ~OutputImage() = default; 15 | 16 | virtual QImage toImage() const = 0; 17 | 18 | virtual bool isNull() const = 0; 19 | 20 | virtual void setDpm(const Dpm& dpm) = 0; 21 | 22 | virtual operator QImage() const { return toImage(); } 23 | }; 24 | } // namespace output 25 | 26 | 27 | #endif // SCANTAILOR_OUTPUT_OUTPUTIMAGE_H_ 28 | -------------------------------------------------------------------------------- /src/core/filters/output/OutputImagePlain.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "OutputImagePlain.h" 5 | 6 | #include 7 | 8 | namespace output { 9 | OutputImagePlain::OutputImagePlain(const QImage& image) : m_image(image) {} 10 | 11 | QImage OutputImagePlain::toImage() const { 12 | return m_image; 13 | } 14 | 15 | bool OutputImagePlain::isNull() const { 16 | return m_image.isNull(); 17 | } 18 | 19 | void OutputImagePlain::setDpm(const Dpm& dpm) { 20 | m_image.setDotsPerMeterX(dpm.horizontal()); 21 | m_image.setDotsPerMeterY(dpm.vertical()); 22 | } 23 | } // namespace output -------------------------------------------------------------------------------- /src/core/filters/output/OutputImagePlain.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_OUTPUTIMAGEPLAIN_H_ 5 | #define SCANTAILOR_OUTPUT_OUTPUTIMAGEPLAIN_H_ 6 | 7 | #include "OutputImage.h" 8 | 9 | namespace output { 10 | class OutputImagePlain : public virtual OutputImage { 11 | public: 12 | OutputImagePlain() = default; 13 | 14 | explicit OutputImagePlain(const QImage& image); 15 | 16 | QImage toImage() const override; 17 | 18 | bool isNull() const override; 19 | 20 | void setDpm(const Dpm& dpm) override; 21 | 22 | private: 23 | QImage m_image; 24 | }; 25 | } // namespace output 26 | 27 | 28 | #endif // SCANTAILOR_OUTPUT_OUTPUTIMAGEPLAIN_H_ 29 | -------------------------------------------------------------------------------- /src/core/filters/output/OutputImageWithForeground.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_OUTPUTIMAGEWITHFOREGROUND_H_ 5 | #define SCANTAILOR_OUTPUT_OUTPUTIMAGEWITHFOREGROUND_H_ 6 | 7 | #include "OutputImage.h" 8 | 9 | namespace output { 10 | class OutputImageWithForeground : public virtual OutputImage { 11 | public: 12 | virtual QImage getForegroundImage() const = 0; 13 | 14 | virtual QImage getBackgroundImage() const = 0; 15 | }; 16 | } // namespace output 17 | 18 | #endif // SCANTAILOR_OUTPUT_OUTPUTIMAGEWITHFOREGROUND_H_ 19 | -------------------------------------------------------------------------------- /src/core/filters/output/OutputImageWithOriginalBackground.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_OUTPUTIMAGEWITHORIGINALBACKGROUND_H_ 5 | #define SCANTAILOR_OUTPUT_OUTPUTIMAGEWITHORIGINALBACKGROUND_H_ 6 | 7 | #include "OutputImageWithForeground.h" 8 | 9 | namespace output { 10 | class OutputImageWithOriginalBackground : public virtual OutputImageWithForeground { 11 | public: 12 | virtual QImage getOriginalBackgroundImage() const = 0; 13 | }; 14 | } // namespace output 15 | 16 | 17 | #endif // SCANTAILOR_OUTPUT_OUTPUTIMAGEWITHORIGINALBACKGROUND_H_ 18 | -------------------------------------------------------------------------------- /src/core/filters/output/OutputMargins.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_OUTPUTMARGINS_H_ 5 | #define SCANTAILOR_OUTPUT_OUTPUTMARGINS_H_ 6 | 7 | #include "Margins.h" 8 | 9 | namespace output { 10 | /** 11 | * Having margins on the Output stage is useful when creating zones 12 | * that are meant to cover a corner or an edge of a page. 13 | * We use the same margins on all tabs to preserve their geometrical 14 | * one-to-one relationship. 15 | */ 16 | class OutputMargins : public Margins { 17 | public: 18 | OutputMargins() : Margins(10.0, 10.0, 10.0, 10.0) {} 19 | }; 20 | } // namespace output 21 | #endif 22 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZoneComparator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_PICTUREZONECOMPARATOR_H_ 5 | #define SCANTAILOR_OUTPUT_PICTUREZONECOMPARATOR_H_ 6 | 7 | class ZoneSet; 8 | class Zone; 9 | class PropertySet; 10 | 11 | namespace output { 12 | class PictureZoneComparator { 13 | public: 14 | static bool equal(const ZoneSet& lhs, const ZoneSet& rhs); 15 | 16 | static bool equal(const Zone& lhs, const Zone& rhs); 17 | 18 | static bool equal(const PropertySet& lhs, const PropertySet& rhs); 19 | }; 20 | } // namespace output 21 | #endif 22 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZonePropDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_PICTUREZONEPROPDIALOG_H_ 5 | #define SCANTAILOR_OUTPUT_PICTUREZONEPROPDIALOG_H_ 6 | 7 | #include 8 | #include 9 | 10 | #include "PropertySet.h" 11 | #include "ui_PictureZonePropDialog.h" 12 | 13 | namespace output { 14 | class PictureZonePropDialog : public QDialog { 15 | Q_OBJECT 16 | public: 17 | explicit PictureZonePropDialog(std::shared_ptr props, QWidget* parent = nullptr); 18 | 19 | signals: 20 | void updated(); 21 | 22 | private slots: 23 | void itemToggled(bool selected); 24 | 25 | private: 26 | Ui::PictureZonePropDialog ui; 27 | std::shared_ptr m_props; 28 | }; 29 | } // namespace output 30 | #endif 31 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZonePropFactory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PictureZonePropFactory.h" 5 | 6 | #include "PictureLayerProperty.h" 7 | #include "ZoneCategoryProperty.h" 8 | 9 | namespace output { 10 | PictureZonePropFactory::PictureZonePropFactory() { 11 | PictureLayerProperty::registerIn(*this); 12 | ZoneCategoryProperty::registerIn(*this); 13 | } 14 | } // namespace output 15 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZonePropFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_PICTUREZONEPROPFACTORY_H_ 5 | #define SCANTAILOR_OUTPUT_PICTUREZONEPROPFACTORY_H_ 6 | 7 | #include "PropertyFactory.h" 8 | 9 | namespace output { 10 | class PictureZonePropFactory : public PropertyFactory { 11 | public: 12 | PictureZonePropFactory(); 13 | }; 14 | } // namespace output 15 | #endif 16 | -------------------------------------------------------------------------------- /src/core/filters/output/Thumbnail.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "Thumbnail.h" 5 | 6 | #include 7 | 8 | namespace output { 9 | Thumbnail::Thumbnail(std::shared_ptr thumbnailCache, 10 | const QSizeF& maxSize, 11 | const ImageId& imageId, 12 | const ImageTransformation& xform) 13 | : ThumbnailBase(std::move(thumbnailCache), maxSize, imageId, xform) {} 14 | } // namespace output 15 | -------------------------------------------------------------------------------- /src/core/filters/output/Thumbnail.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_OUTPUT_THUMBNAIL_H_ 5 | #define SCANTAILOR_OUTPUT_THUMBNAIL_H_ 6 | 7 | #include 8 | 9 | #include "ThumbnailBase.h" 10 | 11 | class ThumbnailPixmapCache; 12 | class ImageTransformation; 13 | class ImageId; 14 | class QSizeF; 15 | 16 | namespace output { 17 | class Thumbnail : public ThumbnailBase { 18 | public: 19 | Thumbnail(std::shared_ptr thumbnailCache, 20 | const QSizeF& maxSize, 21 | const ImageId& imageId, 22 | const ImageTransformation& xform); 23 | }; 24 | } // namespace output 25 | #endif 26 | -------------------------------------------------------------------------------- /src/core/filters/page_layout/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOUIC ON) 2 | 3 | set(ui_files 4 | ApplyDialog.ui 5 | OptionsWidget.ui) 6 | 7 | set(sources 8 | Utils.cpp Utils.h 9 | ImageView.cpp ImageView.h 10 | Filter.cpp Filter.h 11 | OptionsWidget.cpp OptionsWidget.h 12 | Task.cpp Task.h 13 | CacheDrivenTask.cpp CacheDrivenTask.h 14 | Params.cpp Params.h 15 | Settings.cpp Settings.h 16 | Thumbnail.cpp Thumbnail.h 17 | ApplyDialog.cpp ApplyDialog.h 18 | Alignment.cpp Alignment.h 19 | OrderByWidthProvider.cpp OrderByWidthProvider.h 20 | OrderByHeightProvider.cpp OrderByHeightProvider.h 21 | Guide.cpp Guide.h) 22 | 23 | add_library(page_layout STATIC ${sources} ${ui_files}) 24 | target_link_libraries(page_layout PUBLIC core) 25 | 26 | translation_sources(scantailor ${sources} ${ui_files}) -------------------------------------------------------------------------------- /src/core/filters/page_layout/OrderByHeightProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_PAGE_LAYOUT_ORDERBYHEIGHTPROVIDER_H_ 5 | #define SCANTAILOR_PAGE_LAYOUT_ORDERBYHEIGHTPROVIDER_H_ 6 | 7 | #include 8 | 9 | #include "PageOrderProvider.h" 10 | #include "Settings.h" 11 | 12 | namespace page_layout { 13 | class OrderByHeightProvider : public PageOrderProvider { 14 | public: 15 | explicit OrderByHeightProvider(std::shared_ptr settings); 16 | 17 | bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const override; 18 | 19 | private: 20 | std::shared_ptr m_settings; 21 | }; 22 | } // namespace page_layout 23 | #endif 24 | -------------------------------------------------------------------------------- /src/core/filters/page_layout/OrderByWidthProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_PAGE_LAYOUT_ORDERBYWIDTHPROVIDER_H_ 5 | #define SCANTAILOR_PAGE_LAYOUT_ORDERBYWIDTHPROVIDER_H_ 6 | 7 | #include 8 | 9 | #include "PageOrderProvider.h" 10 | #include "Settings.h" 11 | 12 | namespace page_layout { 13 | class OrderByWidthProvider : public PageOrderProvider { 14 | public: 15 | explicit OrderByWidthProvider(std::shared_ptr settings); 16 | 17 | bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const override; 18 | 19 | private: 20 | std::shared_ptr m_settings; 21 | }; 22 | } // namespace page_layout 23 | #endif 24 | -------------------------------------------------------------------------------- /src/core/filters/page_split/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOUIC ON) 2 | 3 | set(ui_files 4 | SplitModeDialog.ui 5 | OptionsWidget.ui) 6 | 7 | set(sources 8 | SplitLineObject.h 9 | ImageView.cpp ImageView.h 10 | Thumbnail.cpp Thumbnail.h 11 | Params.cpp Params.h 12 | Dependencies.cpp Dependencies.h 13 | PageLayout.cpp PageLayout.h 14 | PageLayoutEstimator.cpp PageLayoutEstimator.h 15 | VertLineFinder.cpp VertLineFinder.h 16 | Filter.cpp Filter.h 17 | OptionsWidget.cpp OptionsWidget.h 18 | SplitModeDialog.cpp SplitModeDialog.h 19 | Settings.cpp Settings.h 20 | Task.cpp Task.h 21 | CacheDrivenTask.cpp CacheDrivenTask.h 22 | LayoutType.cpp LayoutType.h 23 | UnremoveButton.cpp UnremoveButton.h 24 | OrderBySplitTypeProvider.cpp OrderBySplitTypeProvider.h 25 | PageLayoutAdapter.cpp PageLayoutAdapter.h 26 | Utils.cpp Utils.h) 27 | 28 | add_library(page_split STATIC ${sources} ${ui_files}) 29 | target_link_libraries(page_split PUBLIC core) 30 | 31 | translation_sources(scantailor ${sources} ${ui_files}) -------------------------------------------------------------------------------- /src/core/filters/page_split/LayoutType.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_PAGE_SPLIT_LAYOUTTYPE_H_ 5 | #define SCANTAILOR_PAGE_SPLIT_LAYOUTTYPE_H_ 6 | 7 | #include 8 | 9 | namespace page_split { 10 | enum LayoutType { AUTO_LAYOUT_TYPE, SINGLE_PAGE_UNCUT, PAGE_PLUS_OFFCUT, TWO_PAGES }; 11 | 12 | QString layoutTypeToString(LayoutType type); 13 | 14 | LayoutType layoutTypeFromString(const QString& layoutType); 15 | } // namespace page_split 16 | #endif 17 | -------------------------------------------------------------------------------- /src/core/filters/page_split/OrderBySplitTypeProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_PAGE_SPLIT_ORDERBYSPLITTYPEPROVIDER_H_ 5 | #define SCANTAILOR_PAGE_SPLIT_ORDERBYSPLITTYPEPROVIDER_H_ 6 | 7 | #include 8 | 9 | #include "PageOrderProvider.h" 10 | #include "Settings.h" 11 | 12 | namespace page_split { 13 | class OrderBySplitTypeProvider : public PageOrderProvider { 14 | public: 15 | explicit OrderBySplitTypeProvider(std::shared_ptr settings); 16 | 17 | bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const override; 18 | 19 | private: 20 | std::shared_ptr m_settings; 21 | }; 22 | } // namespace page_split 23 | 24 | #endif // SCANTAILOR_PAGE_SPLIT_ORDERBYSPLITTYPEPROVIDER_H_ 25 | -------------------------------------------------------------------------------- /src/core/filters/page_split/Utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "Utils.h" 5 | 6 | #include 7 | #include 8 | 9 | using namespace page_split; 10 | 11 | Settings::UpdateAction Utils::buildDefaultUpdateAction() { 12 | const DefaultParams& defaultParams = DefaultParamsProvider::getInstance().getParams(); 13 | const DefaultParams::PageSplitParams& pageSplitParams = defaultParams.getPageSplitParams(); 14 | 15 | Settings::UpdateAction update; 16 | update.setLayoutType(pageSplitParams.getLayoutType()); 17 | 18 | return update; 19 | } 20 | -------------------------------------------------------------------------------- /src/core/filters/page_split/Utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_PAGE_SPLIT_UTILS_H_ 5 | #define SCANTAILOR_PAGE_SPLIT_UTILS_H_ 6 | 7 | #include "Settings.h" 8 | 9 | namespace page_split { 10 | class Utils { 11 | public: 12 | Utils() = delete; 13 | 14 | static Settings::UpdateAction buildDefaultUpdateAction(); 15 | }; 16 | } // namespace page_split 17 | 18 | #endif // SCANTAILOR_PAGE_SPLIT_UTILS_H_ 19 | -------------------------------------------------------------------------------- /src/core/filters/select_content/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_AUTOUIC ON) 2 | 3 | set(ui_files 4 | ApplyDialog.ui 5 | OptionsWidget.ui) 6 | 7 | set(sources 8 | ImageView.cpp ImageView.h 9 | Filter.cpp Filter.h 10 | OptionsWidget.cpp OptionsWidget.h 11 | ApplyDialog.cpp ApplyDialog.h 12 | ContentBoxFinder.cpp ContentBoxFinder.h 13 | PageFinder.cpp PageFinder.h 14 | Task.cpp Task.h 15 | CacheDrivenTask.cpp CacheDrivenTask.h 16 | Dependencies.cpp Dependencies.h 17 | Params.cpp Params.h 18 | Settings.cpp Settings.h 19 | Thumbnail.cpp Thumbnail.h 20 | PhysSizeCalc.cpp PhysSizeCalc.h 21 | OrderByWidthProvider.cpp OrderByWidthProvider.h 22 | OrderByHeightProvider.cpp OrderByHeightProvider.h 23 | Utils.cpp Utils.h) 24 | 25 | add_library(select_content STATIC ${sources} ${ui_files}) 26 | target_link_libraries(select_content PUBLIC core) 27 | 28 | translation_sources(scantailor ${sources} ${ui_files}) 29 | -------------------------------------------------------------------------------- /src/core/filters/select_content/OrderByHeightProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_SELECT_CONTENT_ORDERBYHEIGHTPROVIDER_H_ 5 | #define SCANTAILOR_SELECT_CONTENT_ORDERBYHEIGHTPROVIDER_H_ 6 | 7 | #include 8 | 9 | #include "PageOrderProvider.h" 10 | #include "Settings.h" 11 | 12 | namespace select_content { 13 | class OrderByHeightProvider : public PageOrderProvider { 14 | public: 15 | explicit OrderByHeightProvider(std::shared_ptr settings); 16 | 17 | bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const override; 18 | 19 | private: 20 | std::shared_ptr m_settings; 21 | }; 22 | } // namespace select_content 23 | #endif 24 | -------------------------------------------------------------------------------- /src/core/filters/select_content/OrderByWidthProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_SELECT_CONTENT_ORDERBYWIDTHPROVIDER_H_ 5 | #define SCANTAILOR_SELECT_CONTENT_ORDERBYWIDTHPROVIDER_H_ 6 | 7 | #include 8 | 9 | #include "PageOrderProvider.h" 10 | #include "Settings.h" 11 | 12 | namespace select_content { 13 | class OrderByWidthProvider : public PageOrderProvider { 14 | public: 15 | explicit OrderByWidthProvider(std::shared_ptr settings); 16 | 17 | bool precedes(const PageId& lhsPage, bool lhsIncomplete, const PageId& rhsPage, bool rhsIncomplete) const override; 18 | 19 | private: 20 | std::shared_ptr m_settings; 21 | }; 22 | } // namespace select_content 23 | #endif 24 | -------------------------------------------------------------------------------- /src/core/filters/select_content/PhysSizeCalc.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PhysSizeCalc.h" 5 | 6 | #include 7 | 8 | #include "ImageTransformation.h" 9 | 10 | namespace select_content { 11 | PhysSizeCalc::PhysSizeCalc() = default; 12 | 13 | PhysSizeCalc::PhysSizeCalc(const ImageTransformation& xform) 14 | : m_virtToPhys(xform.transformBack() * UnitsConverter(xform.origDpi()).transform(PIXELS, MILLIMETRES)) {} 15 | 16 | QSizeF PhysSizeCalc::sizeMM(const QRectF& rectPx) const { 17 | const QPolygonF polyMm(m_virtToPhys.map(rectPx)); 18 | const QSizeF sizeMm(QLineF(polyMm[0], polyMm[1]).length(), QLineF(polyMm[1], polyMm[2]).length()); 19 | return sizeMm; 20 | } 21 | } // namespace select_content 22 | -------------------------------------------------------------------------------- /src/core/filters/select_content/PhysSizeCalc.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_SELECT_CONTENT_PHYSSIZECALC_H_ 5 | #define SCANTAILOR_SELECT_CONTENT_PHYSSIZECALC_H_ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | class ImageTransformation; 12 | 13 | namespace select_content { 14 | class PhysSizeCalc { 15 | // Member-wise copying is OK. 16 | public: 17 | PhysSizeCalc(); 18 | 19 | explicit PhysSizeCalc(const ImageTransformation& xform); 20 | 21 | QSizeF sizeMM(const QRectF& rectPx) const; 22 | 23 | private: 24 | QTransform m_virtToPhys; 25 | }; 26 | } // namespace select_content 27 | #endif 28 | -------------------------------------------------------------------------------- /src/core/filters/select_content/Utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_SELECT_CONTENT_UTILS_H_ 5 | #define SCANTAILOR_SELECT_CONTENT_UTILS_H_ 6 | 7 | class Dpi; 8 | 9 | namespace select_content { 10 | class Params; 11 | 12 | class Utils { 13 | public: 14 | Utils() = delete; 15 | 16 | static Params buildDefaultParams(const Dpi& dpi); 17 | }; 18 | } // namespace select_content 19 | 20 | #endif // SCANTAILOR_SELECT_CONTENT_UTILS_H_ 21 | -------------------------------------------------------------------------------- /src/core/interaction/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(sources 2 | DraggableObject.h 3 | DraggablePoint.cpp DraggablePoint.h 4 | DraggableLineSegment.cpp DraggableLineSegment.h 5 | ObjectDragHandler.cpp ObjectDragHandler.h 6 | InteractionHandler.cpp InteractionHandler.h 7 | InteractionState.cpp InteractionState.h 8 | DragHandler.cpp DragHandler.h 9 | DragWatcher.cpp DragWatcher.h 10 | ZoomHandler.cpp ZoomHandler.h 11 | InteractiveXSpline.cpp InteractiveXSpline.h 12 | DraggablePolygon.cpp DraggablePolygon.h) 13 | 14 | add_library(interaction STATIC ${sources}) 15 | target_link_libraries(interaction PUBLIC core) 16 | target_include_directories(interaction PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") 17 | 18 | translation_sources(scantailor ${sources}) -------------------------------------------------------------------------------- /src/core/interaction/DraggableLineSegment.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "DraggableLineSegment.h" 5 | 6 | #include 7 | 8 | DraggableLineSegment::DraggableLineSegment() : m_proximityPriority(0) {} 9 | 10 | int DraggableLineSegment::proximityPriority() const { 11 | return m_proximityPriority; 12 | } 13 | 14 | Proximity DraggableLineSegment::proximity(const QPointF& mousePos) { 15 | return Proximity::pointAndLineSegment(mousePos, lineSegmentPosition()); 16 | } 17 | 18 | void DraggableLineSegment::dragInitiated(const QPointF& mousePos) { 19 | m_initialMousePos = mousePos; 20 | m_initialLinePos = lineSegmentPosition(); 21 | } 22 | 23 | void DraggableLineSegment::dragContinuation(const QPointF& mousePos, Qt::KeyboardModifiers mask) { 24 | lineSegmentMoveRequest(m_initialLinePos.translated(mousePos - m_initialMousePos), mask); 25 | } 26 | -------------------------------------------------------------------------------- /src/core/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(sources 2 | main.cpp 3 | TestContentSpanFinder.cpp 4 | TestSmartFilenameOrdering.cpp) 5 | 6 | add_executable(core_tests ${sources}) 7 | target_link_libraries( 8 | core_tests 9 | PRIVATE core Boost::unit_test_framework 10 | Boost::prg_exec_monitor ${EXTRA_LIBS}) 11 | 12 | add_test(NAME core_tests COMMAND core_tests --log_level=message) -------------------------------------------------------------------------------- /src/core/tests/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include 6 | #endif 7 | 8 | #define BOOST_AUTO_TEST_MAIN 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /src/core/zones/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(sources 2 | SplineVertex.cpp SplineVertex.h 3 | SplineSegment.cpp SplineSegment.h 4 | EditableSpline.cpp EditableSpline.h 5 | SerializableSpline.cpp SerializableSpline.h 6 | Zone.cpp Zone.h 7 | ZoneSet.cpp ZoneSet.h 8 | EditableZoneSet.cpp EditableZoneSet.h 9 | BasicSplineVisualizer.cpp BasicSplineVisualizer.h 10 | ZoneInteractionContext.cpp ZoneInteractionContext.h 11 | ZoneDefaultInteraction.cpp ZoneDefaultInteraction.h 12 | ZoneCreationInteraction.cpp ZoneCreationInteraction.h 13 | ZoneVertexDragInteraction.cpp ZoneVertexDragInteraction.h 14 | ZoneContextMenuInteraction.cpp ZoneContextMenuInteraction.h 15 | ZoneContextMenuItem.h 16 | ZoneDragInteraction.cpp ZoneDragInteraction.h 17 | ZoneCreationMode.h) 18 | 19 | add_library(zones STATIC ${sources}) 20 | target_link_libraries(zones PUBLIC interaction) 21 | target_include_directories(zones PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") 22 | 23 | translation_sources(scantailor ${sources}) -------------------------------------------------------------------------------- /src/core/zones/SplineSegment.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "SplineSegment.h" 5 | 6 | #include 7 | 8 | SplineSegment::SplineSegment(const SplineVertex::Ptr& prev, const SplineVertex::Ptr& next) : prev(prev), next(next) {} 9 | 10 | SplineVertex::Ptr SplineSegment::splitAt(const QPointF& pt) { 11 | assert(isValid()); 12 | return prev->insertAfter(pt); 13 | } 14 | 15 | bool SplineSegment::isValid() const { 16 | return prev && next && prev->next(SplineVertex::LOOP_IF_BRIDGED) == next; 17 | } 18 | -------------------------------------------------------------------------------- /src/core/zones/SplineSegment.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_ZONES_SPLINESEGMENT_H_ 5 | #define SCANTAILOR_ZONES_SPLINESEGMENT_H_ 6 | 7 | #include 8 | #include 9 | 10 | #include "SplineVertex.h" 11 | 12 | class SplineSegment { 13 | public: 14 | SplineVertex::Ptr prev; 15 | SplineVertex::Ptr next; 16 | 17 | SplineSegment() = default; 18 | 19 | SplineSegment(const SplineVertex::Ptr& prev, const SplineVertex::Ptr& next); 20 | 21 | SplineVertex::Ptr splitAt(const QPointF& pt); 22 | 23 | bool isValid() const; 24 | 25 | bool operator==(const SplineSegment& other) const { return prev == other.prev && next == other.next; } 26 | 27 | QLineF toLine() const { return QLineF(prev->point(), next->point()); } 28 | }; 29 | 30 | 31 | #endif // ifndef SCANTAILOR_ZONES_SPLINESEGMENT_H_ 32 | -------------------------------------------------------------------------------- /src/core/zones/ZoneCreationMode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_ZONES_ZONECREATIONMODE_H_ 5 | #define SCANTAILOR_ZONES_ZONECREATIONMODE_H_ 6 | 7 | enum class ZoneCreationMode { POLYGONAL, RECTANGULAR, LASSO }; 8 | 9 | #endif // SCANTAILOR_ZONES_ZONECREATIONMODE_H_ 10 | -------------------------------------------------------------------------------- /src/dewarping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(sources 2 | Curve.cpp Curve.h 3 | DistortionModel.cpp DistortionModel.h 4 | DistortionModelBuilder.cpp DistortionModelBuilder.h 5 | DetectVertContentBounds.cpp DetectVertContentBounds.h 6 | TowardsLineTracer.cpp TowardsLineTracer.h 7 | TextLineTracer.cpp TextLineTracer.h 8 | TextLineRefiner.cpp TextLineRefiner.h 9 | TopBottomEdgeTracer.cpp TopBottomEdgeTracer.h 10 | CylindricalSurfaceDewarper.cpp CylindricalSurfaceDewarper.h 11 | DewarpingPointMapper.cpp DewarpingPointMapper.h 12 | RasterDewarper.cpp RasterDewarper.h) 13 | 14 | add_library(dewarping STATIC ${sources}) 15 | target_link_libraries(dewarping PUBLIC imageproc) 16 | target_include_directories(dewarping PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -------------------------------------------------------------------------------- /src/dewarping/RasterDewarper.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_DEWARPING_RASTERDEWARPER_H_ 5 | #define SCANTAILOR_DEWARPING_RASTERDEWARPER_H_ 6 | 7 | class QImage; 8 | class QSize; 9 | class QRectF; 10 | class QColor; 11 | 12 | namespace dewarping { 13 | class CylindricalSurfaceDewarper; 14 | 15 | class RasterDewarper { 16 | public: 17 | static QImage dewarp(const QImage& src, 18 | const QSize& dstSize, 19 | const CylindricalSurfaceDewarper& distortionModel, 20 | const QRectF& modelDomain, 21 | const QColor& backgroundColor); 22 | }; 23 | } // namespace dewarping 24 | #endif 25 | -------------------------------------------------------------------------------- /src/foundation/Constants.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "Constants.h" 5 | 6 | namespace constants { 7 | const double SQRT_2 = 1.4142135623730950488016887242097; 8 | 9 | const double PI = 3.141592653589793238462643383279502884; 10 | 11 | const double DEG2RAD = PI / 180.0; 12 | 13 | const double RAD2DEG = 180.0 / PI; 14 | 15 | const double INCH2MM = 25.4; 16 | 17 | const double MM2INCH = 1.0 / INCH2MM; 18 | 19 | const double DPM2DPI = 0.0254; 20 | 21 | const double DPI2DPM = 1.0 / DPM2DPI; 22 | } // namespace constants 23 | -------------------------------------------------------------------------------- /src/foundation/Constants.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_CONSTANTS_H_ 5 | #define SCANTAILOR_FOUNDATION_CONSTANTS_H_ 6 | 7 | namespace constants { 8 | extern const double PI; 9 | 10 | extern const double SQRT_2; 11 | 12 | /** 13 | * angle_rad = angle_deg * RED2RAD 14 | */ 15 | extern const double DEG2RAD; 16 | 17 | /** 18 | * angle_deg = angle_rad * RAD2DEG 19 | */ 20 | extern const double RAD2DEG; 21 | 22 | /** 23 | * mm = inch * INCH2MM 24 | */ 25 | extern const double INCH2MM; 26 | 27 | /** 28 | * inch = mm * MM2INCH 29 | */ 30 | extern const double MM2INCH; 31 | 32 | /** 33 | * dots_per_meter = dots_per_inch * DPI2DPM 34 | */ 35 | extern const double DPI2DPM; 36 | 37 | /** 38 | * dots_per_inch = dots_per_meter * DPM2DPI 39 | */ 40 | extern const double DPM2DPI; 41 | } // namespace constants 42 | #endif 43 | -------------------------------------------------------------------------------- /src/foundation/GridLineTraverser.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_GRIDLINETRAVERSER_H_ 5 | #define SCANTAILOR_FOUNDATION_GRIDLINETRAVERSER_H_ 6 | 7 | #include 8 | 9 | /** 10 | * \brief Traverses a grid along a line segment. 11 | * 12 | * Think about drawing a line on an image. 13 | */ 14 | class GridLineTraverser { 15 | // Member-wise copying is OK. 16 | public: 17 | explicit GridLineTraverser(const QLineF& line); 18 | 19 | bool hasNext() const { return m_stopsDone < m_totalStops; } 20 | 21 | QPoint next(); 22 | 23 | private: 24 | QLineF m_line; 25 | double m_dt; 26 | int m_totalStops; 27 | int m_stopsDone; 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/foundation/Hashes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_HASHES_H_ 5 | #define SCANTAILOR_FOUNDATION_HASHES_H_ 6 | 7 | #include 8 | 9 | namespace hashes { 10 | template 11 | struct hash; 12 | 13 | template <> 14 | struct hash { 15 | std::size_t operator()(const QString& str) const noexcept { 16 | const QChar* data = str.constData(); 17 | std::size_t hash = 5381; 18 | for (int i = 0; i < str.size(); ++i) { 19 | hash = ((hash << 5) + hash) ^ ((data[i].row() << 8) | data[i].cell()); 20 | } 21 | return hash; 22 | } 23 | }; 24 | } // namespace hashes 25 | 26 | #endif // SCANTAILOR_FOUNDATION_HASHES_H_ 27 | -------------------------------------------------------------------------------- /src/foundation/LineIntersectionScalar.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_LINEINTERSECTIONSCALAR_H_ 5 | #define SCANTAILOR_FOUNDATION_LINEINTERSECTIONSCALAR_H_ 6 | 7 | #include 8 | 9 | /** 10 | * Finds such scalars s1 and s2, so that "line1.pointAt(s1)" and "line2.pointAt(s2)" 11 | * would be the intersection point between line1 and line2. Returns false if the 12 | * lines are parallel or if any of the lines have zero length and therefore no direction. 13 | */ 14 | bool lineIntersectionScalar(const QLineF& line1, const QLineF& line2, double& s1, double& s2); 15 | 16 | /** 17 | * Same as the one above, but doesn't bother to calculate s2. 18 | */ 19 | bool lineIntersectionScalar(const QLineF& line1, const QLineF& line2, double& s1); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/foundation/NonCopyable.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_NONCOPYABLE_H_ 5 | #define SCANTAILOR_FOUNDATION_NONCOPYABLE_H_ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include 9 | #endif 10 | 11 | #define DECLARE_NON_COPYABLE(Class) \ 12 | public: \ 13 | /** \brief Copying is forbidden. */ \ 14 | Class(const Class&) = delete; \ 15 | /** \brief Copying is forbidden. */ \ 16 | Class& operator=(const Class&) = delete; \ 17 | /** \brief Moving is forbidden. */ \ 18 | Class(Class&&) noexcept = delete; \ 19 | /** \brief Moving is forbidden. */ \ 20 | Class& operator=(Class&&) noexcept = delete; \ 21 | \ 22 | private: 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/foundation/PerformanceTimer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PerformanceTimer.h" 5 | 6 | #include 7 | 8 | void PerformanceTimer::print(const char* prefix) { 9 | const clock_t now = clock(); 10 | const double sec = double(now - m_start) / CLOCKS_PER_SEC; 11 | if (sec > 10.0) { 12 | qDebug() << prefix << (long) sec << " sec"; 13 | } else if (sec > 0.01) { 14 | qDebug() << prefix << (long) (sec * 1000) << " msec"; 15 | } else { 16 | qDebug() << prefix << (long) (sec * 1000000) << " usec"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/foundation/PerformanceTimer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_PERFORMANCETIMER_H_ 5 | #define SCANTAILOR_FOUNDATION_PERFORMANCETIMER_H_ 6 | 7 | #include 8 | 9 | class PerformanceTimer { 10 | public: 11 | PerformanceTimer() : m_start(clock()) {} 12 | 13 | void print(const char* prefix = ""); 14 | 15 | private: 16 | const clock_t m_start; 17 | }; 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/foundation/Property.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_PROPERTY_H_ 5 | #define SCANTAILOR_FOUNDATION_PROPERTY_H_ 6 | 7 | #include 8 | 9 | class QDomDocument; 10 | class QDomElement; 11 | class QString; 12 | 13 | class Property { 14 | public: 15 | virtual ~Property() = default; 16 | 17 | virtual std::shared_ptr clone() const = 0; 18 | 19 | virtual QDomElement toXml(QDomDocument& doc, const QString& name) const = 0; 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/foundation/PropertyFactory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "PropertyFactory.h" 5 | 6 | #include 7 | 8 | void PropertyFactory::registerProperty(const QString& property, PropertyConstructor constructor) { 9 | m_registry[property] = constructor; 10 | } 11 | 12 | std::shared_ptr PropertyFactory::construct(const QDomElement& el) const { 13 | auto it(m_registry.find(el.attribute("type"))); 14 | if (it != m_registry.end()) { 15 | return (*it->second)(el); 16 | } else { 17 | return nullptr; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/foundation/PropertyFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_PROPERTYFACTORY_H_ 5 | #define SCANTAILOR_FOUNDATION_PROPERTYFACTORY_H_ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "Hashes.h" 12 | #include "Property.h" 13 | 14 | class QDomElement; 15 | 16 | class PropertyFactory { 17 | // Member-wise copying is OK. 18 | public: 19 | virtual ~PropertyFactory() = default; 20 | 21 | using PropertyConstructor = std::shared_ptr (*)(const QDomElement& el); 22 | 23 | void registerProperty(const QString& property, PropertyConstructor constructor); 24 | 25 | std::shared_ptr construct(const QDomElement& el) const; 26 | 27 | private: 28 | using Registry = std::unordered_map>; 29 | Registry m_registry; 30 | }; 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/foundation/ScopedIncDec.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_SCOPEDINCDEC_H_ 5 | #define SCANTAILOR_FOUNDATION_SCOPEDINCDEC_H_ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include 9 | #endif 10 | 11 | template 12 | class ScopedIncDec { 13 | public: 14 | explicit ScopedIncDec(T& counter) : m_counter(counter) { ++counter; } 15 | 16 | ~ScopedIncDec() { --m_counter; } 17 | 18 | private: 19 | T& m_counter; 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/foundation/TaskStatus.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_TASKSTATUS_H_ 5 | #define SCANTAILOR_FOUNDATION_TASKSTATUS_H_ 6 | 7 | class TaskStatus { 8 | public: 9 | virtual ~TaskStatus() = default; 10 | 11 | virtual void cancel() = 0; 12 | 13 | virtual bool isCancelled() const = 0; 14 | 15 | virtual void throwIfCancelled() const = 0; 16 | }; 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/foundation/Utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "Utils.h" 5 | 6 | namespace foundation { 7 | QString Utils::doubleToString(double val) { 8 | return QString::number(val, 'g', 16); 9 | } 10 | } // namespace foundation -------------------------------------------------------------------------------- /src/foundation/Utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_UTILS_H_ 5 | #define SCANTAILOR_FOUNDATION_UTILS_H_ 6 | 7 | #include 8 | 9 | namespace foundation { 10 | class Utils { 11 | public: 12 | /** 13 | * \brief A high precision, locale independent number to string conversion. 14 | * 15 | * This function is intended to be used instead of 16 | * QDomElement::setAttribute(double), which is locale dependent. 17 | */ 18 | static QString doubleToString(double val); 19 | 20 | Utils() = delete; 21 | }; 22 | } // namespace foundation 23 | 24 | 25 | #endif // SCANTAILOR_FOUNDATION_UTILS_H_ 26 | -------------------------------------------------------------------------------- /src/foundation/VirtualFunction.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_FOUNDATION_VIRTUALFUNCTION_H_ 5 | #define SCANTAILOR_FOUNDATION_VIRTUALFUNCTION_H_ 6 | 7 | #include 8 | 9 | template 10 | class VirtualFunction { 11 | public: 12 | virtual ~VirtualFunction() {} 13 | 14 | virtual Res operator()(ArgTypes... args) const = 0; 15 | }; 16 | 17 | 18 | template 19 | class ProxyFunction : public VirtualFunction { 20 | public: 21 | explicit ProxyFunction(Delegate delegate) : m_delegate(delegate) {} 22 | 23 | Res operator()(ArgTypes... args) const override { return m_delegate(args...); } 24 | 25 | private: 26 | Delegate m_delegate; 27 | }; 28 | 29 | 30 | #endif // ifndef SCANTAILOR_FOUNDATION_VIRTUALFUNCTION_H_ 31 | -------------------------------------------------------------------------------- /src/imageproc/BWColor.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_IMAGEPROC_BWCOLOR_H_ 5 | #define SCANTAILOR_IMAGEPROC_BWCOLOR_H_ 6 | 7 | namespace imageproc { 8 | enum BWColor { WHITE = 0, BLACK = 1 }; 9 | 10 | inline BWColor operator!(BWColor c) { 11 | return static_cast(~c & 1); 12 | } 13 | } // namespace imageproc 14 | #endif 15 | -------------------------------------------------------------------------------- /src/imageproc/BadAllocIfNull.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "BadAllocIfNull.h" 5 | 6 | #include 7 | #include 8 | 9 | namespace imageproc { 10 | const QImage& badAllocIfNull(const QImage& image) { 11 | if (image.isNull()) { 12 | throw std::bad_alloc(); 13 | } 14 | return image; 15 | } 16 | } // namespace imageproc 17 | -------------------------------------------------------------------------------- /src/imageproc/ByteOrder.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_IMAGEPROC_BYTEORDER_H_ 5 | #define SCANTAILOR_IMAGEPROC_BYTEORDER_H_ 6 | 7 | #ifdef _WIN32 8 | 9 | #include 10 | 11 | #else 12 | #include 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/imageproc/ColorInterpolation.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "ColorInterpolation.h" 5 | 6 | namespace imageproc { 7 | QColor colorInterpolation(const QColor& from, const QColor& to, double dist) { 8 | dist = qBound(0.0, dist, 1.0); 9 | 10 | qreal r1, g1, b1, a1, r2, g2, b2, a2; 11 | from.getRgbF(&r1, &g1, &b1, &a1); 12 | to.getRgbF(&r2, &g2, &b2, &a2); 13 | 14 | const qreal r = r1 + (r2 - r1) * dist; 15 | const qreal g = g1 + (g2 - g1) * dist; 16 | const qreal b = b1 + (b2 - b1) * dist; 17 | const qreal a = a1 + (a2 - a1) * dist; 18 | return QColor::fromRgbF(r, g, b, a); 19 | } 20 | } // namespace imageproc 21 | -------------------------------------------------------------------------------- /src/imageproc/ColorInterpolation.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_IMAGEPROC_COLORINTERPOLATION_H_ 5 | #define SCANTAILOR_IMAGEPROC_COLORINTERPOLATION_H_ 6 | 7 | #include 8 | 9 | namespace imageproc { 10 | /** 11 | * \brief Returns a color between the provided two. 12 | * 13 | * Returns a color between \p from and \p to according to \p dist. 14 | * \p dist 0 corresponds to \p from, while \p dist 1 corresponds to \p to. 15 | */ 16 | QColor colorInterpolation(const QColor& from, const QColor& to, double dist); 17 | } // namespace imageproc 18 | #endif 19 | -------------------------------------------------------------------------------- /src/imageproc/Connectivity.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_IMAGEPROC_CONNECTIVITY_H_ 5 | #define SCANTAILOR_IMAGEPROC_CONNECTIVITY_H_ 6 | 7 | namespace imageproc { 8 | /** 9 | * \brief Defines which neighbouring pixels are considered to be connected. 10 | */ 11 | enum Connectivity { 12 | /** North, east, south and west neighbours of a pixel 13 | are considered to be connected to it. */ 14 | CONN4, 15 | 16 | /** All 8 neighbours are considered to be connected. */ 17 | CONN8 18 | }; 19 | } // namespace imageproc 20 | #endif 21 | -------------------------------------------------------------------------------- /src/imageproc/Dpm.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "Dpm.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include "Dpi.h" 11 | 12 | Dpm::Dpm(const QSize size) : m_xDpm(size.width()), m_yDpm(size.height()) {} 13 | 14 | Dpm::Dpm(const Dpi dpi) 15 | : m_xDpm(qRound(dpi.horizontal() * constants::DPI2DPM)), m_yDpm(qRound(dpi.vertical() * constants::DPI2DPM)) {} 16 | 17 | Dpm::Dpm(const QImage& image) : m_xDpm(image.dotsPerMeterX()), m_yDpm(image.dotsPerMeterY()) {} 18 | 19 | bool Dpm::isNull() const { 20 | return Dpi(*this).isNull(); 21 | } 22 | 23 | QSize Dpm::toSize() const { 24 | if (isNull()) { 25 | return QSize(); 26 | } else { 27 | return QSize(m_xDpm, m_yDpm); 28 | } 29 | } 30 | 31 | bool Dpm::operator==(const Dpm& other) const { 32 | return m_xDpm == other.m_xDpm && m_yDpm == other.m_yDpm; 33 | } 34 | -------------------------------------------------------------------------------- /src/imageproc/ImageCombination.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_IMAGEPROC_IMAGECOMBINATION_H_ 5 | #define SCANTAILOR_IMAGEPROC_IMAGECOMBINATION_H_ 6 | 7 | #include "BWColor.h" 8 | 9 | class QImage; 10 | 11 | namespace imageproc { 12 | class BinaryImage; 13 | 14 | void combineImages(QImage& mixedImage, const BinaryImage& foreground); 15 | 16 | void combineImages(QImage& mixedImage, const BinaryImage& foreground, const BinaryImage& mask); 17 | 18 | void combineImages(QImage& mixedImage, const QImage& foreground); 19 | 20 | void combineImages(QImage& mixedImage, const QImage& foreground, const BinaryImage& mask); 21 | 22 | void applyMask(QImage& image, const BinaryImage& bwMask, BWColor fillingColor = WHITE); 23 | } // namespace imageproc 24 | 25 | 26 | #endif // SCANTAILOR_IMAGEPROC_IMAGECOMBINATION_H_ 27 | -------------------------------------------------------------------------------- /src/imageproc/MorphGradientDetect.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "MorphGradientDetect.h" 5 | 6 | #include "GrayRasterOp.h" 7 | #include "Grayscale.h" 8 | #include "Morphology.h" 9 | 10 | namespace imageproc { 11 | GrayImage morphGradientDetectDarkSide(const GrayImage& image, const QSize& area) { 12 | GrayImage lighter(erodeGray(image, area, 0x00)); 13 | grayRasterOp>(lighter, image); 14 | return lighter; 15 | } 16 | 17 | GrayImage morphGradientDetectLightSide(const GrayImage& image, const QSize& area) { 18 | GrayImage darker(dilateGray(image, area, 0xff)); 19 | grayRasterOp>(darker, image); 20 | return darker; 21 | } 22 | } // namespace imageproc 23 | -------------------------------------------------------------------------------- /src/imageproc/Scale.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_IMAGEPROC_SCALE_H_ 5 | #define SCANTAILOR_IMAGEPROC_SCALE_H_ 6 | 7 | class QSize; 8 | 9 | namespace imageproc { 10 | class GrayImage; 11 | 12 | /** 13 | * \brief Converts an image to grayscale and scales it to dstSize. 14 | * 15 | * \param src The source image. 16 | * \param dstSize The size to scale the image to. 17 | * \return The scaled image. 18 | * 19 | * This function is a faster replacement for QImage::scaled(), when 20 | * dealing with grayscale images. 21 | */ 22 | GrayImage scaleToGray(const GrayImage& src, const QSize& dstSize); 23 | } // namespace imageproc 24 | #endif 25 | -------------------------------------------------------------------------------- /src/imageproc/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(sources 2 | main.cpp 3 | TestBinaryImage.cpp TestReduceThreshold.cpp 4 | TestSlicedHistogram.cpp 5 | TestConnCompEraser.cpp TestConnCompEraserExt.cpp 6 | TestGrayscale.cpp 7 | TestRasterOp.cpp TestShear.cpp 8 | TestOrthogonalRotation.cpp 9 | TestSkewFinder.cpp 10 | TestScale.cpp 11 | TestTransform.cpp 12 | TestMorphology.cpp 13 | TestBinarize.cpp 14 | TestPolygonRasterizer.cpp 15 | TestSeedFill.cpp 16 | TestSEDM.cpp 17 | TestRastLineFinder.cpp 18 | Utils.cpp Utils.h) 19 | 20 | remove_definitions(-DBUILDING_IMAGEPROC) 21 | add_executable(imageproc_tests ${sources}) 22 | target_link_libraries( 23 | imageproc_tests 24 | PRIVATE imageproc math foundation Qt5::Widgets Qt5::Xml 25 | Boost::unit_test_framework Boost::prg_exec_monitor ${EXTRA_LIBS}) 26 | 27 | add_test(NAME imageproc_tests COMMAND imageproc_tests --log_level=message) -------------------------------------------------------------------------------- /src/imageproc/tests/TestBinarize.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "Utils.h" 12 | 13 | namespace imageproc { 14 | namespace tests { 15 | using namespace utils; 16 | 17 | BOOST_AUTO_TEST_SUITE(BinarizeTestSuite) 18 | #if 0 19 | BOOST_AUTO_TEST_CASE(test) { 20 | QImage img("test.png"); 21 | binarizeWolf(img).toQImage().save("out.png"); 22 | } 23 | #endif 24 | BOOST_AUTO_TEST_SUITE_END() 25 | } // namespace tests 26 | } // namespace imageproc 27 | -------------------------------------------------------------------------------- /src/imageproc/tests/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include 6 | #endif 7 | 8 | #define BOOST_AUTO_TEST_MAIN 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /src/math/LineBoundedByRect.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_MATH_LINEBOUNDEDBYRECT_H_ 5 | #define SCANTAILOR_MATH_LINEBOUNDEDBYRECT_H_ 6 | 7 | #include 8 | #include 9 | 10 | /** 11 | * If \p line (not line segment!) intersects with \p rect, 12 | * writes intersection points as the new \p line endpoints 13 | * and returns true. Otherwise returns false and leaves 14 | * \p line unmodified. 15 | */ 16 | bool lineBoundedByRect(QLineF& line, const QRectF& rect); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/math/LinearSolver.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "LinearSolver.h" 5 | 6 | LinearSolver::LinearSolver(size_t rows_AB, size_t cols_A_rows_X, size_t cols_BX) 7 | : m_rowsAB(rows_AB), m_colsArowsX(cols_A_rows_X), m_colsBX(cols_BX) { 8 | if (m_rowsAB < m_colsArowsX) { 9 | throw std::runtime_error("LinearSolver: can's solve underdetermined systems"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/math/SidesOfLine.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "SidesOfLine.h" 5 | 6 | qreal sidesOfLine(const QLineF& line, const QPointF& p1, const QPointF& p2) { 7 | const QPointF normal(line.normalVector().p2() - line.p1()); 8 | const QPointF vec1(p1 - line.p1()); 9 | const QPointF vec2(p2 - line.p1()); 10 | const qreal dot1 = normal.x() * vec1.x() + normal.y() * vec1.y(); 11 | const qreal dot2 = normal.x() * vec2.x() + normal.y() * vec2.y(); 12 | return dot1 * dot2; 13 | } 14 | -------------------------------------------------------------------------------- /src/math/SidesOfLine.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_MATH_SIDESOFLINE_H_ 5 | #define SCANTAILOR_MATH_SIDESOFLINE_H_ 6 | 7 | #include 8 | #include 9 | 10 | /** 11 | * This function allows you to check if a pair of points is on the same 12 | * or different sides of a line. 13 | * 14 | * Returns: 15 | * \li Negative value, if points are on different sides of line. 16 | * \li Positive value, if points are on the same side of line. 17 | * \li Zero, if one or both of the points are on the line. 18 | * 19 | * \note Line's endpoints don't matter - consider the whole line, 20 | * not a line segment. If the line is really a point, zero will 21 | * always be returned. 22 | */ 23 | qreal sidesOfLine(const QLineF& line, const QPointF& p1, const QPointF& p2); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/math/adiff/SparseMap.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "SparseMap.h" 5 | 6 | namespace adiff { 7 | const size_t SparseMap<2>::ZERO_ELEMENT = ~size_t(0); 8 | 9 | SparseMap<2>::SparseMap(size_t numVars) 10 | : m_numVars(numVars), m_numNonZeroElements(0), m_map(numVars, numVars, ZERO_ELEMENT) {} 11 | 12 | void SparseMap<2>::markNonZero(size_t i, size_t j) { 13 | size_t& el = m_map(i, j); 14 | if (el == ZERO_ELEMENT) { 15 | el = m_numNonZeroElements; 16 | ++m_numNonZeroElements; 17 | } 18 | } 19 | 20 | void SparseMap<2>::markAllNonZero() { 21 | for (size_t i = 0; i < m_numVars; ++i) { 22 | for (size_t j = 0; j < m_numVars; ++j) { 23 | markNonZero(i, j); 24 | } 25 | } 26 | } 27 | 28 | size_t SparseMap<2>::nonZeroElementIdx(size_t i, size_t j) const { 29 | return m_map(i, j); 30 | } 31 | } // namespace adiff -------------------------------------------------------------------------------- /src/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 -------------------------------------------------------------------------------- /src/math/spfit/FrenetFrame.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "FrenetFrame.h" 5 | 6 | #include 7 | 8 | namespace spfit { 9 | FrenetFrame::FrenetFrame(const Vec2d& origin, const Vec2d& tangentVector, YAxisDirection ydir) : m_origin(origin) { 10 | const double sqlen = tangentVector.squaredNorm(); 11 | if (sqlen > 1e-6) { 12 | m_unitTangent = tangentVector / std::sqrt(sqlen); 13 | if (ydir == Y_POINTS_UP) { 14 | m_unitNormal[0] = -m_unitTangent[1]; 15 | m_unitNormal[1] = m_unitTangent[0]; 16 | } else { 17 | m_unitNormal[0] = m_unitTangent[1]; 18 | m_unitNormal[1] = -m_unitTangent[0]; 19 | } 20 | } 21 | } 22 | } // namespace spfit 23 | -------------------------------------------------------------------------------- /src/math/spfit/ModelShape.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifndef SCANTAILOR_SPFIT_MODELSHAPE_H_ 5 | #define SCANTAILOR_SPFIT_MODELSHAPE_H_ 6 | 7 | #include 8 | 9 | #include "FittableSpline.h" 10 | #include "SqDistApproximant.h" 11 | 12 | namespace spfit { 13 | /** 14 | * \brief A shape we are trying to fit a spline to. 15 | * 16 | * Could be a polyline or maybe a point cloud. 17 | */ 18 | class ModelShape { 19 | public: 20 | virtual ~ModelShape() = default; 21 | 22 | /** 23 | * Returns a function that approximates the squared distance to the model. 24 | * The function is only accurate in the neighbourhood of \p pt. 25 | */ 26 | virtual SqDistApproximant localSqDistApproximant(const QPointF& pt, FittableSpline::SampleFlags flags) const = 0; 27 | }; 28 | } // namespace spfit 29 | #endif 30 | -------------------------------------------------------------------------------- /src/math/spfit/OptimizationResult.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "OptimizationResult.h" 5 | 6 | #include 7 | 8 | namespace spfit { 9 | OptimizationResult::OptimizationResult(double forceBefore, double forceAfter) 10 | : m_forceBefore(std::max(forceBefore, 0)), m_forceAfter(std::max(forceAfter, 0)) { 11 | // In theory, these distances can't be negative, but in practice they can. 12 | // We are going to treat negative ones as they are zeros. 13 | } 14 | 15 | double OptimizationResult::improvementPercentage() const { 16 | double improvement = m_forceBefore - m_forceAfter; 17 | improvement /= (m_forceBefore + std::numeric_limits::epsilon()); 18 | return improvement * 100; // Convert to percents. 19 | } 20 | } // namespace spfit 21 | -------------------------------------------------------------------------------- /src/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 -------------------------------------------------------------------------------- /src/math/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(sources 2 | main.cpp 3 | TestHessians.cpp 4 | TestSqDistApproximant.cpp 5 | TestMatrixCalc.cpp) 6 | 7 | add_executable(math_tests ${sources}) 8 | target_link_libraries( 9 | math_tests 10 | PRIVATE math Boost::unit_test_framework 11 | Boost::prg_exec_monitor ${EXTRA_LIBS}) 12 | 13 | add_test(NAME math_tests COMMAND math_tests --log_level=message) -------------------------------------------------------------------------------- /src/math/tests/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include 6 | #endif 7 | 8 | #define BOOST_AUTO_TEST_MAIN 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/branch_closed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/branch_end.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/branch_more.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/branch_open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/checkbox_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/checkbox_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/checkbox_checked_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/checkbox_indeterminate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/checkbox_indeterminate_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/checkbox_indeterminate_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/down_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/down_arrow_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/radiobutton_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/radiobutton_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/radiobutton_checked_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/scroll_bar_down_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/scroll_bar_left_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/scroll_bar_right_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/scroll_bar_up_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/slider_handle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/up_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/up_arrow_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/vline.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/window_close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/window_close_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/window_restore.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/dark_scheme/icons/window_restore_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/font-icons.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/ascending_sorting_order.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/big-down-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/big-left-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/big-right-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/big-up-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/checkbox-styled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/resources/icons/collapse.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/descending_sorting_order.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/diminishing-glass.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/resources/icons/expand.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/file.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/insert-after.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/resources/icons/insert-before.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/resources/icons/insert-here.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/layout_type_auto.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/resources/icons/left_page_thumb.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/resources/icons/minus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/resources/icons/multi-column-view.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/object-rotate-left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/object-rotate-right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/play-hovered.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/resources/icons/play-pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/play.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/resources/icons/polygonal-zone-mode.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/rectangular-zone-mode.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/single-column-view.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/single_page_uncut.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/resources/icons/six-spoked-asterisk-disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/resources/icons/six-spoked-asterisk.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/stock-center.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-east.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-north-east.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-north-west.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-north.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-south-east.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-south-west.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-south.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/stock-gravity-west.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/stop-hovered.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/resources/icons/stop-pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/icons/stop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/resources/icons/triangle-down-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/triangle-up-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/icons/undo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/branch_closed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/branch_end.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/branch_more.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/branch_open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/checkbox_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/checkbox_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/checkbox_checked_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/checkbox_indeterminate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/checkbox_indeterminate_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/checkbox_indeterminate_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/down_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/down_arrow_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/radiobutton_checked.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/radiobutton_checked_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/radiobutton_checked_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/scroll_bar_down_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/scroll_bar_left_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/scroll_bar_right_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/scroll_bar_up_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/slider_handle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/up_arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/up_arrow_pressed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/vline.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/window_close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/window_close_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/window_restore.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/light_scheme/icons/window_restore_disabled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/resources/unix/mime/scantailor-project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ScanTailor project file 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/resources/unix/scantailor.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Name=ScanTailor Advanced 4 | Comment=Interactive post-processing tool for scanned pages 5 | Exec=scantailor %f 6 | Icon=ScanTailor 7 | Terminal=false 8 | X-MultipleArgs=false 9 | Type=Application 10 | Categories=Graphics; 11 | MimeType=application/x-scantailor-project; 12 | -------------------------------------------------------------------------------- /src/resources/win32/scantailor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4lex4/scantailor-advanced/3d1e74e6ace413733511086934a66f4e3f7a6027/src/resources/win32/scantailor.ico -------------------------------------------------------------------------------- /version.h.in: -------------------------------------------------------------------------------- 1 | /* This file is a template for version.h, for use with CMake. */ 2 | 3 | #ifndef SCANTAILOR_VERSION_H_ 4 | #define SCANTAILOR_VERSION_H_ 5 | 6 | #define VERSION "1.0.16" 7 | #define VERSION_QUAD "" // Must be "x.x.x.x" or an empty string. 8 | #define PROJECT_VERSION 3 9 | 10 | #endif 11 | --------------------------------------------------------------------------------