├── .github ├── actions │ ├── bin-cache │ │ └── action.yml │ ├── build-solution │ │ └── action.yml │ ├── setup-wix │ │ └── action.yml │ ├── upload-some-artifacts │ │ └── action.yml │ ├── wtl-cache │ │ └── action.yml │ └── wtl-submodule │ │ └── action.yml └── workflows │ ├── build-debug-win32.yml │ ├── build-debug-x64.yml │ ├── build-release-win32.yml │ ├── build-release-with-deps.yml │ ├── build-release-x64.yml │ ├── workflow-build-wtl-cache.yml │ ├── workflow-build-wtl-submodule.yml │ └── workflow-rebuild-all-deps.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.txt ├── COMPILING.txt ├── COPYING.txt ├── HowToInstall.txt ├── HowToInstall_ru.txt ├── LICENSE.txt ├── README.md ├── deps └── README.md ├── extras ├── README.md ├── scripts │ ├── .gitignore │ ├── JPEGView.vcxproj-postbuild-event.bat │ ├── README.md │ ├── build-lcms2.bat │ ├── build-libheif_libavif.bat │ ├── build-libjpegturbo.bat │ ├── build-libjxl.bat │ ├── build-libpng-apng.bat │ ├── build-libraw.bat │ ├── build-libwebp.bat │ ├── jpegview-build-release.bat │ ├── keymap_convert_readme_xp_compat.py │ ├── keymap_generate_symbols_and_readme.py │ ├── sha256sum.py │ ├── strings_txt_builder.py │ ├── strings_txt_sync_all.py │ ├── util_common.py │ └── vs-init.bat ├── sw_repos │ ├── README.md │ └── WinGet-sylikc.JPEGView │ │ ├── README.txt │ │ ├── sylikc.JPEGView.installer.yaml │ │ ├── sylikc.JPEGView.locale.en-US.yaml │ │ └── sylikc.JPEGView.yaml └── third_party │ ├── README.md │ └── libpng-apng.src-patch │ ├── libpng-apng │ ├── README.txt │ └── libpng-1.6.40-apng.patch │ ├── libpng-x64.patch │ └── patch-libpng.sh └── src ├── JPEGView.Setup ├── JPEGView.Setup.wixproj ├── Product.wxs ├── Product_en-us.wxl └── res │ ├── BannerTop.bmp │ ├── Dialog.bmp │ └── License.rtf ├── JPEGView.sln ├── JPEGView ├── AVIFWrapper.cpp ├── AVIFWrapper.h ├── AboutDlg.cpp ├── AboutDlg.h ├── ApplyFilterAVX.cpp ├── ApplyFilterAVX.h ├── BasicProcessing.cpp ├── BasicProcessing.h ├── BatchCopyDlg.cpp ├── BatchCopyDlg.h ├── Clipboard.cpp ├── Clipboard.h ├── Config │ ├── JPEGView.ini │ ├── JPEGView.ini.tpl │ ├── JPEGView_ru.ini │ ├── JPEGView_ru.ini.tpl │ ├── KeyMap-README.html │ ├── KeyMap-README_ru.html │ ├── KeyMap.txt.default │ ├── KeyMap.txt.default_ru │ ├── NavPanel.png │ ├── readme.html │ ├── readme_ru.html │ ├── readme_uk.html │ ├── strings.txt │ ├── strings_be.txt │ ├── strings_bg.txt │ ├── strings_cs.txt │ ├── strings_de.txt │ ├── strings_el.txt │ ├── strings_es-ar.txt │ ├── strings_es.txt │ ├── strings_eu.txt │ ├── strings_fi.txt │ ├── strings_fr.txt │ ├── strings_hu.txt │ ├── strings_it.txt │ ├── strings_ja.txt │ ├── strings_ko.txt │ ├── strings_pl.txt │ ├── strings_pt-br.txt │ ├── strings_pt.txt │ ├── strings_ro.txt │ ├── strings_ru.txt │ ├── strings_sk.txt │ ├── strings_sl.txt │ ├── strings_sr.txt │ ├── strings_sv.txt │ ├── strings_ta.txt │ ├── strings_tr.txt │ ├── strings_uk.txt │ ├── strings_zh-tw.txt │ ├── strings_zh.txt │ └── symbols.km ├── CropCtl.cpp ├── CropCtl.h ├── CropSizeDlg.cpp ├── CropSizeDlg.h ├── DesktopWallpaper.cpp ├── DesktopWallpaper.h ├── DirectoryWatcher.cpp ├── DirectoryWatcher.h ├── EXIFDisplay.cpp ├── EXIFDisplay.h ├── EXIFDisplayCtl.cpp ├── EXIFDisplayCtl.h ├── EXIFHelpers.cpp ├── EXIFHelpers.h ├── EXIFReader.cpp ├── EXIFReader.h ├── FileExtensionsDlg.cpp ├── FileExtensionsDlg.h ├── FileExtensionsRegistry.cpp ├── FileExtensionsRegistry.h ├── FileList.cpp ├── FileList.h ├── FileOpenDialog.cpp ├── FileOpenDialog.h ├── GUIControls.cpp ├── GUIControls.h ├── HEIFWrapper.cpp ├── HEIFWrapper.h ├── HashCompareLPCTSTR.cpp ├── HashCompareLPCTSTR.h ├── HelpDisplay.cpp ├── HelpDisplay.h ├── HelpDisplayCtl.cpp ├── HelpDisplayCtl.h ├── HelpDlg.cpp ├── HelpDlg.h ├── Helpers.cpp ├── Helpers.h ├── HelpersGUI.cpp ├── HelpersGUI.h ├── HistogramCorr.cpp ├── HistogramCorr.h ├── ICCProfileTransform.cpp ├── ICCProfileTransform.h ├── ImageLoadThread.cpp ├── ImageLoadThread.h ├── ImageProcPanelCtl.cpp ├── ImageProcPanelCtl.h ├── ImageProcessingPanel.cpp ├── ImageProcessingPanel.h ├── ImageProcessingTypes.h ├── InfoButtonPanel.cpp ├── InfoButtonPanel.h ├── InfoButtonPanelCtl.cpp ├── InfoButtonPanelCtl.h ├── JPEGImage.cpp ├── JPEGImage.h ├── JPEGLosslessTransform.cpp ├── JPEGLosslessTransform.h ├── JPEGProvider.cpp ├── JPEGProvider.h ├── JPEGView.cpp ├── JPEGView.rc ├── JPEGView.vcxproj ├── JPEGView.vcxproj.filters ├── JPEGView_VS2017.vcxproj ├── JPEGView_VS2017.vcxproj.filters ├── JXLWrapper.cpp ├── JXLWrapper.h ├── KeyMap.cpp ├── KeyMap.h ├── LocalDensityCorr.cpp ├── LocalDensityCorr.h ├── MainDlg.cpp ├── MainDlg.h ├── ManageOpenWithDlg.cpp ├── ManageOpenWithDlg.h ├── MaxImageDef.h ├── MessageDef.h ├── MultiMonitorSupport.cpp ├── MultiMonitorSupport.h ├── NLS.cpp ├── NLS.h ├── NavigationPanel.cpp ├── NavigationPanel.h ├── NavigationPanelCtl.cpp ├── NavigationPanelCtl.h ├── PNGWrapper.cpp ├── PNGWrapper.h ├── PSDWrapper.cpp ├── PSDWrapper.h ├── PaintMemDCMgr.cpp ├── PaintMemDCMgr.h ├── Panel.cpp ├── Panel.h ├── PanelController.cpp ├── PanelController.h ├── PanelMgr.cpp ├── PanelMgr.h ├── ParameterDB.cpp ├── ParameterDB.h ├── PrintDlg.cpp ├── PrintDlg.h ├── PrintImage.cpp ├── PrintImage.h ├── PrintParameters.h ├── ProcessParams.h ├── ProcessingThreadPool.cpp ├── ProcessingThreadPool.h ├── QOIWrapper.cpp ├── QOIWrapper.h ├── RAWWrapper.cpp ├── RAWWrapper.h ├── RawMetadata.h ├── ReaderBMP.cpp ├── ReaderBMP.h ├── ReaderTGA.cpp ├── ReaderTGA.h ├── ResizeDlg.cpp ├── ResizeDlg.h ├── ResizeFilter.cpp ├── ResizeFilter.h ├── RotationPanel.cpp ├── RotationPanel.h ├── RotationPanelCtl.cpp ├── RotationPanelCtl.h ├── SaveImage.cpp ├── SaveImage.h ├── SettingsProvider.cpp ├── SettingsProvider.h ├── TJPEGWrapper.cpp ├── TJPEGWrapper.h ├── TiltCorrectionPanel.cpp ├── TiltCorrectionPanel.h ├── TiltCorrectionPanelCtl.cpp ├── TiltCorrectionPanelCtl.h ├── TimerEventIDs.h ├── Tooltip.cpp ├── TransformPanel.cpp ├── TransformPanel.h ├── TransformPanelCtl.cpp ├── TransformPanelCtl.h ├── UnsharpMaskPanel.cpp ├── UnsharpMaskPanel.h ├── UnsharpMaskPanelCtl.cpp ├── UnsharpMaskPanelCtl.h ├── UserCommand.cpp ├── UserCommand.h ├── WEBPWrapper.cpp ├── WEBPWrapper.h ├── WndButtonPanel.cpp ├── WndButtonPanel.h ├── WndButtonPanelCtl.cpp ├── WndButtonPanelCtl.h ├── WorkThread.cpp ├── WorkThread.h ├── XMMImage.cpp ├── XMMImage.h ├── ZoomNavigator.cpp ├── ZoomNavigator.h ├── ZoomNavigatorCtl.cpp ├── ZoomNavigatorCtl.h ├── dcraw.c-original.txt ├── dcraw_mod.cpp ├── dcraw_mod.h ├── lcms2 │ ├── bin │ │ └── lcms2.dll │ ├── bin64 │ │ └── lcms2.dll │ ├── include │ │ └── lcms2.h │ ├── lib │ │ └── lcms2.lib │ └── lib64 │ │ └── lcms2.lib ├── libavif │ ├── bin │ │ ├── avif.dll │ │ └── dav1d.dll │ ├── bin64 │ │ ├── avif.dll │ │ └── dav1d.dll │ ├── include │ │ └── avif │ │ │ ├── avif.h │ │ │ └── internal.h │ ├── lib │ │ └── avif.lib │ └── lib64 │ │ └── avif.lib ├── libheif │ ├── bin │ │ ├── heif.dll │ │ └── libde265.dll │ ├── bin64 │ │ ├── heif.dll │ │ └── libde265.dll │ ├── include │ │ └── libheif │ │ │ ├── api_structs.h │ │ │ ├── avif.h │ │ │ ├── bitstream.h │ │ │ ├── box.h │ │ │ ├── common_utils.h │ │ │ ├── context.h │ │ │ ├── error.h │ │ │ ├── exif.h │ │ │ ├── file.h │ │ │ ├── heif.h │ │ │ ├── heif_cxx.h │ │ │ ├── heif_emscripten.h │ │ │ ├── heif_plugin.h │ │ │ ├── heif_version.h │ │ │ ├── hevc.h │ │ │ ├── init.h │ │ │ ├── logging.h │ │ │ ├── metadata_compression.h │ │ │ ├── nclx.h │ │ │ ├── pixelimage.h │ │ │ ├── plugin_registry.h │ │ │ ├── plugins_unix.h │ │ │ ├── plugins_windows.h │ │ │ ├── region.h │ │ │ ├── security_limits.h │ │ │ └── uncompressed_image.h │ ├── lib │ │ └── heif.lib │ └── lib64 │ │ └── heif.lib ├── libjpeg-turbo │ ├── README.md │ ├── include │ │ ├── jconfig.h │ │ ├── jerror.h │ │ ├── jmorecfg.h │ │ ├── jpeglib.h │ │ └── turbojpeg.h │ ├── lib │ │ └── turbojpeg-static.lib │ └── lib64 │ │ └── turbojpeg-static.lib ├── libjxl │ ├── bin │ │ ├── brotlicommon.dll │ │ ├── brotlidec.dll │ │ ├── jxl_dec.dll │ │ └── jxl_threads.dll │ ├── bin64 │ │ ├── brotlicommon.dll │ │ ├── brotlidec.dll │ │ ├── jxl_dec.dll │ │ └── jxl_threads.dll │ ├── include │ │ └── jxl │ │ │ ├── cms_interface.h │ │ │ ├── codestream_header.h │ │ │ ├── color_encoding.h │ │ │ ├── decode.h │ │ │ ├── decode_cxx.h │ │ │ ├── encode.h │ │ │ ├── encode_cxx.h │ │ │ ├── jxl_export.h │ │ │ ├── jxl_threads_export.h │ │ │ ├── memory_manager.h │ │ │ ├── parallel_runner.h │ │ │ ├── resizable_parallel_runner.h │ │ │ ├── resizable_parallel_runner_cxx.h │ │ │ ├── stats.h │ │ │ ├── thread_parallel_runner.h │ │ │ ├── thread_parallel_runner_cxx.h │ │ │ ├── types.h │ │ │ └── version.h │ ├── lib │ │ ├── jxl_dec.lib │ │ └── jxl_threads.lib │ └── lib64 │ │ ├── jxl_dec.lib │ │ └── jxl_threads.lib ├── libpng-apng │ ├── include │ │ ├── png.h │ │ ├── pngconf.h │ │ └── pnglibconf.h │ ├── lib │ │ ├── libpng16.lib │ │ └── zlib.lib │ └── lib64 │ │ ├── libpng16.lib │ │ └── zlib.lib ├── libraw │ ├── bin │ │ └── libraw.dll │ ├── bin64 │ │ └── libraw.dll │ ├── include │ │ └── libraw │ │ │ ├── libraw.h │ │ │ ├── libraw_alloc.h │ │ │ ├── libraw_const.h │ │ │ ├── libraw_datastream.h │ │ │ ├── libraw_internal.h │ │ │ ├── libraw_types.h │ │ │ └── libraw_version.h │ ├── lib │ │ └── libraw.lib │ └── lib64 │ │ └── libraw.lib ├── libwebp │ ├── include │ │ └── webp │ │ │ ├── decode.h │ │ │ ├── demux.h │ │ │ ├── encode.h │ │ │ ├── mux.h │ │ │ ├── mux_types.h │ │ │ └── types.h │ ├── lib │ │ ├── libwebp.lib │ │ └── libwebpdemux.lib │ └── lib64 │ │ ├── libwebp.lib │ │ └── libwebpdemux.lib ├── qoi │ └── qoi.h ├── res │ └── JPEGView.ico ├── resource.h ├── stdafx.cpp └── stdafx.h ├── JPEGView_VS2017.sln ├── README.txt └── WICLoader ├── MaxImageDef.h ├── WICLoader.cpp ├── WICLoader.rc ├── WICLoader.vcxproj ├── WICLoader.vcxproj.filters ├── WICLoader_VS2017.vcxproj ├── WICLoader_VS2017.vcxproj.filters ├── dllmain.cpp ├── stdafx.cpp ├── stdafx.h └── targetver.h /.github/actions/setup-wix/action.yml: -------------------------------------------------------------------------------- 1 | name: Action - Setup WiX 2 | description: Action to set up WiX paths for candle.exe and light.exe in build environment 3 | runs: 4 | using: composite 5 | steps: 6 | # https://gist.github.com/hibearpanda/d5b5b58bd319132ffd7af606ffa333fc 7 | # https://github.com/felixrieseberg/electron-wix-msi/issues/1#issuecomment-674598795 8 | # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path 9 | # https://stackoverflow.com/a/64831469 10 | # https://github.community/t/set-path-for-wix-toolset-in-windows-runner/154708 11 | - name: Set WiX paths for candle and light 12 | shell: powershell 13 | env: 14 | WIX_PATH: ${{ env.wix }} 15 | run: | 16 | #echo "$env:WIX_PATH\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append 17 | # https://github.community/t/set-path-for-wix-toolset-in-windows-runner/154708/3 18 | $env:Path += ";C:\Program Files (x86)\WiX Toolset v3.11\bin" 19 | #echo "$env:PATH" 20 | echo "$env:WIX_PATH" 21 | # check that they're found (old way) 22 | #where.exe candle.exe 23 | #where.exe light.exe 24 | # check where they're found, with all information 25 | Get-Command candle.exe | Format-List 26 | Get-Command light.exe | Format-List 27 | -------------------------------------------------------------------------------- /.github/actions/upload-some-artifacts/action.yml: -------------------------------------------------------------------------------- 1 | name: Action - Selectively Upload Artifacts 2 | description: Action to selectively upload artifacts based on branch 3 | 4 | 5 | inputs: 6 | branch-match: 7 | description: branch to match to get all artifacts, or only some 8 | required: false 9 | default: master 10 | 11 | platform-arch: 12 | description: The architecture for naming artifact 13 | required: true 14 | type: string 15 | 16 | build-config: 17 | description: The build config for naming artifact 18 | required: true 19 | type: string 20 | 21 | 22 | 23 | runs: 24 | using: composite 25 | steps: 26 | - name: Clean up WICLoader files 27 | shell: bash 28 | if: inputs.build-config == 'Release' 29 | run: | 30 | cd src/JPEGView/bin 31 | rm */*/WICLoader.exp 32 | rm */*/WICLoader.lib 33 | rm */*/WICLoader.pdb 34 | - name: Upload No-Install Outputs Only 35 | # if not master branch, only upload the extract-and-run artifact 36 | if: github.ref_name != inputs.branch-match 37 | uses: actions/upload-artifact@v3 38 | with: 39 | name: JPEGView-GH_${{ github.repository_owner }}-${{ inputs.build-config }}_${{ inputs.platform-arch }}-${{ env.short_sha }} 40 | path: | 41 | src/JPEGView/bin 42 | 43 | - name: Upload All Outputs 44 | # reduce the ambiguous versions of installers in the wild 45 | # by only including the installer for master branch 46 | if: github.ref_name == inputs.branch-match 47 | uses: actions/upload-artifact@v3 48 | with: 49 | # short_sha comes from the build step 50 | name: JPEGView-GH_${{ github.repository_owner }}-${{ inputs.build-config }}_${{ inputs.platform-arch }}-${{ env.short_sha }} 51 | path: | 52 | src/JPEGView/bin 53 | src/JPEGView.Setup/bin 54 | -------------------------------------------------------------------------------- /.github/actions/wtl-submodule/action.yml: -------------------------------------------------------------------------------- 1 | name: Action - Setup WTL via Submodule 2 | description: Action to set up WTL includes by submodule init 3 | 4 | # WTL is a submodule, so this GH actions specifically clones ONLY that 5 | # This will match the formal release build environment. 6 | # 7 | # While I would like to do a submodule clone with checkout@v3, there's no option 8 | # to check out only ONE submodule. There's a lot of submodules in this project 9 | # which are not directly required for building, and that seems fairly inefficient. 10 | 11 | 12 | runs: 13 | using: composite 14 | steps: 15 | - name: WTL includes submodule init 16 | shell: cmd 17 | # Run git commands directly without using the GH checkout action 18 | run: git submodule update --init deps/WTL-sf 19 | -------------------------------------------------------------------------------- /.github/workflows/build-debug-win32.yml: -------------------------------------------------------------------------------- 1 | name: Build Test Win32 (Debug) 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | call-workflow-build: 7 | uses: ./.github/workflows/workflow-build-wtl-cache.yml 8 | with: 9 | platform-arch: Win32 10 | build-config: Debug 11 | -------------------------------------------------------------------------------- /.github/workflows/build-debug-x64.yml: -------------------------------------------------------------------------------- 1 | name: Build Test x64 (Debug) 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | call-workflow-build: 7 | uses: ./.github/workflows/workflow-build-wtl-cache.yml 8 | with: 9 | platform-arch: x64 10 | build-config: Debug 11 | -------------------------------------------------------------------------------- /.github/workflows/build-release-win32.yml: -------------------------------------------------------------------------------- 1 | name: Build Win32 (Release) 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | call-workflow-build: 7 | uses: ./.github/workflows/workflow-build-wtl-submodule.yml 8 | with: 9 | platform-arch: Win32 10 | build-config: Release 11 | -------------------------------------------------------------------------------- /.github/workflows/build-release-with-deps.yml: -------------------------------------------------------------------------------- 1 | name: Build Win32/x64 with all deps (Release) 2 | 3 | # triggers: 4 | on: 5 | # use push only when debugging this workflow 6 | #push: 7 | # run this action when kicked off manually 8 | workflow_dispatch: 9 | # when a tag or branch created 10 | create: 11 | # published releases get checked 12 | release: 13 | types: [published] 14 | 15 | jobs: 16 | call-workflow-build-win32: 17 | uses: ./.github/workflows/workflow-rebuild-all-deps.yml 18 | with: 19 | platform-arch: Win32 20 | 21 | call-workflow-build-x64: 22 | # make sure these two jobs run sequentially, so that the libs are only built on one and not the other 23 | # https://stackoverflow.com/questions/63148639/create-dependencies-between-jobs-in-github-actions 24 | needs: call-workflow-build-win32 25 | uses: ./.github/workflows/workflow-rebuild-all-deps.yml 26 | with: 27 | platform-arch: x64 28 | -------------------------------------------------------------------------------- /.github/workflows/build-release-x64.yml: -------------------------------------------------------------------------------- 1 | name: Build x64 (Release) 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | call-workflow-build: 7 | uses: ./.github/workflows/workflow-build-wtl-submodule.yml 8 | with: 9 | platform-arch: x64 10 | build-config: Release 11 | -------------------------------------------------------------------------------- /.github/workflows/workflow-build-wtl-cache.yml: -------------------------------------------------------------------------------- 1 | name: Reusable - Build/Upload WTL cached 2 | # TODO later test and lint 3 | # TODO test building library dependencies (the prebuilt stuff) 4 | 5 | 6 | 7 | # GH Action Reusable Workflow -- https://docs.github.com/en/actions/using-workflows/reusing-workflows 8 | on: 9 | workflow_call: 10 | inputs: 11 | platform-arch: 12 | required: true 13 | type: string 14 | build-config: 15 | required: true 16 | type: string 17 | 18 | 19 | # NOTE: This workflow may not be used in the future, but kept around for historical 20 | # reasons (might need to use this cache routine in the future for other libs), 21 | # or in case it is preferred to use this if the other breaks 22 | # 23 | # Currently this is used as the process for Debug releases 24 | 25 | 26 | jobs: 27 | build: 28 | # if windows-latest, might not find VS 2019 29 | runs-on: windows-2019 30 | 31 | steps: 32 | - uses: actions/checkout@v3 33 | 34 | - name: setup-msbuild 35 | # https://github.com/marketplace/actions/setup-msbuild 36 | uses: microsoft/setup-msbuild@v1.1 37 | with: 38 | # Fixed on Visual Studio 2019 -- https://docs.microsoft.com/en-us/visualstudio/releases/2019/history 39 | vs-version: '[16.0,17.0)' 40 | msbuild-architecture: ${{ inputs.platform-arch }} 41 | 42 | - uses: ./.github/actions/setup-wix 43 | 44 | - uses: ./.github/actions/wtl-cache 45 | 46 | - uses: ./.github/actions/build-solution 47 | with: 48 | platform-arch: ${{ inputs.platform-arch }} 49 | build-config: ${{ inputs.build-config }} 50 | 51 | - uses: ./.github/actions/upload-some-artifacts 52 | with: 53 | platform-arch: ${{ inputs.platform-arch }} 54 | build-config: ${{ inputs.build-config }} 55 | -------------------------------------------------------------------------------- /.github/workflows/workflow-build-wtl-submodule.yml: -------------------------------------------------------------------------------- 1 | name: Reusable - Build/Upload WTL submod 2 | # TODO later test and lint 3 | # TODO test building library dependencies (the prebuilt stuff) 4 | 5 | 6 | 7 | # GH Action Reusable Workflow -- https://docs.github.com/en/actions/using-workflows/reusing-workflows 8 | on: 9 | workflow_call: 10 | inputs: 11 | platform-arch: 12 | required: true 13 | type: string 14 | build-config: 15 | required: true 16 | type: string 17 | 18 | 19 | jobs: 20 | build: 21 | # if windows-latest, might not find VS 2019 22 | runs-on: windows-2019 23 | 24 | steps: 25 | - name: Checkout code 26 | uses: actions/checkout@v3 27 | 28 | - name: Setup msbuild 29 | # https://github.com/marketplace/actions/setup-msbuild 30 | uses: microsoft/setup-msbuild@v1.1 31 | with: 32 | # Fixed on Visual Studio 2019 -- https://docs.microsoft.com/en-us/visualstudio/releases/2019/history 33 | vs-version: '[16.0,17.0)' 34 | msbuild-architecture: ${{ inputs.platform-arch }} 35 | 36 | - uses: ./.github/actions/setup-wix 37 | 38 | - uses: ./.github/actions/wtl-submodule 39 | 40 | - uses: ./.github/actions/build-solution 41 | with: 42 | platform-arch: ${{ inputs.platform-arch }} 43 | build-config: ${{ inputs.build-config }} 44 | 45 | - uses: ./.github/actions/upload-some-artifacts 46 | with: 47 | platform-arch: ${{ inputs.platform-arch }} 48 | build-config: ${{ inputs.build-config }} 49 | -------------------------------------------------------------------------------- /.github/workflows/workflow-rebuild-all-deps.yml: -------------------------------------------------------------------------------- 1 | name: Reusable - Rebuild All Libs 2 | # This reusable workflow rebuilds all binary dependencies. While you can pass in a build-config, only 'Release' configuration is supported because all libraries are built in release configuration. 3 | 4 | # NOTE: we don't replace any header files here... or anything else, ONLY binaries, so if there's a broken build, it could be caused by those things... and that ought to be updated in the source directly 5 | 6 | on: 7 | workflow_call: 8 | inputs: 9 | platform-arch: 10 | required: true 11 | type: string 12 | 13 | build-config: 14 | required: false 15 | type: string 16 | default: Release 17 | 18 | 19 | jobs: 20 | build: 21 | # if windows-latest, might not find VS 2019 22 | runs-on: windows-2019 23 | 24 | steps: 25 | - name: Checkout code with all Submodules 26 | uses: actions/checkout@v3 27 | with: 28 | submodules: recursive 29 | 30 | - name: Setup msbuild 31 | # https://github.com/marketplace/actions/setup-msbuild 32 | uses: microsoft/setup-msbuild@v1.1 33 | with: 34 | # Fixed on Visual Studio 2019 -- https://docs.microsoft.com/en-us/visualstudio/releases/2019/history 35 | vs-version: '[16.0,17.0)' 36 | msbuild-architecture: ${{ inputs.platform-arch }} 37 | 38 | - uses: ./.github/actions/setup-wix 39 | 40 | - uses: ./.github/actions/bin-cache 41 | 42 | - uses: ./.github/actions/build-solution 43 | with: 44 | platform-arch: ${{ inputs.platform-arch }} 45 | build-config: ${{ inputs.build-config }} 46 | 47 | - uses: ./.github/actions/upload-some-artifacts 48 | with: 49 | platform-arch: ${{ inputs.platform-arch }} 50 | build-config: ${{ inputs.build-config }} 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | **/obj 3 | **/Debug 4 | **/Release 5 | 6 | # Compiled Object files 7 | *.slo 8 | *.lo 9 | *.o 10 | *.obj 11 | 12 | # Debug files 13 | *.dSYM/ 14 | *.su 15 | *.idb 16 | *.pdb 17 | 18 | *.pch 19 | 20 | *.tlog 21 | 22 | *.dll 23 | *.ilk 24 | *.exp 25 | *.exe 26 | 27 | *.user 28 | 29 | # Visual C++ cache files 30 | ipch/ 31 | *.aps 32 | *.ncb 33 | *.opendb 34 | *.opensdf 35 | *.sdf 36 | *.cachefile 37 | *.VC.db 38 | *.VC.VC.opendb 39 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/WTL-sf"] 2 | path = deps/WTL-sf 3 | url = https://git.code.sf.net/p/wtl/git 4 | [submodule "extras/libjpeg-turbo"] 5 | path = extras/third_party/libjpeg-turbo 6 | url = https://github.com/libjpeg-turbo/libjpeg-turbo.git 7 | [submodule "extras/libwebp"] 8 | path = extras/third_party/libwebp 9 | url = https://chromium.googlesource.com/webm/libwebp 10 | [submodule "extras/libpng"] 11 | path = extras/third_party/libpng-apng.src-patch/libpng 12 | url = https://github.com/glennrp/libpng 13 | ignore = dirty 14 | [submodule "extras/zlib"] 15 | path = extras/third_party/libpng-apng.src-patch/zlib 16 | url = https://github.com/madler/zlib 17 | [submodule "extras/libjxl"] 18 | path = extras/third_party/libjxl 19 | url = https://github.com/libjxl/libjxl/ 20 | [submodule "extras/libheif"] 21 | path = extras/third_party/libheif/libheif 22 | url = https://github.com/strukturag/libheif 23 | [submodule "extras/dav1d"] 24 | path = extras/third_party/libheif/dav1d 25 | url = https://code.videolan.org/videolan/dav1d 26 | [submodule "extras/libde265"] 27 | path = extras/third_party/libheif/libde265 28 | url = https://github.com/strukturag/libde265 29 | [submodule "extras/third_party/libavif"] 30 | path = extras/third_party/libavif 31 | url = https://github.com/AOMediaCodec/libavif 32 | [submodule "extras/third_party/qoi"] 33 | path = extras/third_party/qoi 34 | url = https://github.com/phoboslab/qoi 35 | [submodule "extras/third_party/Little-CMS"] 36 | path = extras/third_party/Little-CMS 37 | url = https://github.com/mm2/Little-CMS 38 | [submodule "extras/third_party/LibRaw"] 39 | path = extras/third_party/LibRaw 40 | url = https://github.com/LibRaw/LibRaw/ 41 | -------------------------------------------------------------------------------- /CHANGELOG.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/CHANGELOG.txt -------------------------------------------------------------------------------- /COMPILING.txt: -------------------------------------------------------------------------------- 1 | JPEGView source code readme 2 | *************************** 3 | 4 | To compile JPEGView you need: 5 | 6 | - Visual Studio 2019 professional or community editions (JPEGView 32 and 64 bit versions supported) 7 | - Visual Studio 2017 professional or community editions (JPEGView 32 and 64 bit versions supported) 8 | (Configured to build XP-compatible versions only, does not include all current features, does not include MSI installer) 9 | - Windows Template Library (WTL), Version 8.1+ (http://sourceforge.net/projects/wtl/) installed to 10 | $(ProjectDir)..\..\deps\WTL-sf (This can be be automatically populated by cloning the submodule) 11 | 12 | 13 | To compile the MSI installer, you need: 14 | - WiX Toolset v3.11 or later (https://wixtoolset.org/releases/) 15 | - WiX Toolset Visual Studio Extension for your version of Visual Studio 16 | 17 | 18 | Please note: 19 | - Windows XP SP2 or later is needed to run the 32-bit version (When built from VS2017). 20 | - 64-bit Windows 7 or later is needed to run the 64-bit version. 21 | 22 | 23 | NOTE: VS2019 is the current active JPEGView development environment. 24 | 25 | 26 | Legacy Solution files 27 | ********************* 28 | 29 | NOTE: after the tag "last-cpp14-code", there is code that requires C++17. This code will not work on previous versions of Visual Studio. 30 | An #ifdef is used to disable that feature when compiling for standard below C++17 31 | 32 | Older solution files have been removed from the source tree. If you still need them, clone the tag v1.2.45 33 | -------------------------------------------------------------------------------- /HowToInstall_ru.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/HowToInstall_ru.txt -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | JPEGView 2 | Lean and fast image viewer with minimal GUI 3 | 4 | Copyright (C) 2020-2023 Kevin M (sylikc) 5 | Copyright (C) 2006-2018 David Kleiner (dkleiner) 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, see . 19 | -------------------------------------------------------------------------------- /deps/README.md: -------------------------------------------------------------------------------- 1 | # Deps (Additional Dependencies) 2 | 3 | This directory contains all the additional REQUIRED dependencies that JPEGView needs to compile. 4 | 5 | ## WTL 6 | 7 | Homepage: [SourceForge Windows Template Library (WTL)](https://sourceforge.net/projects/wtl/) 8 | 9 | FYI: WTL cannot be included in the JPEGView source distribution, because **Microsoft Public License** is INCOMPATIBLE with **GPL**. 10 | 11 | You can, however clone the submodule into this directory. 12 | 13 | To build JPEGView and have it automatically find WTL, clone the submodule. (Alternatively, you can download a zip file from the WTL project page and extract it to a folder named *wtl-sf*) 14 | 15 | -------------------------------------------------------------------------------- /extras/README.md: -------------------------------------------------------------------------------- 1 | # Extras 2 | 3 | This directory contains all the additional resources/libraries that JPEGView uses or sources from. 4 | 5 | ## scripts 6 | 7 | Misc scripts used for JPEGView maintenance. 8 | 9 | ## sw_repos 10 | 11 | Manifests for public Software Repositories 12 | 13 | ## third_party 14 | 15 | All third-party sources and libraries which are used to build the binaries contained in the JPEGView source tree. 16 | 17 | They are NOT required to build JPEGView, unless you'd like to build entirely from scratch. 18 | -------------------------------------------------------------------------------- /extras/scripts/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore all subdirectories (all temp stuff) 2 | **/ 3 | -------------------------------------------------------------------------------- /extras/scripts/README.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | 3 | This directory contains any miscellaneous batch files, Python scripts, or other scripts used to make certain maintenance tasks easier. 4 | 5 | ## build*.bat 6 | 7 | These are scripts that will automatically rebuild the required libraries from source. Make sure you initialize the submodules with `git submodule update --init --recursive` first! 8 | 9 | The build scripts are for the people who do _WANT_ to start from scratch, whether it's for security, validation, or updating to a new version. 10 | 11 | NOTE: You do _NOT_ need to rebuild libraries from scratch. The pre-built libraries are already included in the `src\` directories. 12 | 13 | NOTE: Re-built libraries do not match 1:1 with previous builds. The compiler puts other information into the binaries so they won't ever match 100% 14 | 15 | ## keymap_*py 16 | 17 | These Python scripts are for maintenance of the `KeyMap.txt` in an automated fashion. 18 | 19 | * `keymap_generate_symbols_and_readme.py` - regenerates the defaults and symbols directly from source. 20 | * `keymap_convert_readme_xp_compat.py` - the `KeyMap-README.html` files use a CSS2 feature to separate the translation from the built-in table, this takes existing files and converts them to be XP-compatible (for XP releases ONLY!) 21 | 22 | ## strings_txt_*.py 23 | 24 | These Python scripts are for translation and localization maintenance. 25 | 26 | * `strings_txt_builder.py` - regenerate the reference `strings.txt` from source 27 | * `strings_txt_sync_all.py` - sync all `strings_XX.txt` with the reference, automatically sorts entries and makes it easier to diff with the reference 28 | -------------------------------------------------------------------------------- /extras/scripts/build-lcms2.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | REM this builds lcms2 and replaces the dlls/libs in the JPEGView src folder 5 | 6 | SET XSRC_DIR=%~dp0..\..\src\JPEGView\lcms2 7 | SET XLIB_DIR=%~dp0..\third_party\Little-CMS 8 | SET XOUT_DIR=%~dp0lcms2 9 | 10 | SET XVS_VER=2019 11 | IF /I "%XVS_INIT_VER%" NEQ "" ( 12 | REM override the build version for the solutions provided 13 | SET XVS_VER=%XVS_INIT_VER% 14 | ) 15 | 16 | IF EXIST "%XOUT_DIR%" ( 17 | echo lcms2 output exists, please delete folder before trying to build 18 | exit /b 1 19 | ) 20 | 21 | 22 | call :BUILD_COPY_LCMS x86 Win32 "" 23 | IF ERRORLEVEL 1 exit /b 1 24 | 25 | call :BUILD_COPY_LCMS x64 x64 "64" 26 | IF ERRORLEVEL 1 exit /b 1 27 | 28 | 29 | 30 | echo === HEADER FILES NOT MAINTAINED BY SCRIPT === 31 | echo NOTE: as for the header files, copy/replace files AS NEEDED 32 | echo; 33 | echo TO: src\JPEGView\lcms2\include 34 | echo FROM: extras\third_party\Little-CMS\include 35 | 36 | exit /b 0 37 | 38 | 39 | 40 | 41 | REM =============================================================================================== 42 | 43 | :BUILD_COPY_LCMS 44 | 45 | REM so the environments don't pollute each other 46 | setlocal 47 | 48 | call "%~dp0vs-init.bat" %1 49 | 50 | pushd "%XLIB_DIR%" 51 | 52 | REM delete any previous build files, if exists 53 | del "bin\lcms2.*" 2>nul 54 | 55 | msbuild /t:lcms2_DLL /p:Platform=%2 /p:Configuration=Release .\Projects\VC%XVS_VER%\lcms2.sln 56 | IF ERRORLEVEL 1 exit /b 1 57 | 58 | copy /y "bin\lcms2.lib" "%XSRC_DIR%\lib%~3" 59 | IF ERRORLEVEL 1 exit /b 1 60 | copy /y "bin\lcms2.dll" "%XSRC_DIR%\bin%~3" 61 | IF ERRORLEVEL 1 exit /b 1 62 | 63 | exit /b 0 64 | -------------------------------------------------------------------------------- /extras/scripts/build-libjpegturbo.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | REM this builds libjpeg-turbo and replaces the libs in the JPEGView src folder 5 | 6 | SET XSRC_DIR=%~dp0..\..\src 7 | SET XLIB_DIR=%~dp0..\third_party\libjpeg-turbo 8 | SET XOUT_DIR=%~dp0libjpeg-turbo 9 | 10 | IF EXIST "%XOUT_DIR%" ( 11 | echo libjpeg-turbo output exists, please delete folder before trying to build 12 | exit /b 1 13 | ) 14 | 15 | echo + Looking up NASM 16 | where nasm.exe 17 | IF ERRORLEVEL 1 ( 18 | echo !!! NASM isn't required for building but highly recommended for speed improvements. !!! 19 | echo NASM isn't found on path! 20 | IF /I "%~1" NEQ "nonasm" ( 21 | echo pass in parameter "nonasm" to skip this check 22 | exit /b 1 23 | ) 24 | ) 25 | 26 | call :BUILD_COPY_JPEGT x86 lib 27 | IF ERRORLEVEL 1 exit /b 1 28 | call :BUILD_COPY_JPEGT x64 lib64 29 | IF ERRORLEVEL 1 exit /b 1 30 | 31 | 32 | 33 | 34 | echo === HEADER FILES NOT MAINTAINED BY SCRIPT === 35 | echo NOTE: as for the header files, copy/replace files AS NEEDED 36 | echo TO: src\JPEGView\libjpeg-turbo\include 37 | echo FROM: extras\third_party\libjpeg-turbo 38 | echo FROM: jconfig.h is in output directory 39 | 40 | 41 | exit /b 0 42 | 43 | 44 | 45 | 46 | 47 | :BUILD_COPY_JPEGT 48 | 49 | REM so the environments don't pollute each other 50 | setlocal 51 | 52 | SET XBUILD_DIR=%XOUT_DIR%\%1 53 | 54 | mkdir "%XBUILD_DIR%" 2>nul 55 | 56 | call "%~dp0vs-init.bat" %1 57 | 58 | pushd "%XBUILD_DIR%" 59 | cmake.exe -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release "%XLIB_DIR%" 60 | IF ERRORLEVEL 1 exit /b 1 61 | nmake.exe 62 | IF ERRORLEVEL 1 exit /b 1 63 | 64 | popd 65 | 66 | REM copy the libs over 67 | REM error checking if a copy fails... throws error to caller 68 | copy /y "%XBUILD_DIR%\turbojpeg-static.lib" "%XSRC_DIR%\JPEGView\libjpeg-turbo\%~2\" 69 | IF ERRORLEVEL 1 exit /b 1 70 | 71 | 72 | 73 | exit /b 0 74 | -------------------------------------------------------------------------------- /extras/scripts/build-libjxl.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | REM this builds libjxl and replaces the libs in the JPEGView src folder 5 | 6 | REM for me it takes like 15min to build 7 | echo NOTE: this takes a LONG time to build, don't be alarmed... 8 | echo if it looks like the build process hung... it didn't, it's just WAY SLOW! 9 | 10 | SET XSRC_DIR=%~dp0..\..\src 11 | SET XLIB_DIR=%~dp0..\third_party\libjxl 12 | SET XOUT_DIR=%~dp0libjxl 13 | 14 | IF EXIST "%XOUT_DIR%" ( 15 | echo libjxl output exists, please delete folder before trying to build 16 | exit /b 1 17 | ) 18 | 19 | call :BUILD_COPY_JXL x86 Win32 "" 20 | IF ERRORLEVEL 1 exit /b 1 21 | call :BUILD_COPY_JXL x64 x64 "64" 22 | IF ERRORLEVEL 1 exit /b 1 23 | 24 | 25 | 26 | 27 | echo === HEADER FILES NOT MAINTAINED BY SCRIPT === 28 | echo NOTE: as for the header files, copy/replace files AS NEEDED 29 | echo TO: src\JPEGView\libjxl\include\jxl 30 | echo FROM: extras\third_party\libjxl\lib\include\jxl 31 | echo FROM: %XOUT_DIR%\[arch]\lib\include\jxl 32 | 33 | exit /b 0 34 | 35 | 36 | 37 | 38 | 39 | :BUILD_COPY_JXL 40 | 41 | REM so the environments don't pollute each other 42 | setlocal 43 | 44 | SET XBUILD_ARCH=%~1 45 | SET XPLATFORM=%~2 46 | SET XJPV_ARCH_PATH=%~3 47 | 48 | SET XBUILD_DIR=%XOUT_DIR%\%XBUILD_ARCH% 49 | 50 | mkdir "%XBUILD_DIR%" 2>nul 51 | 52 | call "%~dp0vs-init.bat" %XBUILD_ARCH% 53 | 54 | pushd "%XBUILD_DIR%" 55 | 56 | cmake.exe -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -A %XPLATFORM% "%XLIB_DIR%" 57 | IF ERRORLEVEL 1 exit /b 1 58 | msbuild.exe /p:Platform=%XPLATFORM% /p:configuration="Release" LIBJXL.sln /t:jxl_dec /t:jxl_threads 59 | IF ERRORLEVEL 1 exit /b 1 60 | 61 | popd 62 | 63 | REM copy the libs over 64 | copy /y "%XBUILD_DIR%\Release\jxl*.dll" "%XSRC_DIR%\JPEGView\libjxl\bin%XJPV_ARCH_PATH%\" 65 | IF ERRORLEVEL 1 exit /b 1 66 | copy /y "%XBUILD_DIR%\third_party\brotli\Release\brotli*.dll" "%XSRC_DIR%\JPEGView\libjxl\bin%XJPV_ARCH_PATH%\" 67 | IF ERRORLEVEL 1 exit /b 1 68 | copy /y "%XBUILD_DIR%\lib\Release\jxl*.lib" "%XSRC_DIR%\JPEGView\libjxl\lib%XJPV_ARCH_PATH%\" 69 | IF ERRORLEVEL 1 exit /b 1 70 | 71 | 72 | 73 | exit /b 0 74 | -------------------------------------------------------------------------------- /extras/scripts/build-libwebp.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | REM this builds libwebp and replaces the libs in the JPEGView src folder 5 | 6 | SET XSRC_DIR=%~dp0..\..\src\JPEGView\libwebp 7 | SET XLIB_DIR=%~dp0..\third_party\libwebp 8 | SET XOUT_DIR=%~dp0libwebp 9 | 10 | IF EXIST "%XOUT_DIR%" ( 11 | echo libwebp output exists, please delete folder before trying to build 12 | exit /b 1 13 | ) 14 | 15 | call :BUILD_COPY_WEBP x86 lib 16 | IF ERRORLEVEL 1 exit /b 1 17 | call :BUILD_COPY_WEBP x64 lib64 18 | IF ERRORLEVEL 1 exit /b 1 19 | 20 | 21 | echo === HEADER FILES NOT MAINTAINED BY SCRIPT === 22 | echo NOTE: as for the header files, copy/replace files AS NEEDED 23 | echo extras\third_party\libwebp\src\webp -to- src\JPEGView\libwebp\include 24 | 25 | exit /b 0 26 | 27 | 28 | 29 | 30 | 31 | :BUILD_COPY_WEBP 32 | 33 | REM so the environments don't pollute each other 34 | setlocal 35 | 36 | mkdir "%XOUT_DIR%" 2>nul 37 | 38 | call "%~dp0vs-init.bat" %1 39 | 40 | pushd "%XLIB_DIR%" 41 | 42 | REM ARCH= is optional, but for some reason, building with VS2017 in some instances it's needed 43 | ::nmake.exe /f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR="%XOUT_DIR%" 44 | nmake.exe /f Makefile.vc ARCH=%1 CFG=release-static RTLIBCFG=static OBJDIR="%XOUT_DIR%" 45 | IF ERRORLEVEL 1 exit /b 1 46 | 47 | popd 48 | 49 | REM copy the libs over 50 | REM error checking if a copy fails... throws error to caller 51 | copy /y "%XOUT_DIR%\release-static\%1\lib\libwebp.lib" "%XSRC_DIR%\%2\" 52 | IF ERRORLEVEL 1 exit /b 1 53 | copy /y "%XOUT_DIR%\release-static\%1\lib\libwebpdemux.lib" "%XSRC_DIR%\%2\" 54 | IF ERRORLEVEL 1 exit /b 1 55 | 56 | 57 | exit /b 0 58 | -------------------------------------------------------------------------------- /extras/scripts/keymap_convert_readme_xp_compat.py: -------------------------------------------------------------------------------- 1 | """ 2 | Windows XP uses IE 6.x so it isn't compatible with the CSS2's use of :before 3 | 4 | Thus, this script is to take a given README and convert it to the old-style so WinXP shows the same text 5 | 6 | It takes one that is already done, because the ones which use CSS2 are much easier to translate 7 | """ 8 | import re 9 | from pathlib import Path 10 | import sys 11 | 12 | from util_common import get_all_text_between 13 | 14 | def keymap_readme_xp_compat(filepath): 15 | """ 16 | 17 | search for all ".:before.*{.*content: " .... "} between ", search_str=file_contents) 30 | #print(style_block) 31 | 32 | # generate a list of the content strings 33 | content = {} 34 | 35 | # https://www.dataquest.io/blog/regex-cheatsheet/ 36 | for idm_var, c in re.findall('\.(\w+):before\s*\{\s*content\s*:\s*"(.*?)"\s*\}', style_block): 37 | #print(idm_var, c) 38 | content[idm_var] = c 39 | print(f"style {idm_var}={c}") 40 | 41 | 42 | # replace the 43 | for span in re.findall('()', file_contents): 44 | m = re.search('"(\w+)"', span) 45 | if not m: 46 | raise RuntimeError("shouldn't happen") 47 | 48 | #print(span, content[m.group(1)]) 49 | file_contents = file_contents.replace(span, content[m.group(1)]) 50 | 51 | #print(file_contents) 52 | 53 | # dump it back out 54 | with open(filepath.with_suffix(".xp.html"), 'wt', encoding='utf-8') as f: 55 | f.write(file_contents) 56 | 57 | 58 | if __name__ == "__main__": 59 | if len(sys.argv) != 2: 60 | raise Exception("Need arg for file") 61 | 62 | keymap_readme_xp_compat(Path(sys.argv[1])) 63 | -------------------------------------------------------------------------------- /extras/scripts/sha256sum.py: -------------------------------------------------------------------------------- 1 | """ 2 | quick and dirty to create sha256sum file of the files in a directory 3 | 4 | https://www.quickprogrammingtips.com/python/how-to-calculate-sha256-hash-of-a-file-in-python.html 5 | """ 6 | 7 | # Python program to find SHA256 hash string of a file 8 | import hashlib 9 | from pathlib import Path 10 | import sys 11 | 12 | glob_pattern = "*" if len(sys.argv) == 1 else sys.argv[1] 13 | 14 | for filename in Path.cwd().glob(glob_pattern): 15 | if not filename.is_file(): 16 | continue 17 | 18 | sha256_hash = hashlib.sha256() 19 | with open(filename,"rb") as f: 20 | # Read and update hash string value in blocks of 4K 21 | for byte_block in iter(lambda: f.read(4096),b""): 22 | sha256_hash.update(byte_block) 23 | print(f"{sha256_hash.hexdigest()} *{filename.name}") 24 | -------------------------------------------------------------------------------- /extras/scripts/util_common.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | It's a Util Library... things I use over and over again... 4 | 5 | """ 6 | import re 7 | #from pathlib import Path 8 | 9 | 10 | ################################################################################################# 11 | 12 | def get_all_text_between(filepath, pattern_begin, pattern_end, encoding=None, search_str=None, inclusive=True): 13 | """ get all the text between the two patterns 14 | 15 | if filepath is None, assume we have the string in search_str 16 | 17 | if inclusive=True, includes all the strings including what matched the pattern 18 | """ 19 | 20 | if filepath is None and search_str is None: 21 | raise ValueError 22 | 23 | if filepath is not None: 24 | if not filepath.exists(): 25 | raise FileNotFoundError 26 | 27 | with open(filepath, 'rt', encoding=encoding) as f: 28 | search_str = f.read() 29 | 30 | m = re.search(f"({pattern_begin})(.*?)({pattern_end})", search_str, re.MULTILINE | re.DOTALL) 31 | if m is None: 32 | raise LookupError(f"ERROR: couldn't find {pattern_begin}") 33 | 34 | # remove the len(pattern_end) <== that's buggy, the pattern could be long but match less 35 | return m.group(0) if inclusive else m.group(2) 36 | 37 | ################################################################################################# 38 | -------------------------------------------------------------------------------- /extras/scripts/vs-init.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM this is a routine that would detect and initialize visual studio environment. 4 | REM It's not going to be tested very well for new versions because I only have VS2017 and VS2019 Community installed 5 | 6 | REM if a special variable comes in, it'll use that version XVS_INIT_VER= 7 | 8 | IF /I "%~1" EQU "" ( 9 | echo ERROR: Pass in an [arch] to be passed to a vcvarsall.bat 10 | exit /b 1 11 | ) 12 | 13 | SET XVS_BASE_COMMON=%ProgramFiles(x86)%\Microsoft Visual Studio 14 | 15 | IF /I "%XVS_INIT_VER%" EQU "" GOTO SKIP_VER 16 | REM need to do it this way so that () chars don't cause a syntax error 17 | SET XVS_BASE_COMMON=%XVS_BASE_COMMON%\%XVS_INIT_VER% 18 | :SKIP_VER 19 | 20 | IF NOT EXIST "%XVS_BASE_COMMON%" ( 21 | echo Visual Studio not installed or installed in a non-standard location! 22 | exit /b 1 23 | ) 24 | 25 | SET XVS_VCVARS_BAT= 26 | 27 | REM because the directories in theory should come out in order 28 | REM it'll automatically pick up the LAST vcvarsall.bat (in theory) 29 | FOR /F "usebackq tokens=*" %%I IN (`dir /b /on /s "%XVS_BASE_COMMON%\vcvarsall.bat"`) DO ( 30 | echo + Found VCVARSALL.BAT at: %%I 31 | SET XVS_VCVARS_BAT=%%I 32 | ) 33 | 34 | 35 | echo == Using: %XVS_VCVARS_BAT% == 36 | call "%XVS_VCVARS_BAT%" %~1 37 | 38 | 39 | 40 | SET XVS_BASE_COMMON= 41 | SET XVS_VCVARS_BAT= 42 | 43 | 44 | exit /b 0 45 | -------------------------------------------------------------------------------- /extras/sw_repos/README.md: -------------------------------------------------------------------------------- 1 | # Software Repositories 2 | 3 | Users have requested that JPEGView be submitted to multiple different software repositories. 4 | 5 | Most open repositories have public manifests files, so these files aren't considered private. 6 | 7 | ## WinGet-sylikc.JPEGView 8 | 9 | These are the latest YAML files used to submit to the WinGet repository. 10 | 11 | See README.txt for more information. Will change with updates. These files are _not_ required to compile JPEGView. 12 | -------------------------------------------------------------------------------- /extras/sw_repos/WinGet-sylikc.JPEGView/README.txt: -------------------------------------------------------------------------------- 1 | These are the latest YAML files used to submit to the WinGet repository. 2 | 3 | Update as necessary to re-submit for later versions. 4 | 5 | ======================================================================= 6 | 7 | WinGet was requested by a community member as it's the default package manager on Windows 11. You can also use it on Windows 10. 8 | 9 | Read more: https://docs.microsoft.com/en-us/windows/package-manager/winget/ 10 | 11 | ======================================================================= 12 | 13 | sample> winget search jpegview 14 | 15 | Name Id Version Source 16 | ----------------------------------------- 17 | JPEGView sylikc.JPEGView 1.0.39.1 winget 18 | 19 | 20 | ======================================================================= 21 | 22 | 23 | Keep track of version submissions here: 24 | 25 | Tag Pull Request 26 | ----- ------ 27 | v1.0.39.1-wix https://github.com/microsoft/winget-pkgs/pull/52204 28 | v1.0.40 https://github.com/microsoft/winget-pkgs/pull/56349 29 | v1.1.41 https://github.com/microsoft/winget-pkgs/pull/92691 30 | v1.1.41.1 https://github.com/microsoft/winget-pkgs/pull/92841 31 | v1.1.43 https://github.com/microsoft/winget-pkgs/pull/95763 32 | v1.2.45 https://github.com/microsoft/winget-pkgs/pull/98629 33 | -------------------------------------------------------------------------------- /extras/sw_repos/WinGet-sylikc.JPEGView/sylikc.JPEGView.installer.yaml: -------------------------------------------------------------------------------- 1 | # Created using wingetcreate 1.2.5.0 2 | # yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.4.0.schema.json 3 | 4 | PackageIdentifier: sylikc.JPEGView 5 | PackageVersion: 1.2.45 6 | InstallerLocale: en-US 7 | MinimumOSVersion: 10.0.0.0 8 | FileExtensions: 9 | - jpeg 10 | - jpg 11 | - gif 12 | - bmp 13 | - png 14 | - tif 15 | - tiff 16 | - webp 17 | - jxl 18 | - heif 19 | - heic 20 | - avif 21 | - tga 22 | - wdp 23 | - hdp 24 | - jxr 25 | - raw 26 | - ico 27 | - wic 28 | - dng 29 | - crw 30 | - cr2 31 | - nef 32 | - nrw 33 | - arw 34 | - sr2 35 | - orf 36 | - rw2 37 | - raf 38 | - x3f 39 | - pef 40 | - mrw 41 | - kdc 42 | - dcr 43 | ReleaseDate: 2023-03-04 44 | AppsAndFeaturesEntries: 45 | - DisplayVersion: 1.2.45 46 | Installers: 47 | - Architecture: x64 48 | InstallerType: wix 49 | InstallerUrl: https://github.com/sylikc/jpegview/releases/download/v1.2.45/JPEGView64_en-us_1.2.45.msi 50 | InstallerSha256: F4DA7EC7D82E4F29400A86B60F8330E6CD56654274A6E8BFF63E5167C84B4F3E 51 | ProductCode: '{C06601BB-0872-4DCE-B7EA-C2BAF6A63598}' 52 | - Architecture: x86 53 | InstallerType: wix 54 | InstallerUrl: https://github.com/sylikc/jpegview/releases/download/v1.2.45/JPEGView32_en-us_1.2.45.msi 55 | InstallerSha256: B3D8B3343E4D77BE49A844F851A563DB93DCE6FD360DFC9F8FA105E7F11D116C 56 | ProductCode: '{C4559461-99D3-40AA-A4E4-749CAE8AAA17}' 57 | ManifestType: installer 58 | ManifestVersion: 1.4.0 59 | -------------------------------------------------------------------------------- /extras/sw_repos/WinGet-sylikc.JPEGView/sylikc.JPEGView.locale.en-US.yaml: -------------------------------------------------------------------------------- 1 | # Created using wingetcreate 1.2.5.0 2 | # yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.4.0.schema.json 3 | 4 | PackageIdentifier: sylikc.JPEGView 5 | PackageVersion: 1.2.45 6 | PackageLocale: en-US 7 | Publisher: Kevin M (sylikc) 8 | PublisherUrl: https://github.com/sylikc/ 9 | PublisherSupportUrl: https://github.com/sylikc/jpegview/issues 10 | Author: Kevin M (sylikc) 11 | PackageName: JPEGView 12 | PackageUrl: https://github.com/sylikc/jpegview 13 | License: GPLv2 14 | LicenseUrl: https://github.com/sylikc/jpegview/blob/master/LICENSE.txt 15 | Copyright: |- 16 | Copyright (C) 2020-2023 Kevin M (sylikc) 17 | Copyright (C) 2006-2018 David Kleiner (dkleiner) 18 | CopyrightUrl: https://github.com/sylikc/jpegview/blob/master/LICENSE.txt 19 | ShortDescription: JPEGView is a lean, fast and highly configurable viewer/editor for JPEG, BMP, PNG, WEBP, TGA, GIF, JXL, HEIC, HEIF, AVIF and TIFF images with a minimal GUI. Basic on-the-fly image processing is provided. 20 | Moniker: jpegview 21 | Tags: 22 | - editor 23 | - foss 24 | - image 25 | - images 26 | - image-editor 27 | - image-processing 28 | - image-viewer 29 | - image-viewers 30 | - open-source 31 | - photo 32 | - photos 33 | - photo-editor 34 | - picture 35 | - viewer 36 | - viewers 37 | ReleaseNotesUrl: https://github.com/sylikc/jpegview/releases/tag/v1.2.45 38 | ManifestType: defaultLocale 39 | ManifestVersion: 1.4.0 40 | -------------------------------------------------------------------------------- /extras/sw_repos/WinGet-sylikc.JPEGView/sylikc.JPEGView.yaml: -------------------------------------------------------------------------------- 1 | # Created using wingetcreate 1.2.5.0 2 | # yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.4.0.schema.json 3 | 4 | PackageIdentifier: sylikc.JPEGView 5 | PackageVersion: 1.2.45 6 | DefaultLocale: en-US 7 | ManifestType: version 8 | ManifestVersion: 1.4.0 9 | -------------------------------------------------------------------------------- /extras/third_party/libpng-apng.src-patch/libpng-apng/README.txt: -------------------------------------------------------------------------------- 1 | This modified version of libpng code adds animated PNG support and is 2 | released under the same license as the upstream library. The modifications 3 | are Copyright (c) 2006-2007 Andrew Smith, Copyright (c) 2008-2023 Max Stepin, 4 | and are delimited by "#ifdef PNG_APNG_SUPPORTED / #endif" directives 5 | surrounding them in the modified libpng source files. 6 | 7 | You can get it from: 8 | https://sourceforge.net/projects/apng/files/libpng/libpng16/ 9 | https://sourceforge.net/projects/libpng-apng/files/libpng16/ 10 | https://hg.mozilla.org/mozilla-central/file/tip/media/libpng/apng.patch 11 | 12 | -------------------------------------------------------------------------------- /extras/third_party/libpng-apng.src-patch/patch-libpng.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # --forward is optional, and added to make scripting calls to this easier 4 | 5 | # apng support 6 | echo "--- Patching libpng with apng support ---" 7 | patch -d libpng -p0 --forward < libpng-apng/libpng-1.6.40-apng.patch 8 | # error check, fail and return error if failed 9 | if [ $? -ne 0 ]; then 10 | echo apng patch failed 11 | exit 1 12 | fi 13 | 14 | 15 | # 64-bit support 16 | echo "--- Patching libpng with 64-bit support ---" 17 | patch -d libpng -p1 --forward < libpng-x64.patch 18 | if [ $? -ne 0 ]; then 19 | echo x64 patch failed 20 | exit 1 21 | fi 22 | -------------------------------------------------------------------------------- /src/JPEGView.Setup/Product_en-us.wxl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1033 4 | 5 | 6 | JPEGView 7 | Kevin M 8 | Kevin M (sylikc) 9 | Lightweight Image Viewer 10 | Installs JPEGView 11 | 12 | Eula-en.rtf 13 | 14 | 17 | The same or a newer version of this product is already installed. 18 | You should install the 64-bit version of this product on 64-bit Windows. 19 | You should install the 32-bit version of this product on 32-bit Windows. 20 | 21 | The complete package. 22 | The main version including all dependencies. 23 | Main program 24 | 25 | JPEGView Associated File 26 | Edit with JPEGView 27 | Open with JPEGView 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/JPEGView.Setup/res/BannerTop.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView.Setup/res/BannerTop.bmp -------------------------------------------------------------------------------- /src/JPEGView.Setup/res/Dialog.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView.Setup/res/Dialog.bmp -------------------------------------------------------------------------------- /src/JPEGView.Setup/res/License.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Courier New;}} 2 | {\colortbl ;\red0\green0\blue255;} 3 | {\*\generator Riched20 10.0.19041}\viewkind4\uc1 4 | \pard\sl240\slmult1\b\fs28\lang9 JPEGView\b0\fs24 \par 5 | \i\fs22 Lean and fast image viewer with minimal GUI\i0\par 6 | {{\field{\*\fldinst{HYPERLINK https://github.com/sylikc/jpegview/ }}{\fldrslt{https://github.com/sylikc/jpegview/\ul0\cf0}}}}\f0\fs22\par 7 | \par 8 | Copyright (C) 2020-2023 \ul\fs24 Kevin M (sylikc)\ulnone {\fs22{\field{\*\fldinst{HYPERLINK https://github.com/sylikc }}{\fldrslt{https://github.com/sylikc\ul0\cf0}}}}\f0\fs22\par 9 | \par 10 | Copyright (C) 2006-2018 \ul\fs24 David Kleiner (dkleiner)\ulnone {\fs22{\field{\*\fldinst{HYPERLINK https://sourceforge.net/u/dkleiner/profile/ }}{\fldrslt{https://sourceforge.net/u/dkleiner/profile/\ul0\cf0}}}}\f0\fs22\par 11 | \par 12 | \f1\fs20 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\par 13 | \par 14 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\par 15 | \par 16 | You should have received a copy of the GNU General Public License along with this program; if not, see {{\field{\*\fldinst{HYPERLINK https://www.gnu.org/licenses }}{\fldrslt{https://www.gnu.org/licenses\ul0\cf0}}}}\f0\fs22\par 17 | } 18 | -------------------------------------------------------------------------------- /src/JPEGView/AVIFWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class AvifReader 7 | { 8 | public: 9 | // Returns data in 4 byte BGRA 10 | static void* ReadImage(int& width, // width of the image loaded. 11 | int& height, // height of the image loaded. 12 | int& bpp, // BYTES (not bits) PER PIXEL. 13 | bool& has_animation, // if the image is animated 14 | int frame_index, // index of frame 15 | int& frame_count, // number of frames 16 | int& frame_time, // frame duration in milliseconds 17 | void*& exif_chunk, // Pointer to Exif data (must be freed by caller) 18 | bool& outOfMemory, // set to true when no memory to read image 19 | const void* buffer, // memory address containing jxl compressed data. 20 | int sizebytes); // size of jxl compressed data 21 | 22 | static void DeleteCache(); 23 | 24 | private: 25 | struct avif_cache; 26 | static avif_cache cache; 27 | }; 28 | -------------------------------------------------------------------------------- /src/JPEGView/AboutDlg.h: -------------------------------------------------------------------------------- 1 | // About dialog 2 | ///////////////////////////////////////////////////////////////////////////// 3 | 4 | #pragma once 5 | 6 | #include "resource.h" 7 | 8 | // About dialog 9 | class CAboutDlg : public CDialogImpl 10 | { 11 | public: 12 | enum { IDD = IDD_ABOUT }; 13 | 14 | BEGIN_MSG_MAP(CAboutDlg) 15 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 16 | MESSAGE_HANDLER(WM_CLOSE, OnClose) 17 | COMMAND_ID_HANDLER(IDC_CLOSE, OnCloseDialog) 18 | COMMAND_ID_HANDLER(IDCANCEL, OnCloseDialog) 19 | NOTIFY_HANDLER(IDC_LICENSE, EN_LINK, OnLinkClicked) 20 | END_MSG_MAP() 21 | 22 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 23 | LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 24 | LRESULT OnCloseDialog(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 25 | LRESULT OnLinkClicked(WPARAM wParam, LPNMHDR lpnmhdr, BOOL& bHandled); 26 | 27 | CAboutDlg(void); 28 | ~CAboutDlg(void); 29 | 30 | private: 31 | CStatic m_lblVersion; 32 | CStatic m_lblSIMD; 33 | CStatic m_lblNumCores; 34 | CRichEditCtrl m_richEdit; 35 | CStatic m_lblIcon; 36 | CButton m_btnClose; 37 | }; 38 | -------------------------------------------------------------------------------- /src/JPEGView/ApplyFilterAVX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CXMMImage; 4 | struct AVXFilterKernelBlock; 5 | 6 | // Used by BasicProcessing.cpp: Applies a filter using AVX. Own compilation unit to be able to compile this with AVX compiler flag. 7 | CXMMImage* ApplyFilter_AVX(int nSourceHeight, int nTargetHeight, int nWidth, 8 | int nStartY_FP, int nStartX, int nIncrementY_FP, 9 | const AVXFilterKernelBlock& filter, 10 | int nFilterOffset, const CXMMImage* pSourceImg); -------------------------------------------------------------------------------- /src/JPEGView/Clipboard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ProcessParams.h" 4 | 5 | class CJPEGImage; 6 | 7 | // Allows to copy an image or text to the clipboard and to paste an image from the clipboard 8 | class CClipboard { 9 | public: 10 | // Copy the pixels of the currently visible part of the image as a 24 bpp DIB to the clipboard 11 | // Zoom is as on screen. 12 | static void CopyImageToClipboard(HWND hWnd, CJPEGImage * pImage, LPCTSTR fileName); 13 | 14 | // Copy processed full size image as a 24 bpp DIB to the clipboard, i.e. in original resolution. 15 | static void CopyFullImageToClipboard(HWND hWnd, CJPEGImage * pImage, const CImageProcessingParams& procParams, 16 | EProcessingFlags eFlags, LPCTSTR fileName); 17 | 18 | // Copy section of full size image as a 24 bpp DIB to the clipboard, i.e. in original resolution. 19 | static void CopyFullImageToClipboard(HWND hWnd, CJPEGImage * pImage, const CImageProcessingParams& procParams, 20 | EProcessingFlags eFlags, CRect clipRect, LPCTSTR fileName); 21 | 22 | // Copy file path to the clipboard. 23 | static void CopyPathToClipboard(HWND hWnd, CJPEGImage* pImage, LPCTSTR fileName); 24 | 25 | // Paste image from clipboard. Returns NULL if paste failed. The caller gets ownership of the returned image. 26 | static CJPEGImage* PasteImageFromClipboard(HWND hWnd, const CImageProcessingParams& procParams, EProcessingFlags eFlags); 27 | 28 | private: 29 | CClipboard(void); 30 | 31 | static void DoCopy(HWND hWnd, int nWidth, int nHeight, const void* pSourceImageDIB32, LPCTSTR fileName); 32 | static void DoCopyFileNameText(HWND hWnd, LPCTSTR fileName); 33 | }; 34 | -------------------------------------------------------------------------------- /src/JPEGView/Config/JPEGView_ru.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/Config/JPEGView_ru.ini -------------------------------------------------------------------------------- /src/JPEGView/Config/JPEGView_ru.ini.tpl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/Config/JPEGView_ru.ini.tpl -------------------------------------------------------------------------------- /src/JPEGView/Config/KeyMap-README_ru.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/Config/KeyMap-README_ru.html -------------------------------------------------------------------------------- /src/JPEGView/Config/KeyMap.txt.default_ru: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/Config/KeyMap.txt.default_ru -------------------------------------------------------------------------------- /src/JPEGView/Config/NavPanel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/Config/NavPanel.png -------------------------------------------------------------------------------- /src/JPEGView/CropSizeDlg.h: -------------------------------------------------------------------------------- 1 | // Set cropping rectangle size 2 | ///////////////////////////////////////////////////////////////////////////// 3 | 4 | #pragma once 5 | 6 | #include "resource.h" 7 | 8 | // Cropping rectangle dialog 9 | class CCropSizeDlg : public CDialogImpl 10 | { 11 | public: 12 | enum { IDD = IDD_SET_CROP_SIZE }; 13 | 14 | BEGIN_MSG_MAP(CCropSizeDlg) 15 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 16 | MESSAGE_HANDLER(WM_CLOSE, OnClose) 17 | COMMAND_ID_HANDLER(IDC_BTN_CLOSE, OnCloseDialog) 18 | COMMAND_ID_HANDLER(IDCANCEL, OnCloseDialog) 19 | END_MSG_MAP() 20 | 21 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 22 | LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 23 | LRESULT OnCloseDialog(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 24 | 25 | CCropSizeDlg(void); 26 | ~CCropSizeDlg(void); 27 | 28 | static CSize GetCropSize() { return CSize(sm_nWidth, sm_nHeight); } 29 | static bool UseScreenPixels() { return sm_bScreen; } 30 | 31 | private: 32 | CButton m_btnClose; 33 | CStatic m_lblWidth; 34 | CStatic m_lblHeight; 35 | CStatic m_lblPixel; 36 | CStatic m_lblPixel2; 37 | CButton m_rbScreen; 38 | CButton m_rbImage; 39 | CEdit m_edtWidth; 40 | CEdit m_edtHeight; 41 | 42 | static int sm_nWidth; 43 | static int sm_nHeight; 44 | static bool sm_bScreen; 45 | 46 | void Close(); 47 | }; 48 | -------------------------------------------------------------------------------- /src/JPEGView/DesktopWallpaper.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "DesktopWallpaper.h" 3 | #include "JPEGImage.h" 4 | #include "SaveImage.h" 5 | #include "MultiMonitorSupport.h" 6 | #include "SettingsProvider.h" 7 | 8 | namespace SetDesktopWallpaper { 9 | 10 | // Sets a string value in the registry in the path HKEY_CURRENT_USER\Control Panel\Desktop 11 | static bool SetRegistryStringValue(LPCTSTR name, LPCTSTR stringValue) { 12 | HKEY key; 13 | if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop"), 0, KEY_READ | KEY_WRITE, &key) != ERROR_SUCCESS) 14 | return false; 15 | return RegSetValueEx(key, name, 0, REG_SZ, (const BYTE *)stringValue, ((int)_tcslen(stringValue) + 1) * sizeof(TCHAR)) == ERROR_SUCCESS; 16 | } 17 | 18 | void SetFileAsWallpaper(CJPEGImage& image, LPCTSTR fileName) 19 | { 20 | CRect largestMonitor = CMultiMonitorSupport::GetMonitorRect(-1); 21 | bool needsFitToScreen = image.InitOrigWidth() > largestMonitor.Width() || image.InitOrigHeight() > largestMonitor.Height(); 22 | SetRegistryStringValue(_T("WallpaperStyle"), needsFitToScreen ? _T("6") : _T("0")); 23 | SetRegistryStringValue(_T("TileWallpaper"), _T("0")); 24 | 25 | void* parameter = (void*)fileName; 26 | ::SystemParametersInfo(SPI_SETDESKWALLPAPER, 27 | 0, 28 | parameter, 29 | SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE); 30 | } 31 | 32 | void SetProcessedImageAsWallpaper(CJPEGImage& image) 33 | { 34 | bool bitmapMatchesDesktop = false; 35 | int windowsVersion = Helpers::GetWindowsVersion(); 36 | LPCTSTR wallpaperStyle = _T("0"); 37 | LPCTSTR tileWallpaper = _T("0"); 38 | if (windowsVersion >= 601) { 39 | // Check if image spans all screens 40 | CRect allScreens = CMultiMonitorSupport::GetVirtualDesktop(); 41 | bitmapMatchesDesktop = (allScreens.Size() == CSize(image.DIBWidth(), image.DIBHeight())); 42 | if (bitmapMatchesDesktop && windowsVersion >= 602) wallpaperStyle = _T("22"); // for Windows 8 ff 43 | if (bitmapMatchesDesktop && windowsVersion == 601) tileWallpaper = _T("1"); // for Windows 7 44 | } 45 | SetRegistryStringValue(_T("WallpaperStyle"), wallpaperStyle); 46 | SetRegistryStringValue(_T("TileWallpaper"), tileWallpaper); 47 | 48 | LPCTSTR path = CSettingsProvider::This().WallpaperPath(); 49 | if (path[0] == 0) return; 50 | 51 | CString fileName = CString(path) + _T("\\JPEGViewWallpaper.bmp"); 52 | 53 | if (!CSaveImage::SaveImage(fileName, &image, false)) return; 54 | 55 | void* parameter = (void*)(LPCTSTR)fileName; 56 | ::SystemParametersInfo(SPI_SETDESKWALLPAPER, 57 | 0, 58 | parameter, 59 | SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE); 60 | } 61 | } -------------------------------------------------------------------------------- /src/JPEGView/DesktopWallpaper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CJPEGImage; 4 | 5 | namespace SetDesktopWallpaper { 6 | // Sets the specified image file as desktop wallpaper. Must be an image format supported by the OS as wallpaper. 7 | // Windows XP only supports BMP, later also JPG, TIFF, PNG and TIFF are supported. 8 | void SetFileAsWallpaper(CJPEGImage& image, LPCTSTR fileName); 9 | 10 | // Sets the specified image as desktop wallpaper, using its currently shown size and resolution and 11 | // having its current processings applied. 12 | void SetProcessedImageAsWallpaper(CJPEGImage& image); 13 | } -------------------------------------------------------------------------------- /src/JPEGView/DirectoryWatcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Watcher thread for a directory. Sends the two messages WM_DISPLAYED_FILE_CHANGED_ON_DISK and WM_ACTIVE_DIRECTORY_FILELIST_CHANGED 4 | // to the specified window. 5 | class CDirectoryWatcher { 6 | public: 7 | // The messages are sent to the specified target window. 8 | CDirectoryWatcher(HWND hTargetWindow); 9 | virtual ~CDirectoryWatcher(void); 10 | 11 | void SetCurrentFile(LPCTSTR fileName); 12 | void SetCurrentDirectory(LPCTSTR directoryName); 13 | 14 | // Kindly terminates the thread by setting the m_terminateEvent 15 | void Terminate(); 16 | // First tries to terminate the thread by setting m_terminateEvent, when no reaction -> kills the thread 17 | void Abort(); 18 | 19 | private: 20 | CRITICAL_SECTION m_lock; 21 | HANDLE m_terminateEvent; // Event to terminate the thread 22 | HANDLE m_newDirectoryEvent; // New directory needs to be watched 23 | HANDLE m_hThread; // watchdog thread 24 | HWND m_hTargetWindow; 25 | bool m_bTerminate; 26 | 27 | CString m_sCurrentDirectory; 28 | CString m_sCurrentFile; 29 | BOOL m_bModificationTimeValid; 30 | FILETIME m_modificationTimeCurrentFile; 31 | 32 | static void __cdecl ThreadFunc(void* arg); 33 | }; 34 | -------------------------------------------------------------------------------- /src/JPEGView/EXIFDisplayCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PanelController.h" 4 | 5 | class CEXIFDisplay; 6 | 7 | // Implements functionality of the EXIF display panel 8 | class CEXIFDisplayCtl : public CPanelController 9 | { 10 | public: 11 | CEXIFDisplayCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel); 12 | virtual ~CEXIFDisplayCtl(); 13 | 14 | virtual float DimFactor() { return 0.5f; } 15 | 16 | virtual bool IsVisible(); 17 | virtual bool IsActive() { return m_bVisible; } 18 | 19 | virtual void SetVisible(bool bVisible); 20 | virtual void SetActive(bool bActive); 21 | 22 | virtual void AfterNewImageLoaded(); 23 | 24 | virtual bool OnMouseMove(int nX, int nY); 25 | virtual void OnPrePaintMainDlg(HDC hPaintDC); 26 | 27 | private: 28 | bool m_bVisible; 29 | CEXIFDisplay* m_pEXIFDisplay; 30 | CPanel* m_pImageProcPanel; 31 | int m_nFileNameHeight; 32 | 33 | void FillEXIFDataDisplay(); 34 | static void OnShowHistogram(void* pContext, int nParameter, CButtonCtrl & sender); 35 | static void OnClose(void* pContext, int nParameter, CButtonCtrl & sender); 36 | }; -------------------------------------------------------------------------------- /src/JPEGView/EXIFHelpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CJPEGImage; 4 | 5 | namespace EXIFHelpers { 6 | 7 | struct EXIFResult { 8 | int NumberOfSucceededFiles; 9 | int NumberOfFailedFiles; 10 | }; 11 | 12 | // Sets the modification date of the given file to the given time in UTC (Caution!) 13 | bool SetModificationDate(LPCTSTR sFileName, const SYSTEMTIME& time); 14 | 15 | // Sets the modification date of the given file to the EXIF date of the given image 16 | bool SetModificationDateToEXIF(LPCTSTR sFileName, CJPEGImage* pImage); 17 | 18 | // Sets the modification date of the given file to the EXIF date, using GDI+ to read the EXIF date 19 | bool SetModificationDateToEXIF(LPCTSTR sFileName); 20 | 21 | // Sets the modification date of all JPEG files in the given directory to the EXIF date. 22 | EXIFResult SetModificationDateToEXIFAllFiles(LPCTSTR sDirectory); 23 | 24 | } -------------------------------------------------------------------------------- /src/JPEGView/FileExtensionsDlg.h: -------------------------------------------------------------------------------- 1 | // Set file extensions dialog 2 | ///////////////////////////////////////////////////////////////////////////// 3 | 4 | #pragma once 5 | 6 | #include "resource.h" 7 | 8 | class CFileExtensionsRegistry; 9 | 10 | // Dialog to define the file extensions that are bound to JPEGView. 11 | // This dialog is used for Windows XP, Vista and Windows 7 but not for Windows 8 and later. 12 | class CFileExtensionsDlg : public CDialogImpl 13 | { 14 | public: 15 | 16 | enum { IDD = IDD_SETFILEEXTENSIONS }; 17 | 18 | BEGIN_MSG_MAP(CFileExtensionsDlg) 19 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 20 | MESSAGE_HANDLER(WM_CLOSE, OnClose) 21 | COMMAND_ID_HANDLER(IDC_FE_OK, OnOK) 22 | COMMAND_ID_HANDLER(IDC_FE_CANCEL, OnCancelDialog) 23 | NOTIFY_HANDLER(IDC_LIST_FILES, LVN_ITEMCHANGED, OnListViewItemChanged) 24 | NOTIFY_HANDLER(IDC_LIST_FILES, LVN_KEYDOWN, OnListViewKeyDown) 25 | END_MSG_MAP() 26 | 27 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 28 | LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 29 | LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 30 | LRESULT OnCancelDialog(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 31 | LRESULT OnListViewItemChanged(WPARAM wParam, LPNMHDR lpnmhdr, BOOL& bHandled); 32 | LRESULT OnListViewKeyDown(WPARAM wParam, LPNMHDR lpnmhdr, BOOL& bHandled); 33 | 34 | CFileExtensionsDlg(); 35 | ~CFileExtensionsDlg(); 36 | 37 | private: 38 | CStatic m_lblMessage; 39 | CButton m_btnOk; 40 | CButton m_btnCancel; 41 | CListViewCtrl m_lvFileExtensions; 42 | bool m_bInOnListViewItemChanged; 43 | CFileExtensionsRegistry* m_pRegistry; 44 | 45 | void FillFileExtensionsList(); 46 | void InsertExtension(LPCTSTR sExtension, LPCTSTR sHint); 47 | void InsertExtensions(LPCTSTR sExtensionList, LPCTSTR sHint); 48 | }; 49 | -------------------------------------------------------------------------------- /src/JPEGView/FileOpenDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "FileOpenDialog.h" 3 | #include "NLS.h" 4 | #include "Helpers.h" 5 | #include "SettingsProvider.h" 6 | #include "MultiMonitorSupport.h" 7 | #include "dlgs.h" 8 | 9 | bool CFileOpenDialog::m_bSized = false; 10 | 11 | // Command code to set the thumbnail view on the file open dialog 12 | const unsigned int ODM_VIEW_THUMBS= 0x702d; 13 | 14 | CFileOpenDialog::CFileOpenDialog(HWND parentWindow, LPCTSTR sInitialFileName, LPCTSTR sFileEndings, bool bFullScreen) : 15 | CFileDialog(TRUE, _T("jpg"), sInitialFileName, 16 | OFN_EXPLORER | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, 17 | Helpers::CReplacePipe(CString(CNLS::GetString(_T("Images"))) + _T(" (") + sFileEndings + _T(")|") + sFileEndings + _T("|") + 18 | CNLS::GetString(_T("All Files")) + _T("|*.*|")), parentWindow) { 19 | m_bFullScreen = bFullScreen; 20 | } 21 | 22 | LRESULT CFileOpenDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 23 | if (!m_bSized) { 24 | HWND wndParent = this->GetParent(); 25 | // moving the window out of the visible range prevents flickering 26 | ::SetWindowPos(wndParent, 0, 20000, 20000, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOREDRAW); 27 | } 28 | 29 | // Will be processed after the dialog is really initialized 30 | ::PostMessage(m_hWnd, MYWM_POSTINIT, 0, 0); 31 | 32 | return 0; 33 | } 34 | 35 | LRESULT CFileOpenDialog::OnPostInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { 36 | HWND wndParent = this->GetParent(); // real dialog is parent of us 37 | 38 | SizeDialog(); 39 | 40 | // Get the shell window hosting the list view of the files and send a WM_COMMAND to it to 41 | // switch to thumbnail view 42 | // http://msdn.microsoft.com/msdnmag/issues/04/03/CQA/ 43 | HWND hLst2 = ::GetDlgItem(wndParent, lst2); 44 | if (hLst2 != NULL) { 45 | ::SendMessage(hLst2, WM_COMMAND, ODM_VIEW_THUMBS, 0); 46 | } 47 | return 0; 48 | } 49 | 50 | void CFileOpenDialog::SizeDialog() { 51 | if (!m_bSized || m_bFullScreen) { 52 | HWND wndParent = this->GetParent(); // real dialog is parent of us 53 | 54 | CSettingsProvider& sp = CSettingsProvider::This(); 55 | CRect monitorRect = CMultiMonitorSupport::GetMonitorRect(sp.DisplayMonitor()); 56 | int nScreenX = monitorRect.Width(); 57 | int nScreenY = monitorRect.Height(); 58 | int nSizeX = nScreenX*90/100; 59 | int nSizeY = nScreenY*90/100; 60 | ::MoveWindow(wndParent, monitorRect.left + (nScreenX - nSizeX) / 2, monitorRect.top + (nScreenY - nSizeY) / 2, 61 | nSizeX, nSizeY, TRUE); 62 | if (!m_bFullScreen) { 63 | m_bSized = true; 64 | } 65 | } 66 | } 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/JPEGView/FileOpenDialog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define MYWM_POSTINIT WM_USER+1 4 | 5 | class CFileOpenDialog : public CFileDialog 6 | { 7 | public: 8 | // The file extensions must be separated by pipe (|) 9 | CFileOpenDialog(HWND parentWindow, LPCTSTR sInitialFileName, LPCTSTR sFileEndings, bool bFullScreen); 10 | 11 | BEGIN_MSG_MAP(CFileOpenDialog) 12 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 13 | MESSAGE_HANDLER(MYWM_POSTINIT, OnPostInitDialog) 14 | END_MSG_MAP() 15 | 16 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 17 | LRESULT OnPostInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 18 | 19 | private: 20 | void SizeDialog(); 21 | 22 | bool m_bFullScreen; 23 | static bool m_bSized; 24 | }; 25 | -------------------------------------------------------------------------------- /src/JPEGView/HEIFWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "libheif/heif_cxx.h" 4 | 5 | class HeifReader 6 | { 7 | public: 8 | // Returns data in the form 4-byte BGRA 9 | static void * ReadImage(int &width, // width of the image loaded. 10 | int &height, // height of the image loaded. 11 | int &bpp, // BYTES (not bits) PER PIXEL. 12 | int &frame_count, // number of top-level images 13 | void* &exif_chunk, // Pointer to Exif data (must be freed by caller) 14 | bool &outOfMemory, // set to true when no memory to read image 15 | int frame_index, // index of requested frame 16 | const void *buffer, // memory address containing heic compressed data. 17 | int sizebytes); // size of heic compressed data. 18 | }; 19 | -------------------------------------------------------------------------------- /src/JPEGView/HashCompareLPCTSTR.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "HashCompareLPCTSTR.h" 3 | 4 | // the hash function (string hash) 5 | size_t CHashCompareLPCTSTR::operator( )(const LPCTSTR& Key) const { 6 | size_t nHash = 0; 7 | int nCnt = 0; 8 | while (Key[nCnt] != 0 && nCnt++ < 16) { 9 | nHash += Key[nCnt]; 10 | nHash = (nHash << 8) + nHash; 11 | } 12 | return nHash; 13 | } 14 | 15 | // compare function 16 | bool CHashCompareLPCTSTR::operator( )(const LPCTSTR& _Key1, const LPCTSTR& _Key2) const { 17 | return _tcscmp(_Key1, _Key2) < 0; 18 | } -------------------------------------------------------------------------------- /src/JPEGView/HashCompareLPCTSTR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // For usage in stdext::hash_map, hash and compare of type LPCTSTR 4 | class CHashCompareLPCTSTR 5 | { 6 | public: 7 | static const size_t bucket_size = 4; 8 | static const size_t min_buckets = 8; 9 | CHashCompareLPCTSTR() {} 10 | size_t operator( )(const LPCTSTR& Key) const; 11 | bool operator( )(const LPCTSTR& _Key1, const LPCTSTR& _Key2) const; 12 | }; -------------------------------------------------------------------------------- /src/JPEGView/HelpDisplay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Class to display the help screen (when F1 is pressed) 4 | class CHelpDisplay 5 | { 6 | public: 7 | // The paint DC is used to draw the help screen 8 | CHelpDisplay(CDC & dc); 9 | ~CHelpDisplay(); 10 | 11 | // Methods to create the help text lines 12 | void AddLine(LPCTSTR sLine); 13 | bool AddLine(LPCTSTR sKey, LPCTSTR sHelp); 14 | bool AddLineInfo(LPCTSTR sKey, LPCTSTR sInfo, LPCTSTR sHelp); 15 | bool AddLineInfo(LPCTSTR sKey, bool bInfo, LPCTSTR sHelp); 16 | 17 | // Call Show() to render the help screen on the given screen rectangle (it is centered there) 18 | void Show(); 19 | 20 | // Gets the size of the help screen 21 | CSize GetSize(); 22 | 23 | private: 24 | 25 | struct TextLine { 26 | TextLine(COLORREF color, COLORREF colorinfo, LPCTSTR key, LPCTSTR info, LPCTSTR help) { 27 | Color = color; 28 | ColorInfo = colorinfo; 29 | Key = key; 30 | Info = info; 31 | Help = help; 32 | } 33 | 34 | COLORREF Color; 35 | COLORREF ColorInfo; 36 | LPCTSTR Key; 37 | LPCTSTR Info; 38 | LPCTSTR Help; 39 | }; 40 | 41 | LPCTSTR CopyStr(LPCTSTR str); 42 | void AddTextLine(COLORREF color, COLORREF colorinfo, LPCTSTR key, LPCTSTR info, LPCTSTR help); 43 | 44 | float m_fScaling; 45 | int m_nTab1, m_nTab2; 46 | CDC & m_dc; 47 | std::list m_lines; 48 | int m_nSizeX; 49 | int m_nSizeY; 50 | int m_nIncY; 51 | TCHAR* m_pTextBuffStart; 52 | int m_nTextBuffIndex; 53 | }; 54 | -------------------------------------------------------------------------------- /src/JPEGView/HelpDisplayCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CMainDlg; 4 | class CHelpDisplay; 5 | class CImageProcessingParams; 6 | 7 | // Implements functionality of the help display panel 8 | // This is not a CPanelController because the help display is not a CPanel (not painted to offscreen bitmap) 9 | class CHelpDisplayCtl { 10 | public: 11 | CHelpDisplayCtl(CMainDlg* pMainDlg, CDC& dc, const CImageProcessingParams* pImageProcParams); 12 | virtual ~CHelpDisplayCtl(); 13 | 14 | CRect PanelRect() { return m_panelRect; } 15 | 16 | // Displays the help screen on the device context passed to the constructor 17 | void Show(); 18 | 19 | private: 20 | const CImageProcessingParams* m_pImageProcParams; 21 | CHelpDisplay* m_pHelpDisplay; 22 | CMainDlg* m_pMainDlg; 23 | CRect m_panelRect; 24 | CRect m_helpDisplayRect; 25 | 26 | void GenerateHelpDisplay(); 27 | CString _KeyDesc(int nCommandId); 28 | CString _KeyDesc(int nCommandId1, int nCommandId2); 29 | CString _KeyDesc(int nCommandId1, int nCommandId2, int nCommandId3, int nCommandId4); 30 | }; -------------------------------------------------------------------------------- /src/JPEGView/HelpDlg.h: -------------------------------------------------------------------------------- 1 | // Help dialog 2 | ///////////////////////////////////////////////////////////////////////////// 3 | 4 | #pragma once 5 | 6 | #include "resource.h" 7 | 8 | class CMainDlg; 9 | 10 | // Dialog to show help screen for JPEGView 11 | class CHelpDlg : public CDialogImpl, public CScrollImpl 12 | { 13 | public: 14 | 15 | enum { IDD = IDD_HELP }; 16 | 17 | BEGIN_MSG_MAP(CHelpDlg) 18 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 19 | MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) 20 | MESSAGE_HANDLER(WM_CLOSE, OnClose) 21 | MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl::OnVScroll) 22 | MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl::OnHScroll) 23 | MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl::OnMouseWheel) 24 | MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl::OnMouseHWheel) 25 | MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl::OnSettingChange) 26 | MESSAGE_HANDLER(WM_SIZE, CScrollImpl::OnSize) 27 | MESSAGE_HANDLER(WM_PAINT, CScrollImpl::OnPaint) 28 | MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) 29 | ALT_MSG_MAP(1) 30 | COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl::OnScrollUp) 31 | COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl::OnScrollDown) 32 | COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl::OnScrollPageUp) 33 | COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl::OnScrollPageDown) 34 | COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl::OnScrollTop) 35 | COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl::OnScrollBottom) 36 | COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl::OnScrollLeft) 37 | COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl::OnScrollRight) 38 | COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl::OnScrollPageLeft) 39 | COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl::OnScrollPageRight) 40 | COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl::OnScrollAllLeft) 41 | COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl::OnScrollAllRight) 42 | END_MSG_MAP() 43 | 44 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 45 | LRESULT OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 46 | LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 47 | LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/); 48 | 49 | void DoPaint(HDC hDC); 50 | 51 | bool IsDestroyed() { return m_isDestoyed; } 52 | void DestroyDialog(); 53 | 54 | CHelpDlg(CMainDlg* pOwner); 55 | ~CHelpDlg(); 56 | 57 | private: 58 | CMainDlg* m_pOwner; 59 | bool m_isDestoyed; 60 | }; 61 | -------------------------------------------------------------------------------- /src/JPEGView/ICCProfileTransform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ICCProfileTransform 4 | { 5 | public: 6 | enum PixelFormat { 7 | FORMAT_BGRA, 8 | FORMAT_RGBA, 9 | FORMAT_BGR, 10 | FORMAT_RGB, 11 | FORMAT_Lab, 12 | FORMAT_LabA, 13 | }; 14 | 15 | // Create a transform from given ICC Profile to standard sRGB color space. 16 | static void* CreateTransform( 17 | const void* profile, // pointer to ICC profile 18 | unsigned int size, // size of ICC profile in bytes 19 | PixelFormat format // format of input pixels 20 | ); 21 | 22 | // Apply color transform to image. Returns true on success, false otherwise. 23 | static bool DoTransform( 24 | void* transform, // ICCP transform 25 | const void* inputBuffer, // 4-byte BGRA or RGBA input depending on transform pixel format 26 | void* outputBuffer, // 4-byte BGRA output 27 | unsigned int width, // width of image in pixels 28 | unsigned int height, // height of image in pixels 29 | unsigned int stride=0 // number of bytes per row of pixels in the input, only needed if not equal to width * 4 30 | ); 31 | 32 | // Free memory associated with the given transform 33 | static void DeleteTransform(void* transform); 34 | 35 | static void* CreateLabTransform(PixelFormat format); 36 | 37 | private: 38 | static void* sRGBProfile; 39 | }; 40 | -------------------------------------------------------------------------------- /src/JPEGView/ImageProcPanelCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PanelController.h" 4 | 5 | class CImageProcessingPanel; 6 | class CImageProcessingParams; 7 | 8 | // Implements functionality of the image processing panel 9 | class CImageProcPanelCtl : public CPanelController 10 | { 11 | public: 12 | // The given image processing parameters are modified by this panel, the same applied to the given boolean values 13 | CImageProcPanelCtl(CMainDlg* pMainDlg, CImageProcessingParams* pParams, bool* pEnableLDC, bool* pEnableContrastCorr); 14 | virtual ~CImageProcPanelCtl(); 15 | 16 | virtual float DimFactor() { return 0.5f; } 17 | 18 | virtual bool IsVisible() { return m_bVisible && m_bEnabled && !m_pMainDlg->IsInSlideShowWithTransition() ; } 19 | virtual bool IsActive() { return m_bEnabled; } 20 | 21 | virtual void SetVisible(bool bVisible); 22 | virtual void SetActive(bool bActive) {} // not possible to set, determined by INI file only 23 | 24 | virtual void AfterNewImageLoaded(); 25 | 26 | virtual bool OnTimer(int nTimerId); 27 | virtual bool OnMouseMove(int nX, int nY); 28 | 29 | // Called by main dialog e.g. when saving or deleting parameter DB entry 30 | void ShowHideSaveDBButtons(); 31 | 32 | bool EnterRenameCurrentFile(); 33 | 34 | CRect GetUnsharpMaskButtonRect(); 35 | 36 | private: 37 | bool m_bEnabled; 38 | bool m_bVisible; 39 | int m_nOldMouseY; 40 | CImageProcessingPanel* m_pImageProcPanel; 41 | 42 | bool RenameCurrentFile(LPCTSTR sNewFileTitle); 43 | bool CanMakeVisible(); 44 | 45 | static void OnUnsharpMask(void* pContext, int nParameter, CButtonCtrl & sender); 46 | static bool OnRenameFile(void* pContext, CTextCtrl & sender, LPCTSTR sChangedText); 47 | }; -------------------------------------------------------------------------------- /src/JPEGView/ImageProcessingPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Panel.h" 4 | 5 | class CImageProcessingParams; 6 | 7 | // Manages a set of sliders and other controls to perform image processing tasks 8 | // This panel is placed on the bottom of the window 9 | class CImageProcessingPanel : public CPanel { 10 | public: 11 | // IDs of the controls on this panel 12 | enum { 13 | ID_slContrast, 14 | ID_slBrightness, 15 | ID_slSaturation, 16 | ID_slCR, 17 | ID_slMG, 18 | ID_slYB, 19 | ID_slLightenShadows, 20 | ID_slDarkenHighlights, 21 | ID_slDeepShadows, 22 | ID_slColorCorr, 23 | ID_slContrastCorr, 24 | ID_slSharpen, 25 | ID_btnUnsharpMask, 26 | ID_txtParamDB, 27 | ID_btnSaveTo, 28 | ID_btnRemoveFrom, 29 | ID_txtRename, 30 | ID_txtFilename, 31 | ID_txtAcqDate 32 | }; 33 | public: 34 | // The sliders are placed on the given window (at the bottom) 35 | CImageProcessingPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CImageProcessingParams* pParams, bool* pEnableLDC, bool* pEnableContrastCorr); 36 | 37 | CButtonCtrl* GetBtnUnsharpMask() { return GetControl(ID_btnUnsharpMask); } 38 | CButtonCtrl* GetBtnSaveTo() { return GetControl(ID_btnSaveTo); } 39 | CButtonCtrl* GetBtnRemoveFrom() { return GetControl(ID_btnRemoveFrom); } 40 | CTextCtrl* GetTextParamDB() { return GetControl(ID_txtParamDB); } 41 | CTextCtrl* GetTextRename() { return GetControl(ID_txtRename); } 42 | CTextCtrl* GetTextFilename() { return GetControl(ID_txtFilename); } 43 | CTextCtrl* GetTextAcqDate() { return GetControl(ID_txtAcqDate); } 44 | 45 | // height of slider area 46 | int SliderAreaHeight() const { return m_nTotalAreaHeight; } 47 | virtual CRect PanelRect(); 48 | 49 | // Request recalculation of the layout 50 | virtual void RequestRepositioning() { m_clientRect = CRect(0, 0, 0, 0); } 51 | 52 | // Updates the layout synchronously. Normally the layout is updated on painting. 53 | void UpdateLayout() { RepositionAll(); } 54 | 55 | protected: 56 | virtual void RepositionAll(); 57 | 58 | private: 59 | void AddSlider(int nID, LPCTSTR sName, double* pdValue, bool* pbEnable, 60 | double dMin, double dMax, double dDefaultValue, bool bAllowPreviewAndReset, bool bLogarithmic, bool bInvert); 61 | 62 | void DetermineSliderWidth(); 63 | 64 | int m_nSliderWidth; 65 | int m_nSliderHeight; 66 | int m_nNoLabelWidth; 67 | int m_nSliderGap; 68 | int m_nTotalAreaHeight; 69 | int m_nYStart; 70 | CRect m_clientRect; 71 | CRect m_sliderAreaRect; 72 | int m_nTotalSliders; 73 | }; -------------------------------------------------------------------------------- /src/JPEGView/ImageProcessingTypes.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | /// signed 8 bit integer value 5 | typedef signed char int8; 6 | /// unsigned 8 bit integer value 7 | typedef unsigned char uint8; 8 | /// signed 16 bit integer value 9 | typedef signed short int16; 10 | /// unsigned 16 bit integer value 11 | typedef unsigned short uint16; 12 | /// signed 32 bit integer value 13 | typedef signed int int32; 14 | /// unsigned 32 bit integer value 15 | typedef unsigned int uint32; 16 | 17 | enum EFilterType { 18 | Filter_Downsampling_Best_Quality, // prefer this filter for sampling down 19 | Filter_Downsampling_No_Aliasing, // this is a Lanczos type filter 20 | Filter_Downsampling_Narrow, // as Filter_Downsampling_Best_Quality but narrow support 21 | Filter_Upsampling_Bicubic 22 | }; 23 | 24 | enum EResizeFilter { 25 | Resize_PointFilter, // Point sampling 26 | Resize_NoAliasing, // Lanczos filter 27 | Resize_SharpenLow, // 3 tap downsampling filter with some sharpening 28 | Resize_SharpenMedium // 3 tap downsampling filter with medium sharpening 29 | }; 30 | 31 | // Image formats (can be other than JPEG...) 32 | enum EImageFormat { 33 | IF_JPEG, 34 | IF_WindowsBMP, 35 | IF_PNG, 36 | IF_GIF, 37 | IF_TIFF, 38 | IF_WEBP, 39 | IF_JXL, 40 | IF_HEIF, 41 | IF_AVIF, 42 | IF_QOI, 43 | IF_PSD, 44 | IF_WIC, 45 | IF_CLIPBOARD, 46 | IF_CameraRAW, 47 | IF_JPEG_Embedded, // JPEG embedded in another file, e.g. camera raw 48 | IF_TGA, 49 | IF_Unknown 50 | }; 51 | 52 | // Horizontal trapezoid 53 | /* 54 | (x1s, y1)----------(x1e, y1) 55 | \ / 56 | \ / 57 | (x2s, y2)-----(x2e, y2) 58 | */ 59 | class CTrapezoid { 60 | public: 61 | int x1s; 62 | int x1e; 63 | int y1; 64 | int x2s; 65 | int x2e; 66 | int y2; 67 | 68 | CTrapezoid() { 69 | x1s = x1e = x2s = x2e = y1 = y2 = 0; 70 | } 71 | 72 | // Horizontal trapezoid with vertices (x1s, y1), (x1e, y1), (x2s, y2), (x2e, y2) 73 | CTrapezoid(int x1s, int x1e, int y1, int x2s, int x2e, int y2) { 74 | this->x1s = min(x1s, x1e); 75 | this->x1e = max(x1s, x1e); 76 | this->y1 = min(y1, y2); 77 | this->x2s = min(x2s, x2e); 78 | this->x2e = max(x2s, x2e); 79 | this->y2 = max(y1, y2); 80 | } 81 | 82 | bool operator ==(const CTrapezoid& other) const { 83 | return x1s == other.x1s && x1e == other.x1e && x2s == other.x2s && x2e == other.x2e && y1 == other.y1 && y2 == other.y2; 84 | } 85 | 86 | bool operator !=(const CTrapezoid& other) const { 87 | return !(*this == other); 88 | } 89 | 90 | int Width() const { return max(x1e - x1s, x2e - x2s); } 91 | int Height() const { return y2 - y1; } 92 | }; -------------------------------------------------------------------------------- /src/JPEGView/InfoButtonPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "InfoButtonPanel.h" 3 | #include "ImageProcessingPanel.h" 4 | #include "Helpers.h" 5 | #include "SettingsProvider.h" 6 | #include "NLS.h" 7 | 8 | #define WNDBUTTON_PANEL_HEIGHT 24 9 | #define WNDBUTTON_BORDER 1 10 | 11 | ///////////////////////////////////////////////////////////////////////////////////////////// 12 | // CInfoButtonPanel 13 | ///////////////////////////////////////////////////////////////////////////////////////////// 14 | 15 | CInfoButtonPanel::CInfoButtonPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel) : CPanel(hWnd, pNotifyMouseCapture) { 16 | m_pImageProcPanel = pImageProcPanel; 17 | m_clientRect = CRect(0, 0, 0, 0); 18 | m_fDPIScale *= CSettingsProvider::This().ScaleFactorNavPanel(); 19 | m_nWidth = 0; 20 | m_nHeight = (int)(WNDBUTTON_PANEL_HEIGHT*m_fDPIScale); 21 | 22 | CButtonCtrl* pInfoBtn = AddUserPaintButton(ID_btnEXIFInfo, CNLS::GetString(_T("Display image (EXIF) information")), &PaintInfoBtn); 23 | pInfoBtn->SetExtendedActiveArea(CRect(-2, -2, 0, 0)); 24 | } 25 | 26 | CRect CInfoButtonPanel::PanelRect() { 27 | if (m_nWidth == 0) { 28 | int nButtonSize = m_nHeight - 4 * WNDBUTTON_BORDER; 29 | m_nWidth = 4 * WNDBUTTON_BORDER + ((int)m_controls.size() - 1) * WNDBUTTON_BORDER * 3 + (int)m_controls.size() * nButtonSize; 30 | } 31 | 32 | CRect sliderRect = m_pImageProcPanel->PanelRect(); 33 | m_clientRect = CRect(CPoint(sliderRect.left, 0), CSize(m_nWidth, m_nHeight)); 34 | return m_clientRect; 35 | } 36 | 37 | void CInfoButtonPanel::RequestRepositioning() { 38 | RepositionAll(); 39 | } 40 | 41 | void CInfoButtonPanel::RepositionAll() { 42 | m_clientRect = PanelRect(); 43 | int nButtonSize = m_nHeight - 4 * WNDBUTTON_BORDER; 44 | int nStartX = m_clientRect.left + WNDBUTTON_BORDER * 2; 45 | int nStartY = WNDBUTTON_BORDER * 2; 46 | ControlsIterator iter; 47 | for (iter = m_controls.begin( ); iter != m_controls.end( ); iter++ ) { 48 | CButtonCtrl* pButton = dynamic_cast(iter->second); 49 | if (pButton != NULL) { 50 | pButton->SetPosition(CRect(CPoint(nStartX, nStartY), CSize(nButtonSize, nButtonSize))); 51 | nStartX += nButtonSize + WNDBUTTON_BORDER * 3; 52 | } 53 | } 54 | } 55 | 56 | void CInfoButtonPanel::PaintInfoBtn(void* pContext, const CRect& rect, CDC& dc) { 57 | CFont font; 58 | font.CreatePointFont(min(rect.Width() * 6, 160), _T("Courier New"), dc, true, true); 59 | HFONT oldFont = dc.SelectFont(font); 60 | dc.DrawText(_T("i"), 1, (LPRECT)&rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOCLIP); 61 | dc.SelectFont(oldFont); 62 | } 63 | -------------------------------------------------------------------------------- /src/JPEGView/InfoButtonPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Panel.h" 4 | 5 | // Info button panel - panel with one info button shown top, left 6 | class CInfoButtonPanel : public CPanel { 7 | public: 8 | // IDs of the controls on this panel 9 | enum { 10 | ID_btnEXIFInfo 11 | }; 12 | public: 13 | // The panel is on the given window at top, left corner 14 | CInfoButtonPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel); 15 | 16 | CButtonCtrl* GetBtnInfo() { return GetControl(ID_btnEXIFInfo); } 17 | 18 | virtual CRect PanelRect(); 19 | int ButtonPanelHeight() { return m_nHeight; } 20 | virtual void RequestRepositioning(); 21 | 22 | protected: 23 | virtual void RepositionAll(); 24 | 25 | private: 26 | // Painting handlers for the buttons 27 | static void PaintInfoBtn(void* pContext, const CRect& rect, CDC& dc); 28 | 29 | CPanel* m_pImageProcPanel; 30 | CRect m_clientRect; 31 | int m_nWidth, m_nHeight; 32 | }; -------------------------------------------------------------------------------- /src/JPEGView/InfoButtonPanelCtl.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "resource.h" 3 | #include "MainDlg.h" 4 | #include "InfoButtonPanelCtl.h" 5 | #include "InfoButtonPanel.h" 6 | #include "EXIFDisplayCtl.h" 7 | 8 | CInfoButtonPanelCtl::CInfoButtonPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel) : CPanelController(pMainDlg, false) { 9 | m_bVisible = false; 10 | m_nOldMouseY = 0; 11 | m_pPanel = m_pInfoButtonPanel = new CInfoButtonPanel(pMainDlg->GetHWND(), this, pImageProcPanel); 12 | m_pInfoButtonPanel->GetBtnInfo()->SetButtonPressedHandler(&CMainDlg::OnExecuteCommand, pMainDlg, IDM_SHOW_FILEINFO); 13 | } 14 | 15 | CInfoButtonPanelCtl::~CInfoButtonPanelCtl() { 16 | delete m_pInfoButtonPanel; 17 | m_pInfoButtonPanel = NULL; 18 | } 19 | 20 | bool CInfoButtonPanelCtl::IsVisible() { 21 | return m_bVisible && m_pMainDlg->IsFullScreenMode() && !m_pMainDlg->GetEXIFDisplayCtl()->IsActive(); 22 | } 23 | 24 | void CInfoButtonPanelCtl::SetVisible(bool bVisible) { 25 | if (m_bVisible != bVisible) { 26 | m_bVisible = bVisible; 27 | InvalidateMainDlg(); 28 | } 29 | } 30 | 31 | bool CInfoButtonPanelCtl::OnMouseMove(int nX, int nY) { 32 | if (!m_pMainDlg->IsFullScreenMode()) { 33 | return false; 34 | } 35 | bool bHandled = CPanelController::OnMouseMove(nX, nY); 36 | if (!bHandled) { 37 | if (!m_bVisible) { 38 | int nWndBtnAreaStart = m_pInfoButtonPanel->ButtonPanelHeight(); 39 | if (m_nOldMouseY != 0 && m_nOldMouseY > nWndBtnAreaStart && nY <= nWndBtnAreaStart) { 40 | m_bVisible = true; 41 | m_pMainDlg->InvalidateRect(m_pInfoButtonPanel->PanelRect(), FALSE); 42 | } 43 | } else { 44 | if (nY > m_pInfoButtonPanel->ButtonPanelHeight()*2) { 45 | m_bVisible = false; 46 | m_pMainDlg->InvalidateRect(m_pInfoButtonPanel->PanelRect(), FALSE); 47 | m_pInfoButtonPanel->GetTooltipMgr().RemoveActiveTooltip(); 48 | } 49 | } 50 | } 51 | m_nOldMouseY = nY; 52 | return bHandled; 53 | } 54 | 55 | bool CInfoButtonPanelCtl::IsPointInInfoButtonPanel(CPoint pt) { 56 | if (IsVisible()) { 57 | return PanelRect().PtInRect(pt); 58 | } 59 | return false; 60 | } 61 | -------------------------------------------------------------------------------- /src/JPEGView/InfoButtonPanelCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PanelController.h" 4 | 5 | class CInfoButtonPanel; 6 | 7 | // Implements functionality of the info button panel (info button on top, left corner of screen) 8 | class CInfoButtonPanelCtl : public CPanelController 9 | { 10 | public: 11 | CInfoButtonPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel); 12 | virtual ~CInfoButtonPanelCtl(); 13 | 14 | virtual float DimFactor() { return 0.1f; } 15 | 16 | virtual bool IsVisible(); 17 | virtual bool IsActive() { return true; } 18 | 19 | virtual void SetVisible(bool bVisible); 20 | virtual void SetActive(bool bActive) {} // always active 21 | 22 | virtual bool OnMouseMove(int nX, int nY); 23 | 24 | // Gets if the given point is in the panel rectangle. When the panel is not visible, false is returned. 25 | bool IsPointInInfoButtonPanel(CPoint pt); 26 | 27 | private: 28 | bool m_bVisible; 29 | int m_nOldMouseY; 30 | CInfoButtonPanel* m_pInfoButtonPanel; 31 | }; -------------------------------------------------------------------------------- /src/JPEGView/JPEGLosslessTransform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Class that performs lossless JPEG transformations using the TJPEG library 4 | class CJPEGLosslessTransform 5 | { 6 | 7 | public: 8 | 9 | // Results of the lossless transformation 10 | enum EResult { 11 | Success, 12 | ReadFileFailed, 13 | WriteFileFailed, 14 | TransformationFailed 15 | }; 16 | 17 | // Lossless transformations 18 | enum ETransformation { 19 | Rotate90, 20 | Rotate180, 21 | Rotate270, 22 | MirrorH, 23 | MirrorV 24 | }; 25 | 26 | // Performs a lossless JPEG transformation, transforming the input file and writing the result to the output file. 27 | // Input and output file can be identical, then the input file is overwritten by the resulting output file. 28 | static EResult PerformTransformation(LPCTSTR sInputFile, LPCTSTR sOutputFile, ETransformation transformation, bool bAllowTrim); 29 | 30 | // Performs a lossless JPEG crop, using the input file and writing the result to the output file. 31 | // Input and output file can be identical, then the input file is overwritten by the resulting output file. 32 | static EResult PerformCrop(LPCTSTR sInputFile, LPCTSTR sOutputFile, const CRect& cropRect); 33 | }; -------------------------------------------------------------------------------- /src/JPEGView/JXLWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | class JxlReader 7 | { 8 | public: 9 | // Returns data in 4 byte BGRA 10 | static void* ReadImage(int& width, // width of the image loaded. 11 | int& height, // height of the image loaded. 12 | int& bpp, // BYTES (not bits) PER PIXEL. 13 | bool& has_animation, // if the image is animated 14 | int& frame_count, // number of frames 15 | int& frame_time, // frame duration in milliseconds 16 | void*& exif, // Pointer to Exif data (must be freed by caller) 17 | bool& outOfMemory, // set to true when no memory to read image 18 | const void* buffer, // memory address containing jxl compressed data. 19 | int sizebytes); // size of jxl compressed data 20 | 21 | static void DeleteCache(); 22 | 23 | private: 24 | struct jxl_cache; 25 | static jxl_cache cache; 26 | static bool DecodeJpegXlOneShot(const uint8_t* jxl, size_t size, std::vector* pixels, int& xsize, 27 | int& ysize, bool& have_animation, int& frame_count, int& frame_time, std::vector* icc_profile, bool& outOfMemory); 28 | }; 29 | -------------------------------------------------------------------------------- /src/JPEGView/KeyMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define VK_LBUTTONDBLCLK 7 6 | 7 | // KeyMap 8 | class CKeyMap 9 | { 10 | public: 11 | // Reads the keymap file with logic for loading from different locations, including the default 12 | CKeyMap(); 13 | 14 | // Gets a command Id for a keycode and modifier keys. Returns -1 if no command available for this key. 15 | int GetCommandIdForKey(int nVirtualKeyCode, bool bAlt, bool bCtrl, bool bShift); 16 | 17 | // Gets the string describing the keyboard shortcut for a given command, empty string if none 18 | CString GetKeyStringForCommand(int nCommandId); 19 | 20 | // Returns the virtual key code for a key name of the form 'Alt+A'. 21 | // Returns -1 if key name not valid 22 | static int GetVirtualKeyCode(LPCTSTR keyName); 23 | 24 | // gets a combined key code 25 | static int GetCombinedKeyCode(int keyCode, bool alt, bool control, bool shift); 26 | 27 | // gets the shortcut key name, e.g. 'Ctrl+P' 28 | static CString GetShortcutKey(int combinedKeyCode); 29 | private: 30 | 31 | // key is the key code, value the command ID 32 | stdext::hash_map m_keyMap; 33 | 34 | void AddDefaultEscapeHandling(); 35 | }; 36 | -------------------------------------------------------------------------------- /src/JPEGView/MaxImageDef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Sizes are in bytes 4 | 5 | #ifdef _WIN64 6 | const unsigned int MAX_JPEG_FILE_SIZE = 1024 * 1024 * 300; 7 | #else 8 | const unsigned int MAX_JPEG_FILE_SIZE = 1024 * 1024 * 50; 9 | #endif 10 | 11 | #ifdef _WIN64 12 | const unsigned int MAX_PNG_FILE_SIZE = 1024 * 1024 * 300; 13 | #else 14 | const unsigned int MAX_PNG_FILE_SIZE = 1024 * 1024 * 50; 15 | #endif 16 | 17 | #ifdef _WIN64 18 | const unsigned int MAX_WEBP_FILE_SIZE = 1024 * 1024 * 150; 19 | #else 20 | const unsigned int MAX_WEBP_FILE_SIZE = 1024 * 1024 * 50; 21 | #endif 22 | 23 | #ifdef _WIN64 24 | const unsigned int MAX_JXL_FILE_SIZE = 1024 * 1024 * 150; 25 | #else 26 | const unsigned int MAX_JXL_FILE_SIZE = 1024 * 1024 * 50; 27 | #endif 28 | 29 | #ifdef _WIN64 30 | const unsigned int MAX_HEIF_FILE_SIZE = 1024 * 1024 * 150; 31 | #else 32 | const unsigned int MAX_HEIF_FILE_SIZE = 1024 * 1024 * 50; 33 | #endif 34 | 35 | #ifdef _WIN64 36 | const unsigned int MAX_PSD_FILE_SIZE = 1024 * 1024 * 500; 37 | #else 38 | const unsigned int MAX_PSD_FILE_SIZE = 1024 * 1024 * 100; 39 | #endif 40 | 41 | #ifdef _WIN64 42 | const unsigned int MAX_BMP_FILE_SIZE = 1024 * 1024 * 500; 43 | #else 44 | const unsigned int MAX_BMP_FILE_SIZE = 1024 * 1024 * 100; 45 | #endif 46 | 47 | // this may be an artificial limitation and might make configurable, or ignore custom setting only for win32 48 | #ifdef _WIN64 49 | const unsigned int MAX_IMAGE_PIXELS = 65535 * 65535; 50 | #else 51 | const unsigned int MAX_IMAGE_PIXELS = 1024 * 1024 * 100; 52 | #endif 53 | 54 | // That must not be bigger than 65535 due to internal limitations 55 | // 56 | // unbounding (>65535) this causes crashes if HighQualityResampling=true 57 | // but if it's false, some images load (so far png tested was corrupted) 58 | const unsigned int MAX_IMAGE_DIMENSION = 65535; -------------------------------------------------------------------------------- /src/JPEGView/MessageDef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Message posted when image (of any format, not only JPEG) has finished loading. 4 | // LPARAM is the request handle to retrieve the image 5 | #define WM_IMAGE_LOAD_COMPLETED (WM_APP + 6) 6 | 7 | // Message posted when the currently shown imae has been changed on disk and needs to be reloaded 8 | #define WM_DISPLAYED_FILE_CHANGED_ON_DISK (WM_APP + 7) 9 | 10 | // Message posted when the files in the current directory have been added or removed and thus the 11 | // list of images in the directory needs to be reloaded 12 | #define WM_ACTIVE_DIRECTORY_FILELIST_CHANGED (WM_APP + 8) 13 | 14 | // Posted to main dialog for asynchronously loading the image with file name CMainDlg::m_sStartupFile 15 | #define WM_LOAD_FILE_ASYNCH (WM_APP + 24) 16 | 17 | #define KEY_MAGIC 2978465 -------------------------------------------------------------------------------- /src/JPEGView/MultiMonitorSupport.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Support for multiple-monitor systems 4 | class CMultiMonitorSupport 5 | { 6 | public: 7 | // returns true if the system is a multi monitor system 8 | static bool IsMultiMonitorSystem(); 9 | 10 | // virtual desktop (spanning all monitors) 11 | static CRect GetVirtualDesktop(); 12 | 13 | // Display rectangle of the monitor, use -1 for largest monitor, 0 for primary monitor or 14 | // 1 to n for the secondary or other monitors 15 | static CRect GetMonitorRect(int nIndex); 16 | 17 | // Display rectangle of monitor the main part of the given window is shown on 18 | static CRect GetMonitorRect(HWND hWnd); 19 | 20 | // Gets the working rectangle (monitor rectangle excluding taskbar) of the monitor the given window is displayed on 21 | static CRect GetWorkingRect(HWND hWnd); 22 | 23 | // Gets the default window rectangle for windowed mode 24 | static CRect GetDefaultWindowRect(); 25 | 26 | // Sets the default window rectangle for windowed mode 27 | static void SetDefaultWindowRect(CRect rect); 28 | 29 | // Gets the default client rectangle for windowed mode 30 | static CRect GetDefaultClientRectInWindowMode(bool bAutoFitWndToImage); 31 | 32 | private: 33 | CMultiMonitorSupport(void); 34 | }; 35 | -------------------------------------------------------------------------------- /src/JPEGView/NLS.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HashCompareLPCTSTR.h" 4 | #include 5 | 6 | using namespace stdext; 7 | 8 | // Supports translation of texts from English to a target language using text files 9 | // with (key, value) pairs and English text as key and translated text as value. 10 | class CNLS 11 | { 12 | public: 13 | // Gets a localized name of a file located in the EXE folder with given prefix and extension, 14 | // e.g. GetLocalizedFileName("", "readme", "html", "ru") returns "readme_ru.html" 15 | static CString GetLocalizedFileName(LPCTSTR sPath, LPCTSTR sPrefixName, LPCTSTR sExtension, LPCTSTR sLanguageCode); 16 | 17 | // Gets the file name of the string table to use for the given ISO 639 language code 18 | static CString GetStringTableFileName(LPCTSTR sLanguageCode); 19 | 20 | // Reads the string table mapping strings from English to target language 21 | static void ReadStringTable(LPCTSTR sFileName); 22 | 23 | // Translates a string, key is the English string, output the translated string 24 | static LPCTSTR GetString(LPCTSTR sString); 25 | 26 | private: 27 | CNLS(void); 28 | ~CNLS(void); 29 | 30 | static stdext::hash_map sm_texts; 31 | static bool sm_bTableRead; 32 | }; 33 | -------------------------------------------------------------------------------- /src/JPEGView/PNGWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class PngReader 5 | { 6 | public: 7 | #ifndef WINXP 8 | // Returns data in 4 byte BGRA 9 | static void* ReadImage(int& width, // width of the image loaded. 10 | int& height, // height of the image loaded. 11 | int& bpp, // BYTES (not bits) PER PIXEL. 12 | bool& has_animation, // if the image is animated 13 | int& frame_count, // number of frames 14 | int& frame_time, // frame duration in milliseconds 15 | void*& exif_chunk, // Pointer to Exif data (must be freed by caller) 16 | bool& outOfMemory, // set to true when no memory to read image 17 | void* buffer, // memory address containing png compressed data. 18 | size_t sizebytes); // size of png compressed data 19 | 20 | static void DeleteCache(); 21 | 22 | // Returns true if PNG is unsupported by GDI+ 23 | static bool MustUseLibpng(const void* buffer, size_t sizebytes); 24 | #endif 25 | // Get EXIF Block 26 | static void* GetEXIFBlock(void* buffer, size_t sizebytes); 27 | 28 | #ifndef WINXP 29 | private: 30 | struct png_cache; 31 | static png_cache cache; 32 | static bool BeginReading(void* buffer, size_t sizebytes, bool& outOfMemory); 33 | static void* ReadNextFrame(void** exif_chunk, unsigned int* exif_size); 34 | static void DeleteCacheInternal(bool free_buffer); 35 | #endif 36 | }; 37 | -------------------------------------------------------------------------------- /src/JPEGView/PSDWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JPEGImage.h" 4 | 5 | class PsdReader 6 | { 7 | public: 8 | // Returns image from PSD file 9 | static CJPEGImage* ReadImage(LPCTSTR strFileName, bool& bOutOfMemory); 10 | 11 | // Returns embedded JPEG thumbnail from PSD file 12 | static CJPEGImage* ReadThumb(LPCTSTR strFileName, bool& bOutOfMemory); 13 | 14 | private: 15 | enum ColorMode { 16 | MODE_Bitmap = 0, 17 | MODE_Grayscale = 1, 18 | MODE_Indexed = 2, 19 | MODE_RGB = 3, 20 | MODE_CMYK = 4, 21 | MODE_Multichannel = 7, 22 | MODE_Duotone = 8, 23 | MODE_Lab = 9, 24 | }; 25 | 26 | enum CompressionMode { 27 | COMPRESSION_None = 0, 28 | COMPRESSION_RLE = 1, 29 | COMPRESSION_ZipWithoutPrediction = 2, 30 | COMPRESSION_ZipWithPrediction = 3, 31 | }; 32 | }; 33 | -------------------------------------------------------------------------------- /src/JPEGView/PaintMemDCMgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // forward declarations 4 | class CPanel; 5 | 6 | #define MAX_REGIONS_CPaintMemDCMgr 16 7 | 8 | // Helps painting a panel into a memory DC and then blitting it to the screen. 9 | // This eliminates flickering. 10 | class CPaintMemDCMgr { 11 | public: 12 | CPaintMemDCMgr(CPaintDC& paintDC); 13 | ~CPaintMemDCMgr(); 14 | 15 | CPaintDC& GetPaintDC() { return m_paintDC; } 16 | 17 | // Excludes, respectively includes the given list of rectangles into the clipping region 18 | static void ExcludeFromClippingRegion(CDC & paintDC, const std::list& listExcludedRects); 19 | static void IncludeIntoClippingRegion(CDC & paintDC, const std::list& listExcludedRects); 20 | 21 | // Prepares a memory DC of given size by creating the backing store bitmap and clearing it 22 | static HBITMAP PrepareRectForMemDCPainting(CDC & memDC, CDC & paintDC, const CRect& rect); 23 | 24 | // Blits the DIB data section to target DC using dimming (blending with a black bitmap) 25 | static void BitBltBlended(CDC & dc, CDC & paintDC, const CSize& dcSize, void* pDIBData, BITMAPINFO* pbmInfo, 26 | const CPoint& dibStart, const CSize& dibSize, float fDimFactor); 27 | 28 | // Blits the DIB data section to target DC using blending with painted version of given panel 29 | static void CPaintMemDCMgr::BitBltBlended(CDC & dc, CDC & paintDC, const CSize& dcSize, void* pDIBData, BITMAPINFO* pbmInfo, 30 | const CPoint& dibStart, const CSize& dibSize, CPanel& panel, const CPoint& offsetPanel, 31 | float fBlendFactor); 32 | 33 | CRect CreatePanelRegion(CPanel* pPanel, float fDimFactor, bool bBlendPanel); 34 | 35 | void BlitImageToMemDC(void* pDIBData, BITMAPINFO* pBitmapInfo, CPoint destination, float fBlendFactor); 36 | 37 | void PaintMemDCToScreen(); 38 | private: 39 | 40 | struct CManagedRegion { 41 | public: 42 | CPanel* DisplayRegion; 43 | float DimFactor; 44 | bool Blend; 45 | CDC MemoryDC; 46 | HBITMAP OffscreenBitmap; 47 | CRect DisplayRect; 48 | }; 49 | 50 | CPaintDC& m_paintDC; 51 | int m_nNumElems; 52 | CManagedRegion m_managedRegions[MAX_REGIONS_CPaintMemDCMgr]; 53 | }; -------------------------------------------------------------------------------- /src/JPEGView/PanelController.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "PanelController.h" 3 | #include "resource.h" 4 | #include "MainDlg.h" 5 | #include "PanelMgr.h" 6 | 7 | CPanelController::CPanelController(CMainDlg* pMainDlg, bool bIsModal) { 8 | m_pMainDlg = pMainDlg; 9 | m_bIsModal = bIsModal; 10 | m_pPanel = NULL; 11 | } 12 | 13 | void CPanelController::MouseCapturedOrReleased(bool bCaptured, CUICtrl* pCtrl) { 14 | m_pMainDlg->GetPanelMgr()->SetCapturedPanelController(bCaptured ? this : NULL); 15 | } 16 | 17 | bool CPanelController::OnMouseLButton(EMouseEvent eMouseEvent, int nX, int nY) { 18 | return m_pPanel->OnMouseLButton(eMouseEvent, nX, nY); 19 | } 20 | 21 | bool CPanelController::OnMouseMove(int nX, int nY) { 22 | return m_pPanel->OnMouseMove(nX, nY); 23 | } 24 | 25 | bool CPanelController::MouseCursorCaptured() { 26 | return m_pPanel->MouseCursorCaptured(); 27 | } 28 | 29 | void CPanelController::OnPaintPanel(CDC & dc, const CPoint& offset) { 30 | m_pPanel->OnPaint(dc, offset); 31 | } 32 | 33 | void CPanelController::InvalidateMainDlg() { 34 | m_pMainDlg->Invalidate(); 35 | } 36 | 37 | CJPEGImage* CPanelController::CurrentImage() { 38 | return m_pMainDlg->GetCurrentImage(); 39 | } -------------------------------------------------------------------------------- /src/JPEGView/PanelMgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PanelController.h" 4 | 5 | class CPaintMemDCMgr; 6 | 7 | // Manages the panel controllers and panels. Note that deleting the panel manager deletes all managed panels. 8 | class CPanelMgr 9 | { 10 | public: 11 | CPanelMgr(); 12 | ~CPanelMgr(); 13 | 14 | // All managed panels must be added with this method 15 | void AddPanelController(CPanelController* pPanelController); 16 | 17 | // Is current a modal panel visible? 18 | bool IsModalPanelShown() const; 19 | 20 | // Cancels an open modal panel if one is open 21 | void CancelModalPanel(); 22 | 23 | // The captured panel controller gets the mouse events first 24 | void SetCapturedPanelController(CPanelController* pPanelController) { m_pCapturedPanelController = pPanelController; } 25 | 26 | // Prepares the given memory DC manager for offscreen painting of all managed panels. The panel areas are added 27 | // to the given list of exclusion rectangles (to exclude from clipping region) 28 | void PrepareMemDCMgr(CPaintMemDCMgr& memDCMgr, std::list& listExcludedRects); 29 | 30 | // Called by main dialog -> routed to managed panels 31 | void AfterNewImageLoaded(); 32 | void AfterImageRenamed(); 33 | 34 | // Called by main dialog -> events routed to managed panels 35 | // Returning bool means that a panel has consumed the event 36 | bool OnMouseLButton(EMouseEvent eMouseEvent, int nX, int nY); 37 | bool OnMouseMove(int nX, int nY); 38 | bool MouseCursorCaptured(); 39 | bool OnKeyDown(unsigned int nVirtualKey, bool bShift, bool bAlt, bool bCtrl); 40 | bool OnTimer(int nTimerId); 41 | void PaintPanels(CDC & dc, const CPoint& offset); 42 | void OnPrePaint(HDC hPaintDC); 43 | void OnPostPaint(HDC hPaintDC); 44 | 45 | private: 46 | std::list m_panelControllers; 47 | CPanelController* m_pCapturedPanelController; 48 | }; -------------------------------------------------------------------------------- /src/JPEGView/PrintImage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ProcessParams.h" 4 | 5 | class CJPEGImage; 6 | class CPrintParameters; 7 | 8 | // Allows printing an image. Keep the instance of this class between multiple print jobs to retain 9 | // the user-entered data between the print jobs. 10 | class CPrintImage 11 | { 12 | public: 13 | // Default margin and print width is in centimeters 14 | CPrintImage(double defaultMargin, double defaultPrintWidth) { 15 | m_defaultMargin = defaultMargin; 16 | m_defaultPrintWidth = defaultPrintWidth; 17 | m_pPrinterSelectionDlg = NULL; 18 | m_pPrintParameters = NULL; 19 | } 20 | 21 | // Shows the print dialog and prints the specified image if the user confirms to print. 22 | // Returns if the image was successfully printed. 23 | bool Print(HWND hWnd, CJPEGImage * pImage, const CImageProcessingParams& procParams, 24 | EProcessingFlags eFlags, LPCTSTR fileName); 25 | 26 | // Clears the user offsets for printing, called when changing the image 27 | void ClearOffsets(); 28 | 29 | private: 30 | CPrintDialogEx* m_pPrinterSelectionDlg; 31 | CPrintParameters* m_pPrintParameters; 32 | double m_defaultMargin; 33 | double m_defaultPrintWidth; 34 | 35 | bool DoPrint(HDC hPrinterDC, CPrintParameters* pPrintParameters, CJPEGImage * pImage, const CImageProcessingParams& procParams, 36 | EProcessingFlags eFlags, LPCTSTR fileName); 37 | 38 | }; -------------------------------------------------------------------------------- /src/JPEGView/PrintParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Parameters entered by user for printing and stored between calls to the printing dialog 4 | class CPrintParameters { 5 | public: 6 | enum HorizontalAlignment { 7 | HA_Left, 8 | HA_Center, 9 | HA_Right 10 | }; 11 | 12 | enum VerticalAlignment { 13 | VA_Top, 14 | VA_Center, 15 | VA_Bottom 16 | }; 17 | 18 | bool FitToPaper; 19 | bool FillWithCrop; 20 | bool ScaleByPrinterDriver; 21 | double PrintWidth; // in 1/10 mm. Print height is given by aspect ratio of image 22 | double MarginLeft, MarginTop, MarginRight, MarginBottom; // in 1/10 mm 23 | double OffsetX, OffsetY; // in 1/10 mm 24 | HorizontalAlignment AlignmentX; 25 | VerticalAlignment AlignmentY; 26 | 27 | // Uses default parameters 28 | CPrintParameters(double defaultMarginCm, double defaultPrintWidthCm) { 29 | FitToPaper = defaultPrintWidthCm < 0.0; 30 | FillWithCrop = false; 31 | ScaleByPrinterDriver = true; 32 | PrintWidth = abs(defaultPrintWidthCm) * 100; 33 | MarginLeft = defaultMarginCm * 100; 34 | MarginTop = defaultMarginCm * 100; 35 | MarginRight = defaultMarginCm * 100; 36 | MarginBottom = defaultMarginCm * 100; 37 | OffsetX = OffsetY = 0; 38 | AlignmentX = HA_Center; 39 | AlignmentY = VA_Top; 40 | } 41 | }; -------------------------------------------------------------------------------- /src/JPEGView/ProcessingThreadPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "WorkThread.h" 4 | 5 | class CProcessingThread; 6 | 7 | // Request for performing an image processing operation parallel on all thread pool threads 8 | class CProcessingRequest : public CRequestBase { 9 | public: 10 | CProcessingRequest(const void* pSourcePixels, CSize sourceSize, void* pTargetPixels, 11 | CSize fullTargetSize, CPoint fullTargetOffset, CSize clippedTargetSize) : CRequestBase(NULL) { 12 | SourcePixels = pSourcePixels; 13 | SourceSize = sourceSize; 14 | TargetPixels = pTargetPixels; 15 | FullTargetSize = fullTargetSize; 16 | FullTargetOffset = fullTargetOffset; 17 | ClippedTargetSize = clippedTargetSize; 18 | StripPadding = 8; 19 | Success = true; 20 | } 21 | 22 | // Process one strip of the image, starting at row offsetY and having the specified y-size 23 | virtual bool ProcessStrip(int offsetY, int sizeY) = 0; 24 | 25 | // Geometrical parameters and pixels of the image to be processed. 26 | // This is the full size image, ProcessStrip() passes the strip to be processed. 27 | CSize SourceSize; 28 | const void* SourcePixels; 29 | void* TargetPixels; 30 | CSize FullTargetSize; 31 | CPoint FullTargetOffset; 32 | CSize ClippedTargetSize; 33 | int StripPadding; // Height of strip is padded to multiple of this 34 | 35 | // Processing thread can signal failure by setting this flag to false. Must not be set to true by processing threads! 36 | bool Success; 37 | }; 38 | 39 | // Thread pool for executing processing requests on multiple threads in parallel, processing a strip 40 | // of the image on each thread. 41 | class CProcessingThreadPool { 42 | public: 43 | // Singleton instance 44 | static CProcessingThreadPool& This(); 45 | // Creation is not thread safe. Call once, before creating additional threads. 46 | void CreateThreadPoolThreads(); 47 | // to be called at program termination 48 | void StopAllThreads(); 49 | 50 | // Processes the request using all thread pool threads and the current thread. 51 | // Note that the method does NOT take ownership of the passed request object. 52 | // The processing work is distributed to the thread pool threads. The pRequest->ProcessStrip() 53 | // method is called to process a strip of the image. 54 | bool Process(CProcessingRequest* pRequest); 55 | private: 56 | static CProcessingThreadPool* sm_instance; 57 | 58 | CProcessingThread** m_threads; 59 | int m_nNumThreads; 60 | 61 | CProcessingThreadPool(void); 62 | }; 63 | 64 | -------------------------------------------------------------------------------- /src/JPEGView/QOIWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class QoiReaderWriter 4 | { 5 | public: 6 | // Returns data in 3-byte BGR (padded to 4-byte boundary) or 4-byte BGRA 7 | static void* ReadImage(int& width, // width of the image loaded. 8 | int& height, // height of the image loaded. 9 | int& bpp, // BYTES (not bits) PER PIXEL. 10 | bool& outOfMemory, // set to true when no memory to read image 11 | const void* buffer, // memory address containing qoi compressed data. 12 | int sizebytes); // size of qoi compressed data. 13 | 14 | // Compress image data into QOI stream, returns compressed data. 15 | static void* Compress(const void* buffer, // address of image in memory, format must be 3 bytes per pixel BRGBGR with padding to 4 byte boundary 16 | int width, // width of image in pixels 17 | int height, // height of image in pixels. 18 | int& len); // returns length of compressed data 19 | 20 | static void FreeMemory(void* pointer); 21 | }; 22 | -------------------------------------------------------------------------------- /src/JPEGView/RAWWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "JPEGImage.h" 4 | 5 | class RawReader 6 | { 7 | public: 8 | static CJPEGImage* ReadImage(LPCTSTR strFileName, bool& bOutOfMemory, bool bGetThumb); 9 | }; 10 | -------------------------------------------------------------------------------- /src/JPEGView/ReaderBMP.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CJPEGImage; 4 | 5 | // Simple reader for windows bitmap files (.bmp) 6 | class CReaderBMP 7 | { 8 | public: 9 | // Returns NULL in case of errors 10 | static CJPEGImage* ReadBmpImage(LPCTSTR strFileName, bool& bOutOfMemory); 11 | private: 12 | CReaderBMP(void); 13 | }; 14 | -------------------------------------------------------------------------------- /src/JPEGView/ReaderTGA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CJPEGImage; 4 | 5 | // Simple reader for .tga files 6 | class CReaderTGA 7 | { 8 | public: 9 | // Returns NULL in case of errors. backgroundColor is used for blending transparent parts of the image. 10 | static CJPEGImage* ReadTgaImage(LPCTSTR strFileName, COLORREF backgroundColor, bool& bOutOfMemory); 11 | private: 12 | CReaderTGA(void); 13 | }; 14 | -------------------------------------------------------------------------------- /src/JPEGView/ResizeDlg.h: -------------------------------------------------------------------------------- 1 | // Change size of image dialog 2 | ///////////////////////////////////////////////////////////////////////////// 3 | 4 | #pragma once 5 | 6 | #include "resource.h" 7 | #include "ImageProcessingTypes.h" 8 | 9 | // Allows to change image size, i.e. resample the image. 10 | class CResizeDlg : public CDialogImpl 11 | { 12 | public: 13 | enum { IDD = IDD_RESIZE }; 14 | 15 | BEGIN_MSG_MAP(CResizeDlg) 16 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 17 | COMMAND_ID_HANDLER(IDOK, OnResizeAndClose) 18 | COMMAND_ID_HANDLER(IDCANCEL, OnCancel) 19 | COMMAND_HANDLER(IDC_RS_ED_PERCENTS, EN_CHANGE, OnPercentChanged) 20 | COMMAND_HANDLER(IDC_RS_ED_WIDTH, EN_CHANGE, OnWidthChanged) 21 | COMMAND_HANDLER(IDC_RS_ED_HEIGHT, EN_CHANGE, OnHeightChanged) 22 | END_MSG_MAP() 23 | 24 | LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/); 25 | LRESULT OnResizeAndClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 26 | LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 27 | LRESULT OnPercentChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 28 | LRESULT OnWidthChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 29 | LRESULT OnHeightChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/); 30 | 31 | CResizeDlg(CSize originalSize); 32 | ~CResizeDlg(void); 33 | 34 | // only valid when dialog confirmed with OK 35 | CSize GetNewSize() { return m_newSize; } 36 | 37 | EResizeFilter GetFilter() { return m_eFilter; } 38 | 39 | private: 40 | CButton m_btnOk; 41 | CButton m_btnCancel; 42 | CStatic m_lblPercents; 43 | CStatic m_lblWidth; 44 | CStatic m_lblHeight; 45 | CStatic m_lblFilter; 46 | CStatic m_lblPixel; 47 | CStatic m_lblPixel2; 48 | CEdit m_edtPercents; 49 | CEdit m_edtWidth; 50 | CEdit m_edtHeight; 51 | CComboBox m_cbFilter; 52 | 53 | CSize m_originalSize; 54 | CSize m_newSize; 55 | EResizeFilter m_eFilter; 56 | bool m_blockUpdate; 57 | double m_dLastPercent; 58 | 59 | static double sm_dPercents; 60 | static int sm_nSelectedFilter; 61 | 62 | void Close(); 63 | int ConvertToNumber(CEdit& editControl); 64 | void SetNumber(CEdit& editControl, int number); 65 | bool CheckValidSize(CSize size); 66 | }; 67 | -------------------------------------------------------------------------------- /src/JPEGView/RotationPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "RotationPanel.h" 3 | #include "ImageProcessingPanel.h" 4 | #include "Helpers.h" 5 | #include "NLS.h" 6 | 7 | ///////////////////////////////////////////////////////////////////////////////////////////// 8 | // CRotationPanel 9 | ///////////////////////////////////////////////////////////////////////////////////////////// 10 | 11 | CRotationPanel::CRotationPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel) 12 | : CTransformPanel(hWnd, pNotifyMouseCapture, pImageProcPanel, CNLS::GetString(_T("Rotate Image")), 13 | CNLS::GetString(_T("Auto crop rotated image (avoids black border)"))) { 14 | AddUserPaintButton(ID_btnAssistMode, CNLS::GetString(_T("Align image to horizontal or vertical line")), &PaintAssistedModeBtn); 15 | } 16 | 17 | void CRotationPanel::PaintAssistedModeBtn(void* pContext, const CRect& rect, CDC& dc) { 18 | CRect r = Helpers::InflateRect(rect, 0.25f); 19 | 20 | int nAw = r.Width() / 3; 21 | dc.MoveTo(r.left, r.top); 22 | dc.LineTo(r.right, r.bottom); 23 | dc.MoveTo(r.left, r.bottom - nAw); 24 | dc.LineTo(r.left, r.bottom); 25 | dc.LineTo(r.left + nAw + 1, r.bottom); 26 | dc.MoveTo(r.left, r.bottom); 27 | dc.LineTo(r.left + nAw + 2, r.bottom - nAw - 2); 28 | } 29 | -------------------------------------------------------------------------------- /src/JPEGView/RotationPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TransformPanel.h" 4 | 5 | // Panel for free rotation of an image 6 | class CRotationPanel : public CTransformPanel { 7 | public: 8 | // IDs of the controls on this panel 9 | enum { 10 | ID_btnAssistMode = ID_btnApply + 1 11 | }; 12 | public: 13 | // The panel is on the given window above the image processing panel 14 | CRotationPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel); 15 | 16 | CButtonCtrl* GetBtnAssistMode() { return GetControl(ID_btnAssistMode); } 17 | private: 18 | // Painting handlers for the buttons; 19 | static void PaintAssistedModeBtn(void* pContext, const CRect& rect, CDC& dc); 20 | }; -------------------------------------------------------------------------------- /src/JPEGView/RotationPanelCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TransformPanelCtl.h" 4 | #include "ProcessParams.h" 5 | 6 | // Implements functionality of the rotation panel 7 | class CRotationPanelCtl : public CTransformPanelCtl 8 | { 9 | public: 10 | CRotationPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel); 11 | 12 | virtual void OnPostPaintMainDlg(HDC hPaintDC); 13 | 14 | // Gets a rotated DIB with the current rotation angle(GetLQRotationAngle) using point sampling 15 | // The returned DIB has size clippingSize. 16 | virtual void* GetDIBForPreview(CSize fullTargetSize, CSize clippingSize, CPoint targetOffset, 17 | const CImageProcessingParams & imageProcParams, EProcessingFlags eProcFlags); 18 | 19 | // Gets current rotation angle (in radians). Rotation is around image center 20 | double GetLQRotationAngle() { return m_dRotationLQ; } 21 | 22 | private: 23 | bool m_bOriginalShowGrid; 24 | bool m_bRotationModeAssisted; 25 | double m_dRotationLQ; 26 | double m_dRotatonLQStart; 27 | double m_dRotationBackup; 28 | float m_rotationStartX; 29 | float m_rotationStartY; 30 | 31 | virtual void TerminatePanel(); 32 | virtual void StartTransforming(int nX, int nY); 33 | virtual void DoTransforming(); 34 | virtual void EndTransforming(); 35 | virtual void ApplyTransformation(); 36 | virtual void UpdatePanelTitle(); 37 | virtual void ExchangeTransformationParams(); 38 | virtual void Reset(); 39 | 40 | void UpdateAssistedRotationMode(); 41 | void PaintRotationLine(HDC hPaintDC); 42 | 43 | static void OnRPAssistedMode(void* pContext, int nParameter, CButtonCtrl & sender); 44 | }; -------------------------------------------------------------------------------- /src/JPEGView/SaveImage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ProcessParams.h" 4 | 5 | class CJPEGImage; 6 | 7 | // Class that enables to save a processed image to a one of the supported file formats 8 | class CSaveImage 9 | { 10 | public: 11 | // Save processed image to file. Returns if saving was successful or not. 12 | // The file format is derived from the file ending of the specified file name. 13 | // If bFullSize is true, the image in its original size is processed and saved. 14 | // If bFullSize is false, the image section as shown in the window is saved. 15 | // Processing parameters and flags are ignored when bFullSize is false, the image is not reprocessed in this case. 16 | static bool SaveImage(LPCTSTR sFileName, CJPEGImage * pImage, const CImageProcessingParams& procParams, 17 | EProcessingFlags eFlags, bool bFullSize, bool bUseLosslessWEBP, bool bCreateParameterDBEntry = true); 18 | 19 | // Saves processed image in current window size as displayed on screen. Creates no parameter DB entry for the saved image. 20 | // The file format is derived from the file ending of the specified file name. 21 | static bool SaveImage(LPCTSTR sFileName, CJPEGImage * pImage, bool bUseLosslessWEBP); 22 | 23 | private: 24 | CSaveImage(void); 25 | }; 26 | -------------------------------------------------------------------------------- /src/JPEGView/TJPEGWrapper.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "TJPEGWrapper.h" 4 | #include "libjpeg-turbo\include\turbojpeg.h" 5 | #include "MaxImageDef.h" 6 | 7 | void * TurboJpeg::ReadImage(int &width, 8 | int &height, 9 | int &nchannels, 10 | TJSAMP &chromoSubsampling, 11 | bool &outOfMemory, 12 | const void *buffer, 13 | int sizebytes) 14 | { 15 | outOfMemory = false; 16 | width = height = 0; 17 | nchannels = 3; 18 | chromoSubsampling = TJSAMP_420; 19 | 20 | tjhandle hDecoder = tj3Init(TJINIT_DECOMPRESS); 21 | if (hDecoder == NULL) { 22 | return NULL; 23 | } 24 | 25 | unsigned char* pPixelData = NULL; 26 | int nResult = tj3DecompressHeader(hDecoder, (unsigned char*)buffer, sizebytes); 27 | if (nResult == 0) { 28 | width = tj3Get(hDecoder, TJPARAM_JPEGWIDTH); 29 | height = tj3Get(hDecoder, TJPARAM_JPEGHEIGHT); 30 | chromoSubsampling = (TJSAMP)tj3Get(hDecoder, TJPARAM_SUBSAMP); 31 | if (abs((double)width * height) > MAX_IMAGE_PIXELS) { 32 | outOfMemory = true; 33 | } else if (width <= MAX_IMAGE_DIMENSION && height <= MAX_IMAGE_DIMENSION && chromoSubsampling != TJSAMP_UNKNOWN) { 34 | pPixelData = new(std::nothrow) unsigned char[TJPAD(width * 3) * height]; 35 | if (pPixelData != NULL) { 36 | nResult = tj3Decompress8(hDecoder, (unsigned char*)buffer, sizebytes, pPixelData, TJPAD(width * 3), TJPF_BGR); 37 | if (nResult != 0) { 38 | delete[] pPixelData; 39 | pPixelData = NULL; 40 | } 41 | } else { 42 | outOfMemory = true; 43 | } 44 | } 45 | } 46 | 47 | tj3Destroy(hDecoder); 48 | 49 | return pPixelData; 50 | } 51 | 52 | void * TurboJpeg::Compress(const void *source, 53 | int width, 54 | int height, 55 | int &len, 56 | bool &outOfMemory, 57 | int quality) 58 | { 59 | outOfMemory = false; 60 | len = 0; 61 | tjhandle hEncoder = tj3Init(TJINIT_COMPRESS); 62 | if (hEncoder == NULL) { 63 | return NULL; 64 | } 65 | 66 | unsigned char* pJPEGCompressed = NULL; 67 | size_t nCompressedLen = 0; 68 | tj3Set(hEncoder, TJPARAM_SUBSAMP, TJSAMP_420); 69 | tj3Set(hEncoder, TJPARAM_QUALITY, quality); 70 | int nResult = tj3Compress8(hEncoder, (unsigned char*)source, width, TJPAD(width * 3), height, TJPF_BGR, 71 | &pJPEGCompressed, &nCompressedLen); 72 | if (nResult != 0 || nCompressedLen > INT_MAX) { 73 | if (pJPEGCompressed == NULL) { 74 | outOfMemory = true; 75 | } 76 | Free(pJPEGCompressed); 77 | pJPEGCompressed = NULL; 78 | } 79 | 80 | len = nCompressedLen; 81 | 82 | tj3Destroy(hEncoder); 83 | 84 | return pJPEGCompressed; 85 | } 86 | 87 | void TurboJpeg::Free(void* buffer) { 88 | tj3Free(buffer); 89 | } 90 | -------------------------------------------------------------------------------- /src/JPEGView/TJPEGWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | enum TJSAMP; 5 | 6 | class TurboJpeg 7 | { 8 | public: 9 | // Returns data in the form BGRBGR**********BGR000 where the zeros are padding to 4 byte boundary 10 | static void * ReadImage(int &width, // width of the image loaded. 11 | int &height, // height of the image loaded. 12 | int &bpp, // BYTES (not bits) PER PIXEL. 13 | TJSAMP &chromoSubsampling, // chromo subsampling of image 14 | bool &outOfMemory, // set to true when no memory to read image 15 | const void *buffer, // memory address containing jpeg compressed data. 16 | int sizebytes); // size of jpeg compressed data. 17 | 18 | // Compress image data into JPEG stream, returns compressed data. 19 | // The returned buffer must be freed with Free()! 20 | static void * Compress(const void *buffer, // address of image in memory, format must be 3 bytes per pixel BRGBGR with padding to 4 byte boundary 21 | int width, // width of image in pixels 22 | int height, // height of image in pixels. 23 | int &len, // returns length of compressed data 24 | bool &outOfMemory, // returns if out of memory 25 | int quality=75); // image quality as a percentage 26 | 27 | // Free buffer allocated by Compress 28 | static void Free(void* buffer); 29 | }; 30 | -------------------------------------------------------------------------------- /src/JPEGView/TiltCorrectionPanel.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "TiltCorrectionPanel.h" 3 | #include "NLS.h" 4 | 5 | ///////////////////////////////////////////////////////////////////////////////////////////// 6 | // CTiltCorrectionPanel 7 | ///////////////////////////////////////////////////////////////////////////////////////////// 8 | 9 | CTiltCorrectionPanel::CTiltCorrectionPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel) 10 | : CTransformPanel(hWnd, pNotifyMouseCapture, pImageProcPanel, CNLS::GetString(_T("Perspective Correction")), 11 | CNLS::GetString(_T("Auto crop corrected image (avoids black border)"))) { 12 | } 13 | -------------------------------------------------------------------------------- /src/JPEGView/TiltCorrectionPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TransformPanel.h" 4 | 5 | // Panel for perspective (tilt) correction 6 | class CTiltCorrectionPanel : public CTransformPanel { 7 | public: 8 | // The panel is on the given window above the image processing panel 9 | CTiltCorrectionPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel); 10 | }; -------------------------------------------------------------------------------- /src/JPEGView/TiltCorrectionPanelCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "TransformPanelCtl.h" 4 | #include "ProcessParams.h" 5 | 6 | // Implements functionality of the perspective correction panel 7 | class CTiltCorrectionPanelCtl : public CTransformPanelCtl 8 | { 9 | public: 10 | CTiltCorrectionPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel); 11 | 12 | // Gets a rotated DIB with the current rotation angle(GetLQRotationAngle) using point sampling 13 | // The returned DIB has size clippingSize. 14 | virtual void* GetDIBForPreview(CSize fullTargetSize, CSize clippingSize, CPoint targetOffset, 15 | const CImageProcessingParams & imageProcParams, EProcessingFlags eProcFlags); 16 | 17 | // Gets the current trapezoid, resized to the given target size of the image 18 | CTrapezoid GetCurrentTrapezoid(CSize targetSize); 19 | private: 20 | virtual void StartPanel(); 21 | virtual void StartTransforming(int nX, int nY); 22 | virtual void DoTransforming(); 23 | virtual void EndTransforming(); 24 | virtual void ApplyTransformation(); 25 | virtual void UpdatePanelTitle(); 26 | virtual void ExchangeTransformationParams(); 27 | virtual void Reset(); 28 | 29 | enum EClickPosition { 30 | CP_Left, 31 | CP_Right, 32 | CP_Middle 33 | }; 34 | 35 | float m_fLeftDeltaX, m_fLeftDeltaXBackup; 36 | float m_fRightDeltaX, m_fRightDeltaXBackup; 37 | int m_nStartX, m_nStartY; 38 | EClickPosition m_eClickPosition; 39 | float m_fScale; 40 | }; -------------------------------------------------------------------------------- /src/JPEGView/TimerEventIDs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define SLIDESHOW_TIMER_EVENT_ID 1 // Slideshow timer ID 4 | #define ZOOM_TIMER_EVENT_ID 2 // Zoom refinement timer ID 5 | #define ZOOM_TEXT_TIMER_EVENT_ID 3 // Zoom label timer ID 6 | #define AUTOSCROLL_TIMER_EVENT_ID 4 // when cropping, auto scroll timer ID 7 | #define NAVPANEL_TIMER_EVENT_ID 5 // to show nav panel 8 | #define NAVPANEL_ANI_TIMER_EVENT_ID 6 // animation timer for navigation panel 9 | #define NAVPANEL_START_ANI_TIMER_EVENT_ID 7 // animation start timer for navigation panel 10 | #define IPPANEL_TIMER_EVENT_ID 8 // to show image processing panel in window mode 11 | #define ANIMATION_TIMER_EVENT_ID 9 // GIF animation timer ID -------------------------------------------------------------------------------- /src/JPEGView/TransformPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Panel.h" 4 | 5 | // This is the base class for the rotation and the perspective correction panel 6 | class CTransformPanel : public CPanel { 7 | public: 8 | // IDs of the controls on this panel 9 | enum { 10 | ID_txtTitle, 11 | ID_txtHint, 12 | ID_btnShowGrid, 13 | ID_btnAutoCrop, 14 | ID_btnKeepAR, 15 | ID_btnCancel, 16 | ID_btnReset, 17 | ID_btnApply 18 | }; 19 | public: 20 | // The panel is on the given window above the image processing panel 21 | CTransformPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel, LPCTSTR sTitleText, LPCTSTR sCropTooltipText); 22 | 23 | CTextCtrl* GetTextTitle() { return GetControl(ID_txtTitle); } 24 | CTextCtrl* GetTextHint() { return GetControl(ID_txtHint); } 25 | CButtonCtrl* GetBtnShowGrid() { return GetControl(ID_btnShowGrid); } 26 | CButtonCtrl* GetBtnAutoCrop() { return GetControl(ID_btnAutoCrop); } 27 | CButtonCtrl* GetBtnKeepAR() { return GetControl(ID_btnKeepAR); } 28 | CButtonCtrl* GetBtnCancel() { return GetControl(ID_btnCancel); } 29 | CButtonCtrl* GetBtnReset() { return GetControl(ID_btnReset); } 30 | CButtonCtrl* GetBtnApply() { return GetControl(ID_btnApply); } 31 | 32 | virtual CRect PanelRect(); 33 | virtual void RequestRepositioning(); 34 | 35 | protected: 36 | virtual void RepositionAll(); 37 | 38 | private: 39 | // Painting handlers for the buttons 40 | static void PaintShowGridBtn(void* pContext, const CRect& rect, CDC& dc); 41 | static void PaintAutoCropBtn(void* pContext, const CRect& rect, CDC& dc); 42 | static void PaintKeepARBtn(void* pContext, const CRect& rect, CDC& dc); 43 | 44 | CPanel* m_pImageProcPanel; 45 | CRect m_clientRect; 46 | int m_nWidth, m_nHeight; 47 | int m_nButtonSize; 48 | }; -------------------------------------------------------------------------------- /src/JPEGView/TransformPanelCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PanelController.h" 4 | #include "ProcessParams.h" 5 | 6 | class CTransformPanel; 7 | 8 | // Implements functionality of the rotation and perspective correction panels (these are modal panels) 9 | class CTransformPanelCtl : public CPanelController 10 | { 11 | public: 12 | CTransformPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel, CTransformPanel* pTransformPanel); 13 | virtual ~CTransformPanelCtl(); 14 | 15 | virtual float DimFactor() { return 0.5f; } 16 | 17 | virtual bool IsVisible(); 18 | virtual bool IsActive(); 19 | 20 | virtual void SetVisible(bool bVisible); 21 | virtual void SetActive(bool bActive); 22 | 23 | virtual void CancelModalPanel() { TerminatePanel(); }; 24 | 25 | virtual bool OnMouseLButton(EMouseEvent eMouseEvent, int nX, int nY); 26 | virtual bool OnMouseMove(int nX, int nY); 27 | virtual bool OnKeyDown(unsigned int nVirtualKey, bool bShift, bool bAlt, bool bCtrl); 28 | 29 | // Gets a DIB having applied the current transformation using point sampling 30 | // The returned DIB has size clippingSize. 31 | virtual void* GetDIBForPreview(CSize fullTargetSize, CSize clippingSize, CPoint targetOffset, 32 | const CImageProcessingParams & imageProcParams, EProcessingFlags eProcFlags) = 0; 33 | 34 | protected: 35 | bool m_bVisible; 36 | CTransformPanel* m_pTransformPanel; 37 | bool m_bShowGrid; 38 | bool m_bAutoCrop; 39 | bool m_bKeepAspectRatio; 40 | bool m_bTransforming; 41 | bool m_bOldShowNavPanel; 42 | int m_nMouseX, m_nMouseY; 43 | 44 | virtual void TerminatePanel(); 45 | virtual void StartPanel(); 46 | virtual void StartTransforming(int nX, int nY) = 0; 47 | virtual void DoTransforming() = 0; 48 | virtual void EndTransforming() = 0; 49 | virtual void ApplyTransformation() = 0; 50 | virtual void UpdatePanelTitle() = 0; 51 | virtual void ExchangeTransformationParams() = 0; 52 | virtual void Reset() = 0; 53 | 54 | private: 55 | void Apply(); 56 | 57 | static void OnShowGridLines(void* pContext, int nParameter, CButtonCtrl & sender); 58 | static void OnAutoCrop(void* pContext, int nParameter, CButtonCtrl & sender); 59 | static void OnKeepAspectRatio(void* pContext, int nParameter, CButtonCtrl & sender); 60 | static void OnCancel(void* pContext, int nParameter, CButtonCtrl & sender); 61 | static void OnReset(void* pContext, int nParameter, CButtonCtrl & sender); 62 | static void OnApply(void* pContext, int nParameter, CButtonCtrl & sender); 63 | 64 | }; -------------------------------------------------------------------------------- /src/JPEGView/UnsharpMaskPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Panel.h" 4 | 5 | class CUnsharpMaskParams; 6 | 7 | // Panel for unsharp masking an image 8 | class CUnsharpMaskPanel : public CPanel { 9 | public: 10 | // IDs of the controls on this panel 11 | enum { 12 | ID_txtTitle, 13 | ID_slRadius, 14 | ID_slAmount, 15 | ID_slThreshold, 16 | ID_btnCancel, 17 | ID_btnApply 18 | }; 19 | public: 20 | // The panel is on the given window above the image processing panel 21 | CUnsharpMaskPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel, CUnsharpMaskParams* pParams); 22 | 23 | CButtonCtrl* GetBtnCancel() { return GetControl(ID_btnCancel); } 24 | CButtonCtrl* GetBtnApply() { return GetControl(ID_btnApply); } 25 | 26 | virtual CRect PanelRect(); 27 | virtual void RequestRepositioning(); 28 | 29 | protected: 30 | virtual void RepositionAll(); 31 | 32 | private: 33 | 34 | CPanel* m_pImageProcPanel; 35 | CRect m_clientRect; 36 | int m_nWidth, m_nHeight; 37 | int m_nMaxSliderWidth; 38 | }; -------------------------------------------------------------------------------- /src/JPEGView/UnsharpMaskPanelCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PanelController.h" 4 | #include "ProcessParams.h" 5 | 6 | class CUnsharpMaskPanel; 7 | 8 | // Implements functionality of the unsharp mask panel 9 | class CUnsharpMaskPanelCtl : public CPanelController 10 | { 11 | public: 12 | CUnsharpMaskPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel); 13 | virtual ~CUnsharpMaskPanelCtl(); 14 | 15 | virtual float DimFactor() { return 0.5f; } 16 | 17 | virtual bool IsVisible(); 18 | virtual bool IsActive(); 19 | 20 | virtual void SetVisible(bool bVisible); 21 | virtual void SetActive(bool bActive); 22 | 23 | virtual void CancelModalPanel() { TerminateUnsharpMaskPanel(); }; 24 | 25 | virtual bool OnKeyDown(unsigned int nVirtualKey, bool bShift, bool bAlt, bool bCtrl); 26 | 27 | // Gets preview DIB of unsharp masked image. Returned DIB has size clippingSize 28 | void* GetUSMDIBForPreview(CSize clippingSize, CPoint offset, const CImageProcessingParams & imageProcParams, EProcessingFlags eProcFlags); 29 | 30 | private: 31 | bool m_bVisible; 32 | bool m_bOldShowNavPanel; 33 | CUnsharpMaskParams* m_pUnsharpMaskParams; 34 | CUnsharpMaskPanel* m_pUnsharpMaskPanel; 35 | double m_dAlternateUSMAmount; 36 | 37 | void TerminateUnsharpMaskPanel(); 38 | void StartUnsharpMaskPanel(); 39 | 40 | static void OnCancelUnsharpMask(void* pContext, int nParameter, CButtonCtrl & sender); 41 | static void OnApplyUnsharpMask(void* pContext, int nParameter, CButtonCtrl & sender); 42 | }; -------------------------------------------------------------------------------- /src/JPEGView/WEBPWrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | class WebpReaderWriter 5 | { 6 | public: 7 | // Returns data in 4 byte BGRA 8 | static void* ReadImage(int& width, // width of the image loaded. 9 | int& height, // height of the image loaded. 10 | int& bpp, // BYTES (not bits) PER PIXEL. 11 | bool& has_animation, // if the image is animated 12 | int& frame_count, // number of frames 13 | int& frame_time, // frame duration in milliseconds 14 | void*& exif, // Pointer to Exif data (must be freed by caller) 15 | bool& outOfMemory, // set to true when no memory to read image 16 | const void* buffer, // memory address containing webp compressed data. 17 | int sizebytes); // size of webp compressed data 18 | 19 | static void DeleteCache(); 20 | 21 | // Compress image data into WEBP stream, returns compressed data. 22 | static void* Compress(const void* buffer, // address of image in memory, format must be 3 bytes per pixel BRGBGR with padding to 4 byte boundary 23 | int width, // width of image in pixels 24 | int height, // height of image in pixels. 25 | size_t& len, // returns length of compressed data 26 | int quality, // image quality as a percentage (ignored if lossless) 27 | bool lossless); // use lossless compression if true 28 | 29 | static void FreeMemory(void* pointer); 30 | 31 | private: 32 | struct webp_cache; 33 | static webp_cache cache; 34 | }; 35 | -------------------------------------------------------------------------------- /src/JPEGView/WndButtonPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Panel.h" 4 | 5 | // Window button panel - panel with (minimize, restore, close) buttons shown top, right 6 | class CWndButtonPanel : public CPanel { 7 | public: 8 | // IDs of the controls on this panel 9 | enum { 10 | ID_btnMinimize, 11 | ID_btnRestore, 12 | ID_btnClose 13 | }; 14 | public: 15 | // The panel is on the given window on top border above image processing panel 16 | CWndButtonPanel(HWND hWnd, INotifiyMouseCapture* pNotifyMouseCapture, CPanel* pImageProcPanel); 17 | 18 | CButtonCtrl* GetBtnMinimize() { return GetControl(ID_btnMinimize); } 19 | CButtonCtrl* GetBtnRestore() { return GetControl(ID_btnRestore); } 20 | CButtonCtrl* GetBtnClose() { return GetControl(ID_btnClose); } 21 | 22 | virtual CRect PanelRect(); 23 | int ButtonPanelHeight() { return m_nHeight; } 24 | virtual void RequestRepositioning(); 25 | 26 | protected: 27 | virtual void RepositionAll(); 28 | 29 | private: 30 | // Painting handlers for the buttons 31 | static void PaintMinimizeBtn(void* pContext, const CRect& rect, CDC& dc); 32 | static void PaintRestoreBtn(void* pContext, const CRect& rect, CDC& dc); 33 | static void PaintCloseBtn(void* pContext, const CRect& rect, CDC& dc); 34 | 35 | CPanel* m_pImageProcPanel; 36 | CRect m_clientRect; 37 | int m_nWidth, m_nHeight; 38 | }; -------------------------------------------------------------------------------- /src/JPEGView/WndButtonPanelCtl.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "resource.h" 3 | #include "MainDlg.h" 4 | #include "WndButtonPanelCtl.h" 5 | #include "WndButtonPanel.h" 6 | 7 | CWndButtonPanelCtl::CWndButtonPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel) : CPanelController(pMainDlg, false) { 8 | m_bVisible = false; 9 | m_nOldMouseY = 0; 10 | m_pPanel = m_pWndButtonPanel = new CWndButtonPanel(pMainDlg->GetHWND(), this, pImageProcPanel); 11 | m_pWndButtonPanel->GetBtnMinimize()->SetButtonPressedHandler(&(CMainDlg::OnExecuteCommand), pMainDlg, IDM_MINIMIZE); 12 | m_pWndButtonPanel->GetBtnRestore()->SetButtonPressedHandler(&(CMainDlg::OnExecuteCommand), pMainDlg, IDM_FULL_SCREEN_MODE); 13 | m_pWndButtonPanel->GetBtnClose()->SetButtonPressedHandler(&(CMainDlg::OnExecuteCommand), pMainDlg, IDM_EXIT);; 14 | } 15 | 16 | CWndButtonPanelCtl::~CWndButtonPanelCtl() { 17 | delete m_pWndButtonPanel; 18 | m_pWndButtonPanel = NULL; 19 | } 20 | 21 | bool CWndButtonPanelCtl::IsVisible() { 22 | return m_bVisible && m_pMainDlg->IsFullScreenMode(); 23 | } 24 | 25 | void CWndButtonPanelCtl::SetVisible(bool bVisible) { 26 | if (m_bVisible != bVisible) { 27 | m_bVisible = bVisible; 28 | InvalidateMainDlg(); 29 | } 30 | } 31 | 32 | bool CWndButtonPanelCtl::OnMouseMove(int nX, int nY) { 33 | if (!m_pMainDlg->IsFullScreenMode()) { 34 | return false; 35 | } 36 | bool bHandled = CPanelController::OnMouseMove(nX, nY); 37 | if (!bHandled) { 38 | if (!m_bVisible) { 39 | int nWndBtnAreaStart = m_pWndButtonPanel->ButtonPanelHeight(); 40 | if (m_nOldMouseY != 0 && m_nOldMouseY > nWndBtnAreaStart && nY <= nWndBtnAreaStart) { 41 | m_bVisible = true; 42 | m_pMainDlg->InvalidateRect(m_pWndButtonPanel->PanelRect(), FALSE); 43 | } 44 | } else { 45 | if (nY > m_pWndButtonPanel->ButtonPanelHeight()*2) { 46 | m_bVisible = false; 47 | m_pMainDlg->InvalidateRect(m_pWndButtonPanel->PanelRect(), FALSE); 48 | m_pWndButtonPanel->GetTooltipMgr().RemoveActiveTooltip(); 49 | } 50 | } 51 | } 52 | m_nOldMouseY = nY; 53 | return bHandled; 54 | } 55 | 56 | bool CWndButtonPanelCtl::IsPointInWndButtonPanel(CPoint pt) { 57 | if (IsVisible()) { 58 | return PanelRect().PtInRect(pt); 59 | } 60 | return false; 61 | } 62 | -------------------------------------------------------------------------------- /src/JPEGView/WndButtonPanelCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PanelController.h" 4 | 5 | class CWndButtonPanel; 6 | 7 | // Implements functionality of the window button panel (minimize, restore, close buttons on top, right corner of screen) 8 | class CWndButtonPanelCtl : public CPanelController 9 | { 10 | public: 11 | CWndButtonPanelCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel); 12 | virtual ~CWndButtonPanelCtl(); 13 | 14 | virtual float DimFactor() { return 0.1f; } 15 | 16 | virtual bool IsVisible(); 17 | virtual bool IsActive() { return true; } 18 | 19 | virtual void SetVisible(bool bVisible); 20 | virtual void SetActive(bool bActive) {} // always active 21 | 22 | virtual bool OnMouseMove(int nX, int nY); 23 | 24 | // Gets if the given point is in the panel rectangle. When the panel is not visible, false is returned. 25 | bool IsPointInWndButtonPanel(CPoint pt); 26 | 27 | private: 28 | bool m_bVisible; 29 | int m_nOldMouseY; 30 | CWndButtonPanel* m_pWndButtonPanel; 31 | }; -------------------------------------------------------------------------------- /src/JPEGView/XMMImage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ImageProcessingTypes.h" 4 | 5 | // Represents an image with line interleaving and padding rows to 2^x bytes (16 for SSE, 32 for AVX) optimal for 6 | // SIMD processing. Each pixel has 16 bits per channel, channel order is B, G, R, x stands for padding: 7 | // BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBxxx 8 | // GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGxxx 9 | // RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRxxx 10 | // BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBxxx 11 | // GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGxxx 12 | // RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRxxx 13 | class CXMMImage 14 | { 15 | public: 16 | // padding is in pixels (not bytes) 17 | CXMMImage(int nWidth, int nHeight, int padding); 18 | CXMMImage(int nWidth, int nHeight, bool bPadHeight, int padding); // padding is in pixels (not bytes), width is always padded, height only when bPadHeight is true 19 | // convert from section of 24 or 32 bpp DIB, from first to (and including) last column and row 20 | // padding is in pixels(not bytes) 21 | CXMMImage(int nWidth, int nHeight, int nFirstX, int nLastX, int nFirstY, int nLastY, const void* pDIB, int nChannels, int padding); 22 | ~CXMMImage(void); 23 | 24 | // Pointer to aligned memory of 16 bpp image 25 | void * AlignedPtr() { return m_pMemory; } 26 | void * AlignedPtr() const { return m_pMemory; } 27 | 28 | // Geometry 29 | int GetWidth() const { return m_nWidth; } 30 | int GetHeight() const { return m_nHeight; } 31 | int GetPaddedWidth() const { return m_nPaddedWidth; } 32 | int GetPaddedHeight() const { return m_nPaddedHeight; } 33 | 34 | // Generate a BGRA (32 bit) DIB and return it, caller gets ownership of returned object 35 | void* ConvertToDIBRGBA() const; 36 | 37 | private: 38 | int GetLineSize() const { return m_nPaddedWidth*2; } 39 | int GetMemSize() const { return GetLineSize()*3*m_nPaddedHeight; } 40 | void Init(int nWidth, int nHeight, bool bPadHeight, int padding); 41 | 42 | void* m_pMemory; 43 | int m_nWidth, m_nHeight; 44 | int m_nPaddedWidth; // in pixels 45 | int m_nPaddedHeight; // in pixels 46 | }; 47 | -------------------------------------------------------------------------------- /src/JPEGView/ZoomNavigator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/ZoomNavigator.h -------------------------------------------------------------------------------- /src/JPEGView/ZoomNavigatorCtl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ProcessParams.h" 4 | #include "ZoomNavigator.h" 5 | 6 | class CMainDlg; 7 | class CPanel; 8 | 9 | // Implements functionality of the zoom navigator. 10 | // This is not a CPanelController because the zoom navigator is not a CPanel (not painted to offscreen bitmap) 11 | class CZoomNavigatorCtl 12 | { 13 | public: 14 | CZoomNavigatorCtl(CMainDlg* pMainDlg, CPanel* pImageProcPanel, CPanel* pNavigationPanel); 15 | 16 | bool IsVisible(); 17 | bool IsActive(); 18 | 19 | CRect PanelRect(); 20 | 21 | // Returns if user is dragging with zoom navigator 22 | bool IsDragging() { return m_bDragging; } 23 | 24 | // Perform dragging with zoom navigator 25 | void StartDragging(int nX, int nY); 26 | void DoDragging(int nDeltaX, int nDeltaY); 27 | void EndDragging(); 28 | 29 | bool OnMouseLButton(EMouseEvent eMouseEvent, int nX, int nY); 30 | bool OnMouseMove(int nOldX, int nOldY); 31 | // Paints zoom navigator with given DC (when currently visible). Needs all image processing parameters and flags, including rotation and 32 | // trapezoid (that can be NULL of course) to be able to generate the thumbnail image for the zoom navigator 33 | void OnPaint(CPaintDC& paintDC, CRectF visRectZoomNavigator, const CImageProcessingParams* pImageProcParams, 34 | EProcessingFlags eProcessingFlags, double dRotationAngle, const CTrapezoid* pTrapezoid); 35 | 36 | void InvalidateZoomNavigatorRect(); // does nothing when zoom navigator is not active 37 | bool IsPointInZoomNavigatorThumbnail(const CPoint& pt); // returns always false when zoom navigator not visible 38 | 39 | // Gets the visible rectangle in float coordinates (normalized to 0..1) relative to full image 40 | static CRectF GetVisibleRect(CSize sizeFull, CSize sizeClipped, CPoint offset); 41 | 42 | private: 43 | CMainDlg* m_pMainDlg; 44 | CPanel* m_pImageProcPanel; 45 | CPanel* m_pNavigationPanel; 46 | bool m_bDragging; 47 | CPoint m_capturedPosZoomNavSection; 48 | CZoomNavigator m_zoomNavigator; 49 | }; -------------------------------------------------------------------------------- /src/JPEGView/dcraw_mod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Helpers.h" 4 | #include "JPEGImage.h" 5 | 6 | #define NO_JPEG 7 | #define RGBWIDTH(Width) ((Width * 3 + 3) & -4) 8 | 9 | class CReaderRAW 10 | { 11 | public: 12 | static CJPEGImage* ReadRawImage(LPCTSTR strFileName, bool& bOutOfMemory); 13 | private: 14 | CReaderRAW(void); 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /src/JPEGView/lcms2/bin/lcms2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/lcms2/bin/lcms2.dll -------------------------------------------------------------------------------- /src/JPEGView/lcms2/bin64/lcms2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/lcms2/bin64/lcms2.dll -------------------------------------------------------------------------------- /src/JPEGView/lcms2/lib/lcms2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/lcms2/lib/lcms2.lib -------------------------------------------------------------------------------- /src/JPEGView/lcms2/lib64/lcms2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/lcms2/lib64/lcms2.lib -------------------------------------------------------------------------------- /src/JPEGView/libavif/bin/avif.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libavif/bin/avif.dll -------------------------------------------------------------------------------- /src/JPEGView/libavif/bin/dav1d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libavif/bin/dav1d.dll -------------------------------------------------------------------------------- /src/JPEGView/libavif/bin64/avif.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libavif/bin64/avif.dll -------------------------------------------------------------------------------- /src/JPEGView/libavif/bin64/dav1d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libavif/bin64/dav1d.dll -------------------------------------------------------------------------------- /src/JPEGView/libavif/lib/avif.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libavif/lib/avif.lib -------------------------------------------------------------------------------- /src/JPEGView/libavif/lib64/avif.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libavif/lib64/avif.lib -------------------------------------------------------------------------------- /src/JPEGView/libheif/bin/heif.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libheif/bin/heif.dll -------------------------------------------------------------------------------- /src/JPEGView/libheif/bin/libde265.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libheif/bin/libde265.dll -------------------------------------------------------------------------------- /src/JPEGView/libheif/bin64/heif.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libheif/bin64/heif.dll -------------------------------------------------------------------------------- /src/JPEGView/libheif/bin64/libde265.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libheif/bin64/libde265.dll -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/api_structs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2017 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef HEIF_API_STRUCTS_H 22 | #define HEIF_API_STRUCTS_H 23 | 24 | #include "pixelimage.h" 25 | #include "context.h" 26 | 27 | #include 28 | 29 | struct heif_image_handle 30 | { 31 | std::shared_ptr image; 32 | 33 | // store reference to keep the context alive while we are using the handle (issue #147) 34 | std::shared_ptr context; 35 | }; 36 | 37 | 38 | struct heif_image 39 | { 40 | std::shared_ptr image; 41 | }; 42 | 43 | 44 | struct heif_context 45 | { 46 | std::shared_ptr context; 47 | }; 48 | 49 | 50 | struct heif_encoder 51 | { 52 | heif_encoder(const struct heif_encoder_plugin* plugin); 53 | 54 | ~heif_encoder(); 55 | 56 | struct heif_error alloc(); 57 | 58 | void release(); 59 | 60 | 61 | const struct heif_encoder_plugin* plugin; 62 | void* encoder = nullptr; 63 | }; 64 | 65 | 66 | struct heif_region_item 67 | { 68 | std::shared_ptr context; 69 | std::shared_ptr region_item; 70 | }; 71 | 72 | 73 | struct heif_region 74 | { 75 | std::shared_ptr context; // we need this to perform coordinate transformation 76 | //heif_item_id parent_region_item_id; // we need this to perform coordinate transformation 77 | std::shared_ptr region_item; 78 | std::shared_ptr region; 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/avif.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2017 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef HEIF_AVIF_H 22 | #define HEIF_AVIF_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "heif.h" 29 | #include "box.h" 30 | #include "error.h" 31 | 32 | 33 | class HeifPixelImage; 34 | 35 | Error fill_av1C_configuration(Box_av1C::configuration* inout_config, const std::shared_ptr& image); 36 | 37 | bool fill_av1C_configuration_from_stream(Box_av1C::configuration* out_config, const uint8_t* data, int dataSize); 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/common_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2023 Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef LIBHEIF_COMMON_UTILS_H 22 | #define LIBHEIF_COMMON_UTILS_H 23 | 24 | #include 25 | #include 26 | 27 | #ifdef _MSC_VER 28 | #define MAYBE_UNUSED 29 | #else 30 | #define MAYBE_UNUSED __attribute__((unused)) 31 | #endif 32 | 33 | 34 | constexpr inline uint32_t fourcc_to_uint32(const char* id) 35 | { 36 | return ((((uint32_t) id[0]) << 24) | 37 | (((uint32_t) id[1]) << 16) | 38 | (((uint32_t) id[2]) << 8) | 39 | (((uint32_t) id[3]) << 0)); 40 | } 41 | 42 | 43 | // Functions for common use in libheif and the plugins. 44 | 45 | uint8_t chroma_h_subsampling(heif_chroma c); 46 | 47 | uint8_t chroma_v_subsampling(heif_chroma c); 48 | 49 | void get_subsampled_size(int width, int height, 50 | heif_channel channel, 51 | heif_chroma chroma, 52 | int* subsampled_width, int* subsampled_height); 53 | 54 | uint8_t compute_avif_profile(int bits_per_pixel, heif_chroma chroma); 55 | 56 | 57 | inline uint8_t clip_int_u8(int x) 58 | { 59 | if (x < 0) return 0; 60 | if (x > 255) return 255; 61 | return static_cast(x); 62 | } 63 | 64 | 65 | inline uint16_t clip_f_u16(float fx, int32_t maxi) 66 | { 67 | long x = (long int) (fx + 0.5f); 68 | if (x < 0) return 0; 69 | if (x > maxi) return (uint16_t) maxi; 70 | return static_cast(x); 71 | } 72 | 73 | 74 | inline uint8_t clip_f_u8(float fx) 75 | { 76 | long x = (long int) (fx + 0.5f); 77 | if (x < 0) return 0; 78 | if (x > 255) return 255; 79 | return static_cast(x); 80 | } 81 | 82 | #endif //LIBHEIF_COMMON_UTILS_H 83 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/exif.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2022 Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef LIBHEIF_EXIF_H 22 | #define LIBHEIF_EXIF_H 23 | 24 | #include 25 | #include 26 | 27 | int read_exif_orientation_tag(const uint8_t* exif, int size); 28 | 29 | void modify_exif_orientation_tag_if_it_exists(uint8_t* exifData, int size, uint16_t orientation); 30 | 31 | #endif //LIBHEIF_EXIF_H 32 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/heif_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2017 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | /* heif_version.h 22 | * 23 | * This file was automatically generated when libheif was built. 24 | * 25 | * DO NOT EDIT THIS FILE. 26 | */ 27 | #ifndef LIBHEIF_HEIF_VERSION_H 28 | #define LIBHEIF_HEIF_VERSION_H 29 | 30 | /* Numeric representation of the version */ 31 | #define LIBHEIF_NUMERIC_VERSION ((1<<24) | (16<<16) | (2<<8) | 0) 32 | 33 | /* Version string */ 34 | #define LIBHEIF_VERSION "1.16.2" 35 | 36 | #define LIBHEIF_PLUGIN_DIRECTORY "C:/Program Files/libheif/lib/libheif" 37 | 38 | #endif // LIBHEIF_HEIF_VERSION_H 39 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/hevc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2017 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef HEIF_HEVC_H 22 | #define HEIF_HEVC_H 23 | 24 | #include "heif.h" 25 | #include "box.h" 26 | #include "error.h" 27 | 28 | #include 29 | #include 30 | 31 | 32 | class SEIMessage 33 | { 34 | public: 35 | virtual ~SEIMessage() = default; 36 | }; 37 | 38 | 39 | class SEIMessage_depth_representation_info : public SEIMessage, 40 | public heif_depth_representation_info 41 | { 42 | public: 43 | }; 44 | 45 | 46 | Error decode_hevc_aux_sei_messages(const std::vector& data, 47 | std::vector>& msgs); 48 | 49 | 50 | Error parse_sps_for_hvcC_configuration(const uint8_t* sps, size_t size, 51 | Box_hvcC::configuration* inout_config, 52 | int* width, int* height); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2022 Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | 22 | #ifndef LIBHEIF_INIT_H 23 | #define LIBHEIF_INIT_H 24 | 25 | #include "libheif/heif.h" 26 | 27 | extern heif_error error_dlopen; 28 | extern heif_error error_plugin_not_loaded; 29 | extern heif_error error_cannot_read_plugin_directory; 30 | 31 | // TODO: later, we might defer the default plugin initialization to when they are actually used for the first time. 32 | // That would prevent them from being initialized every time at program start, even when the application software uses heif_init() later on. 33 | 34 | // Note: the loaded plugin is not released automatically then the class is released, because this would require that 35 | // we reference-count the handle. We do not really need this since releasing the library explicitly with release() is simple enough. 36 | class PluginLibrary 37 | { 38 | public: 39 | virtual struct heif_error load_from_file(const char*) = 0; 40 | 41 | virtual void release() = 0; 42 | 43 | virtual struct heif_plugin_info* get_plugin_info() = 0; 44 | }; 45 | 46 | 47 | #endif //LIBHEIF_INIT_H 48 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/logging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2017 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef LIBHEIF_LOGGING_H 22 | #define LIBHEIF_LOGGING_H 23 | 24 | #if defined(HAVE_CONFIG_H) 25 | #include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | class Indent 39 | { 40 | public: 41 | Indent() = default; 42 | 43 | int get_indent() const { return m_indent; } 44 | 45 | void operator++(int) { m_indent++; } 46 | 47 | void operator--(int) 48 | { 49 | m_indent--; 50 | if (m_indent < 0) m_indent = 0; 51 | } 52 | 53 | private: 54 | int m_indent = 0; 55 | }; 56 | 57 | 58 | inline std::ostream& operator<<(std::ostream& ostr, const Indent& indent) 59 | { 60 | for (int i = 0; i < indent.get_indent(); i++) { 61 | ostr << "| "; 62 | } 63 | 64 | return ostr; 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/metadata_compression.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2022 Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | #ifndef LIBHEIF_METADATA_COMPRESSION_H 21 | #define LIBHEIF_METADATA_COMPRESSION_H 22 | 23 | #include 24 | #include 25 | 26 | #if WITH_DEFLATE_HEADER_COMPRESSION 27 | std::vector deflate(const uint8_t* input, int size); 28 | 29 | std::vector inflate(const std::vector&); 30 | #endif 31 | 32 | #endif //LIBHEIF_METADATA_COMPRESSION_H 33 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/nclx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2020 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef LIBHEIF_NCLX_H 22 | #define LIBHEIF_NCLX_H 23 | 24 | #include 25 | 26 | struct primaries 27 | { 28 | primaries() = default; 29 | 30 | primaries(float gx, float gy, float bx, float by, float rx, float ry, float wx, float wy); 31 | 32 | bool defined = false; 33 | 34 | float greenX = 0, greenY = 0; 35 | float blueX = 0, blueY = 0; 36 | float redX = 0, redY = 0; 37 | float whiteX = 0, whiteY = 0; 38 | }; 39 | 40 | primaries get_colour_primaries(uint16_t primaries_idx); 41 | 42 | 43 | struct Kr_Kb 44 | { 45 | float Kr = 0, Kb = 0; 46 | 47 | static Kr_Kb defaults(); 48 | }; 49 | 50 | Kr_Kb get_Kr_Kb(uint16_t matrix_coefficients_idx, uint16_t primaries_idx); 51 | 52 | struct YCbCr_to_RGB_coefficients 53 | { 54 | bool defined = false; 55 | 56 | float r_cr = 0; 57 | float g_cb = 0; 58 | float g_cr = 0; 59 | float b_cb = 0; 60 | 61 | static YCbCr_to_RGB_coefficients defaults(); 62 | }; 63 | 64 | YCbCr_to_RGB_coefficients get_YCbCr_to_RGB_coefficients(uint16_t matrix_coefficients_idx, uint16_t primaries_idx); 65 | 66 | struct RGB_to_YCbCr_coefficients 67 | { 68 | bool defined = false; 69 | 70 | float c[3][3] = {{0, 0, 0}, 71 | {0, 0, 0}, 72 | {0, 0, 0}}; // e.g. y = c[0][0]*r + c[0][1]*g + c[0][2]*b 73 | 74 | static RGB_to_YCbCr_coefficients defaults(); 75 | }; 76 | 77 | RGB_to_YCbCr_coefficients get_RGB_to_YCbCr_coefficients(uint16_t matrix_coefficients_idx, uint16_t primaries_idx); 78 | 79 | // uint16_t get_transfer_characteristics() const {return m_transfer_characteristics;} 80 | // uint16_t get_matrix_coefficients() const {return m_matrix_coefficients;} 81 | // bool get_full_range_flag() const {return m_full_range_flag;} 82 | 83 | 84 | #endif //LIBHEIF_NCLX_H 85 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/plugin_registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2017 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef LIBHEIF_PLUGIN_REGISTRY_H 22 | #define LIBHEIF_PLUGIN_REGISTRY_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "error.h" 31 | 32 | #include "heif.h" 33 | #include "heif_plugin.h" 34 | 35 | 36 | struct heif_encoder_descriptor 37 | { 38 | const struct heif_encoder_plugin* plugin; 39 | 40 | const char* get_name() const { return plugin->get_plugin_name(); } 41 | 42 | enum heif_compression_format get_compression_format() const { return plugin->compression_format; } 43 | }; 44 | 45 | 46 | struct encoder_descriptor_priority_order 47 | { 48 | bool operator()(const std::unique_ptr& a, 49 | const std::unique_ptr& b) const 50 | { 51 | return a->plugin->priority > b->plugin->priority; // highest priority first 52 | } 53 | }; 54 | 55 | 56 | extern std::set s_decoder_plugins; 57 | 58 | extern std::multiset, 59 | encoder_descriptor_priority_order> s_encoder_descriptors; 60 | 61 | void register_default_plugins(); 62 | 63 | void register_decoder(const heif_decoder_plugin* decoder_plugin); 64 | 65 | void register_encoder(const heif_encoder_plugin* encoder_plugin); 66 | 67 | const struct heif_decoder_plugin* get_decoder(enum heif_compression_format type, const char* name_id); 68 | 69 | const struct heif_encoder_plugin* get_encoder(enum heif_compression_format type); 70 | 71 | std::vector 72 | get_filtered_encoder_descriptors(enum heif_compression_format, 73 | const char* name); 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/plugins_unix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2023 Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | #ifndef LIBHEIF_PLUGINS_UNIX_H 22 | #define LIBHEIF_PLUGINS_UNIX_H 23 | 24 | #include 25 | #include 26 | #include "init.h" 27 | 28 | std::vector get_plugin_directories_from_environment_variable_unix(); 29 | 30 | std::vector list_all_potential_plugins_in_directory_unix(const char*); 31 | 32 | class PluginLibrary_Unix : public PluginLibrary 33 | { 34 | public: 35 | heif_error load_from_file(const char* filename) override; 36 | 37 | void release() override; 38 | 39 | heif_plugin_info* get_plugin_info() override { return m_plugin_info; } 40 | 41 | bool operator==(const PluginLibrary_Unix& b) const 42 | { 43 | return m_library_handle == b.m_library_handle; 44 | } 45 | 46 | private: 47 | void* m_library_handle = nullptr; 48 | heif_plugin_info* m_plugin_info = nullptr; 49 | }; 50 | 51 | #endif //LIBHEIF_PLUGINS_UNIX_H 52 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/plugins_windows.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2023 Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | 21 | 22 | #ifndef LIBHEIF_PLUGINS_WINDOWS_H 23 | #define LIBHEIF_PLUGINS_WINDOWS_H 24 | 25 | #include 26 | #include 27 | #include "init.h" 28 | #include 29 | 30 | std::vector get_plugin_directories_from_environment_variable_windows(); 31 | 32 | std::vector list_all_potential_plugins_in_directory_windows(const char*); 33 | 34 | class PluginLibrary_Windows : public PluginLibrary 35 | { 36 | public: 37 | heif_error load_from_file(const char* filename) override; 38 | 39 | void release() override; 40 | 41 | heif_plugin_info* get_plugin_info() override { return m_plugin_info; } 42 | 43 | bool operator==(const PluginLibrary_Windows& b) const 44 | { 45 | return m_filename == b.m_filename; 46 | } 47 | 48 | private: 49 | std::string m_filename; 50 | HMODULE m_library_handle = nullptr; 51 | heif_plugin_info* m_plugin_info = nullptr; 52 | }; 53 | 54 | #endif //LIBHEIF_PLUGINS_WINDOWS_H 55 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/include/libheif/security_limits.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HEIF codec. 3 | * Copyright (c) 2018 struktur AG, Dirk Farin 4 | * 5 | * This file is part of libheif. 6 | * 7 | * libheif is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Lesser General Public License as 9 | * published by the Free Software Foundation, either version 3 of 10 | * the License, or (at your option) any later version. 11 | * 12 | * libheif is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * along with libheif. If not, see . 19 | */ 20 | #ifndef LIBHEIF_SECURITY_LIMITS_H 21 | #define LIBHEIF_SECURITY_LIMITS_H 22 | 23 | #if defined(HAVE_CONFIG_H) 24 | #include "config.h" 25 | #endif 26 | 27 | #include 28 | #include 29 | 30 | static const size_t MAX_CHILDREN_PER_BOX = 20000; 31 | static const int MAX_ILOC_ITEMS = 20000; 32 | static const int MAX_ILOC_EXTENTS_PER_ITEM = 32; 33 | static const int MAX_MEMORY_BLOCK_SIZE = 512 * 1024 * 1024; // 512 MB 34 | 35 | // Artificial limit to avoid allocating too much memory. 36 | // 32768^2 = 1.5 GB as YUV-4:2:0 or 4 GB as RGB32 37 | static const int MAX_IMAGE_WIDTH = 32768; 38 | static const int MAX_IMAGE_HEIGHT = 32768; 39 | 40 | // Maximum nesting level of boxes in input files. 41 | // We put a limit on this to avoid unlimited stack usage by malicious input files. 42 | static const int MAX_BOX_NESTING_LEVEL = 20; 43 | 44 | static const int MAX_BOX_SIZE = 0x7FFFFFFF; // 2 GB 45 | static const int64_t MAX_LARGE_BOX_SIZE = 0x0FFFFFFFFFFFFFFF; 46 | static const int64_t MAX_FILE_POS = 0x007FFFFFFFFFFFFFLL; // maximum file position 47 | static const int MAX_FRACTION_VALUE = 0x10000; 48 | 49 | #endif // LIBHEIF_SECURITY_LIMITS_H 50 | -------------------------------------------------------------------------------- /src/JPEGView/libheif/lib/heif.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libheif/lib/heif.lib -------------------------------------------------------------------------------- /src/JPEGView/libheif/lib64/heif.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libheif/lib64/heif.lib -------------------------------------------------------------------------------- /src/JPEGView/libjpeg-turbo/README.md: -------------------------------------------------------------------------------- 1 | # include 2 | 3 | Copied from the build output of extras\libjpeg-turbo: 4 | jconfig.h 5 | 6 | Remaining header files copied from extras\libjpeg-turbo. 7 | 8 | # lib 9 | 10 | Built libraries of 32-bit variant 11 | 12 | 1. Initialize MSVS Tools 32-bit environment 13 | 2. Create a build directory 14 | 3. Generate NMake files. 15 | From build directory run: 16 | > cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release 17 | 4. Build it: 18 | > nmake 19 | 5. Copy *.lib files into `lib` directory. 20 | 21 | # lib64 22 | 23 | Built libraries of 64-bit variant 24 | 25 | 1. Initialize MSVS Tools 64-bit environment 26 | 27 | (follow steps 2-4 above) 28 | 29 | 5. Copy *.lib files into `lib64` directory -------------------------------------------------------------------------------- /src/JPEGView/libjpeg-turbo/include/jconfig.h: -------------------------------------------------------------------------------- 1 | /* Version ID for the JPEG library. 2 | * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". 3 | */ 4 | #define JPEG_LIB_VERSION 62 5 | 6 | /* libjpeg-turbo version */ 7 | #define LIBJPEG_TURBO_VERSION 2.1.91 8 | 9 | /* libjpeg-turbo version in integer form */ 10 | #define LIBJPEG_TURBO_VERSION_NUMBER 2001091 11 | 12 | /* Support arithmetic encoding when using 8-bit samples */ 13 | #define C_ARITH_CODING_SUPPORTED 1 14 | 15 | /* Support arithmetic decoding when using 8-bit samples */ 16 | #define D_ARITH_CODING_SUPPORTED 1 17 | 18 | /* Support in-memory source/destination managers */ 19 | #define MEM_SRCDST_SUPPORTED 1 20 | 21 | /* Use accelerated SIMD routines when using 8-bit samples */ 22 | #define WITH_SIMD 1 23 | 24 | /* This version of libjpeg-turbo supports run-time selection of data precision, 25 | * so BITS_IN_JSAMPLE is no longer used to specify the data precision at build 26 | * time. However, some downstream software expects the macro to be defined. 27 | * Since 12-bit data precision is an opt-in feature that requires explicitly 28 | * calling 12-bit-specific libjpeg API functions and using 12-bit-specific data 29 | * types, the unmodified portion of the libjpeg API still behaves as if it were 30 | * built for 8-bit precision, and JSAMPLE is still literally an 8-bit data 31 | * type. Thus, it is correct to define BITS_IN_JSAMPLE to 8 here. 32 | */ 33 | #ifndef BITS_IN_JSAMPLE 34 | #define BITS_IN_JSAMPLE 8 35 | #endif 36 | 37 | #ifdef _WIN32 38 | 39 | #undef RIGHT_SHIFT_IS_UNSIGNED 40 | 41 | /* Define "boolean" as unsigned char, not int, per Windows custom */ 42 | #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ 43 | typedef unsigned char boolean; 44 | #endif 45 | #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 46 | 47 | /* Define "INT32" as int, not long, per Windows custom */ 48 | #if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ 49 | typedef short INT16; 50 | typedef signed int INT32; 51 | #endif 52 | #define XMD_H /* prevent jmorecfg.h from redefining it */ 53 | 54 | #else 55 | 56 | /* Define if your (broken) compiler shifts signed values as if they were 57 | unsigned. */ 58 | /* #undef RIGHT_SHIFT_IS_UNSIGNED */ 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/JPEGView/libjpeg-turbo/lib/turbojpeg-static.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjpeg-turbo/lib/turbojpeg-static.lib -------------------------------------------------------------------------------- /src/JPEGView/libjpeg-turbo/lib64/turbojpeg-static.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjpeg-turbo/lib64/turbojpeg-static.lib -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin/brotlicommon.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin/brotlicommon.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin/brotlidec.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin/brotlidec.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin/jxl_dec.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin/jxl_dec.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin/jxl_threads.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin/jxl_threads.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin64/brotlicommon.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin64/brotlicommon.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin64/brotlidec.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin64/brotlidec.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin64/jxl_dec.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin64/jxl_dec.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/bin64/jxl_threads.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/bin64/jxl_threads.dll -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/decode_cxx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | /// @addtogroup libjxl_cpp 7 | /// @{ 8 | /// 9 | /// @file decode_cxx.h 10 | /// @brief C++ header-only helper for @ref decode.h. 11 | /// 12 | /// There's no binary library associated with the header since this is a header 13 | /// only library. 14 | 15 | #ifndef JXL_DECODE_CXX_H_ 16 | #define JXL_DECODE_CXX_H_ 17 | 18 | #include 19 | 20 | #include 21 | 22 | #if !(defined(__cplusplus) || defined(c_plusplus)) 23 | #error "This a C++ only header. Use jxl/decode.h from C sources." 24 | #endif 25 | 26 | /// Struct to call JxlDecoderDestroy from the JxlDecoderPtr unique_ptr. 27 | struct JxlDecoderDestroyStruct { 28 | /// Calls @ref JxlDecoderDestroy() on the passed decoder. 29 | void operator()(JxlDecoder* decoder) { JxlDecoderDestroy(decoder); } 30 | }; 31 | 32 | /// std::unique_ptr<> type that calls JxlDecoderDestroy() when releasing the 33 | /// decoder. 34 | /// 35 | /// Use this helper type from C++ sources to ensure the decoder is destroyed and 36 | /// their internal resources released. 37 | typedef std::unique_ptr JxlDecoderPtr; 38 | 39 | /// Creates an instance of JxlDecoder into a JxlDecoderPtr and initializes it. 40 | /// 41 | /// This function returns a unique_ptr that will call JxlDecoderDestroy() when 42 | /// releasing the pointer. See @ref JxlDecoderCreate for details on the 43 | /// instance creation. 44 | /// 45 | /// @param memory_manager custom allocator function. It may be NULL. The memory 46 | /// manager will be copied internally. 47 | /// @return a @c NULL JxlDecoderPtr if the instance can not be allocated or 48 | /// initialized 49 | /// @return initialized JxlDecoderPtr instance otherwise. 50 | static inline JxlDecoderPtr JxlDecoderMake( 51 | const JxlMemoryManager* memory_manager) { 52 | return JxlDecoderPtr(JxlDecoderCreate(memory_manager)); 53 | } 54 | 55 | #endif // JXL_DECODE_CXX_H_ 56 | 57 | /// @} 58 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/encode_cxx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | /// @addtogroup libjxl_cpp 7 | ///@{ 8 | /// 9 | /// @file encode_cxx.h 10 | /// @brief C++ header-only helper for @ref encode.h. 11 | /// 12 | /// There's no binary library associated with the header since this is a header 13 | /// only library. 14 | 15 | #ifndef JXL_ENCODE_CXX_H_ 16 | #define JXL_ENCODE_CXX_H_ 17 | 18 | #include 19 | 20 | #include 21 | 22 | #if !(defined(__cplusplus) || defined(c_plusplus)) 23 | #error "This a C++ only header. Use jxl/encode.h from C sources." 24 | #endif 25 | 26 | /// Struct to call JxlEncoderDestroy from the JxlEncoderPtr unique_ptr. 27 | struct JxlEncoderDestroyStruct { 28 | /// Calls @ref JxlEncoderDestroy() on the passed encoder. 29 | void operator()(JxlEncoder* encoder) { JxlEncoderDestroy(encoder); } 30 | }; 31 | 32 | /// std::unique_ptr<> type that calls JxlEncoderDestroy() when releasing the 33 | /// encoder. 34 | /// 35 | /// Use this helper type from C++ sources to ensure the encoder is destroyed and 36 | /// their internal resources released. 37 | typedef std::unique_ptr JxlEncoderPtr; 38 | 39 | /// Creates an instance of JxlEncoder into a JxlEncoderPtr and initializes it. 40 | /// 41 | /// This function returns a unique_ptr that will call JxlEncoderDestroy() when 42 | /// releasing the pointer. See @ref JxlEncoderCreate for details on the 43 | /// instance creation. 44 | /// 45 | /// @param memory_manager custom allocator function. It may be NULL. The memory 46 | /// manager will be copied internally. 47 | /// @return a @c NULL JxlEncoderPtr if the instance can not be allocated or 48 | /// initialized 49 | /// @return initialized JxlEncoderPtr instance otherwise. 50 | static inline JxlEncoderPtr JxlEncoderMake( 51 | const JxlMemoryManager* memory_manager) { 52 | return JxlEncoderPtr(JxlEncoderCreate(memory_manager)); 53 | } 54 | 55 | #endif // JXL_ENCODE_CXX_H_ 56 | 57 | /// @} 58 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/jxl_export.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef JXL_EXPORT_H 3 | #define JXL_EXPORT_H 4 | 5 | #ifdef JXL_STATIC_DEFINE 6 | # define JXL_EXPORT 7 | # define JXL_NO_EXPORT 8 | #else 9 | # ifndef JXL_EXPORT 10 | # ifdef JXL_INTERNAL_LIBRARY_BUILD 11 | /* We are building this library */ 12 | # define JXL_EXPORT __declspec(dllexport) 13 | # else 14 | /* We are using this library */ 15 | # define JXL_EXPORT __declspec(dllimport) 16 | # endif 17 | # endif 18 | 19 | # ifndef JXL_NO_EXPORT 20 | # define JXL_NO_EXPORT 21 | # endif 22 | #endif 23 | 24 | #ifndef JXL_DEPRECATED 25 | # define JXL_DEPRECATED __declspec(deprecated) 26 | #endif 27 | 28 | #ifndef JXL_DEPRECATED_EXPORT 29 | # define JXL_DEPRECATED_EXPORT JXL_EXPORT JXL_DEPRECATED 30 | #endif 31 | 32 | #ifndef JXL_DEPRECATED_NO_EXPORT 33 | # define JXL_DEPRECATED_NO_EXPORT JXL_NO_EXPORT JXL_DEPRECATED 34 | #endif 35 | 36 | #if 0 /* DEFINE_NO_DEPRECATED */ 37 | # ifndef JXL_NO_DEPRECATED 38 | # define JXL_NO_DEPRECATED 39 | # endif 40 | #endif 41 | 42 | #endif /* JXL_EXPORT_H */ 43 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/jxl_threads_export.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef JXL_THREADS_EXPORT_H 3 | #define JXL_THREADS_EXPORT_H 4 | 5 | #ifdef JXL_THREADS_STATIC_DEFINE 6 | # define JXL_THREADS_EXPORT 7 | # define JXL_THREADS_NO_EXPORT 8 | #else 9 | # ifndef JXL_THREADS_EXPORT 10 | # ifdef JXL_THREADS_INTERNAL_LIBRARY_BUILD 11 | /* We are building this library */ 12 | # define JXL_THREADS_EXPORT __declspec(dllexport) 13 | # else 14 | /* We are using this library */ 15 | # define JXL_THREADS_EXPORT __declspec(dllimport) 16 | # endif 17 | # endif 18 | 19 | # ifndef JXL_THREADS_NO_EXPORT 20 | # define JXL_THREADS_NO_EXPORT 21 | # endif 22 | #endif 23 | 24 | #ifndef JXL_THREADS_DEPRECATED 25 | # define JXL_THREADS_DEPRECATED __declspec(deprecated) 26 | #endif 27 | 28 | #ifndef JXL_THREADS_DEPRECATED_EXPORT 29 | # define JXL_THREADS_DEPRECATED_EXPORT JXL_THREADS_EXPORT JXL_THREADS_DEPRECATED 30 | #endif 31 | 32 | #ifndef JXL_THREADS_DEPRECATED_NO_EXPORT 33 | # define JXL_THREADS_DEPRECATED_NO_EXPORT JXL_THREADS_NO_EXPORT JXL_THREADS_DEPRECATED 34 | #endif 35 | 36 | #if 0 /* DEFINE_NO_DEPRECATED */ 37 | # ifndef JXL_THREADS_NO_DEPRECATED 38 | # define JXL_THREADS_NO_DEPRECATED 39 | # endif 40 | #endif 41 | 42 | #endif /* JXL_THREADS_EXPORT_H */ 43 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/memory_manager.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 | * 3 | * Use of this source code is governed by a BSD-style 4 | * license that can be found in the LICENSE file. 5 | */ 6 | 7 | /** @addtogroup libjxl_common 8 | * @{ 9 | * @file memory_manager.h 10 | * @brief Abstraction functions used by JPEG XL to allocate memory. 11 | */ 12 | 13 | #ifndef JXL_MEMORY_MANAGER_H_ 14 | #define JXL_MEMORY_MANAGER_H_ 15 | 16 | #include 17 | 18 | #if defined(__cplusplus) || defined(c_plusplus) 19 | extern "C" { 20 | #endif 21 | 22 | /** 23 | * Allocating function for a memory region of a given size. 24 | * 25 | * Allocates a contiguous memory region of size @p size bytes. The returned 26 | * memory may not be aligned to a specific size or initialized at all. 27 | * 28 | * @param opaque custom memory manager handle provided by the caller. 29 | * @param size in bytes of the requested memory region. 30 | * @return @c NULL if the memory can not be allocated, 31 | * @return pointer to the memory otherwise. 32 | */ 33 | typedef void* (*jpegxl_alloc_func)(void* opaque, size_t size); 34 | 35 | /** 36 | * Deallocating function pointer type. 37 | * 38 | * This function @b MUST do nothing if @p address is @c NULL. 39 | * 40 | * @param opaque custom memory manager handle provided by the caller. 41 | * @param address memory region pointer returned by ::jpegxl_alloc_func, or @c 42 | * NULL. 43 | */ 44 | typedef void (*jpegxl_free_func)(void* opaque, void* address); 45 | 46 | /** 47 | * Memory Manager struct. 48 | * These functions, when provided by the caller, will be used to handle memory 49 | * allocations. 50 | */ 51 | typedef struct JxlMemoryManagerStruct { 52 | /** The opaque pointer that will be passed as the first parameter to all the 53 | * functions in this struct. */ 54 | void* opaque; 55 | 56 | /** Memory allocation function. This can be NULL if and only if also the 57 | * free() member in this class is NULL. All dynamic memory will be allocated 58 | * and freed with these functions if they are not NULL. */ 59 | jpegxl_alloc_func alloc; 60 | /** Free function matching the alloc() member. */ 61 | jpegxl_free_func free; 62 | 63 | /* TODO(deymo): Add cache-aligned alloc/free functions here. */ 64 | } JxlMemoryManager; 65 | 66 | #if defined(__cplusplus) || defined(c_plusplus) 67 | } 68 | #endif 69 | 70 | #endif /* JXL_MEMORY_MANAGER_H_ */ 71 | 72 | /** @}*/ 73 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/resizable_parallel_runner_cxx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | /// @addtogroup libjxl_cpp 7 | /// @{ 8 | /// 9 | /// @file resizable_parallel_runner_cxx.h 10 | /// @ingroup libjxl_threads 11 | /// @brief C++ header-only helper for @ref resizable_parallel_runner.h. 12 | /// 13 | /// There's no binary library associated with the header since this is a header 14 | /// only library. 15 | 16 | #ifndef JXL_RESIZABLE_PARALLEL_RUNNER_CXX_H_ 17 | #define JXL_RESIZABLE_PARALLEL_RUNNER_CXX_H_ 18 | 19 | #include 20 | 21 | #include 22 | 23 | #if !(defined(__cplusplus) || defined(c_plusplus)) 24 | #error \ 25 | "This a C++ only header. Use jxl/jxl_resizable_parallel_runner.h from C" \ 26 | "sources." 27 | #endif 28 | 29 | /// Struct to call JxlResizableParallelRunnerDestroy from the 30 | /// JxlResizableParallelRunnerPtr unique_ptr. 31 | struct JxlResizableParallelRunnerDestroyStruct { 32 | /// Calls @ref JxlResizableParallelRunnerDestroy() on the passed runner. 33 | void operator()(void* runner) { JxlResizableParallelRunnerDestroy(runner); } 34 | }; 35 | 36 | /// std::unique_ptr<> type that calls JxlResizableParallelRunnerDestroy() when 37 | /// releasing the runner. 38 | /// 39 | /// Use this helper type from C++ sources to ensure the runner is destroyed and 40 | /// their internal resources released. 41 | typedef std::unique_ptr 42 | JxlResizableParallelRunnerPtr; 43 | 44 | /// Creates an instance of JxlResizableParallelRunner into a 45 | /// JxlResizableParallelRunnerPtr and initializes it. 46 | /// 47 | /// This function returns a unique_ptr that will call 48 | /// JxlResizableParallelRunnerDestroy() when releasing the pointer. See @ref 49 | /// JxlResizableParallelRunnerCreate for details on the instance creation. 50 | /// 51 | /// @param memory_manager custom allocator function. It may be NULL. The memory 52 | /// manager will be copied internally. 53 | /// @return a @c NULL JxlResizableParallelRunnerPtr if the instance can not be 54 | /// allocated or initialized 55 | /// @return initialized JxlResizableParallelRunnerPtr instance otherwise. 56 | static inline JxlResizableParallelRunnerPtr JxlResizableParallelRunnerMake( 57 | const JxlMemoryManager* memory_manager) { 58 | return JxlResizableParallelRunnerPtr( 59 | JxlResizableParallelRunnerCreate(memory_manager)); 60 | } 61 | 62 | #endif // JXL_RESIZABLE_PARALLEL_RUNNER_CXX_H_ 63 | 64 | /// @} 65 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/thread_parallel_runner_cxx.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | /// @addtogroup libjxl_cpp 7 | /// @{ 8 | /// 9 | /// @file thread_parallel_runner_cxx.h 10 | /// @brief C++ header-only helper for @ref thread_parallel_runner.h. 11 | /// 12 | /// There's no binary library associated with the header since this is a header 13 | /// only library. 14 | 15 | #ifndef JXL_THREAD_PARALLEL_RUNNER_CXX_H_ 16 | #define JXL_THREAD_PARALLEL_RUNNER_CXX_H_ 17 | 18 | #include 19 | 20 | #include 21 | 22 | #if !(defined(__cplusplus) || defined(c_plusplus)) 23 | #error \ 24 | "This a C++ only header. Use jxl/jxl_thread_parallel_runner.h from C" \ 25 | "sources." 26 | #endif 27 | 28 | /// Struct to call JxlThreadParallelRunnerDestroy from the 29 | /// JxlThreadParallelRunnerPtr unique_ptr. 30 | struct JxlThreadParallelRunnerDestroyStruct { 31 | /// Calls @ref JxlThreadParallelRunnerDestroy() on the passed runner. 32 | void operator()(void* runner) { JxlThreadParallelRunnerDestroy(runner); } 33 | }; 34 | 35 | /// std::unique_ptr<> type that calls JxlThreadParallelRunnerDestroy() when 36 | /// releasing the runner. 37 | /// 38 | /// Use this helper type from C++ sources to ensure the runner is destroyed and 39 | /// their internal resources released. 40 | typedef std::unique_ptr 41 | JxlThreadParallelRunnerPtr; 42 | 43 | /// Creates an instance of JxlThreadParallelRunner into a 44 | /// JxlThreadParallelRunnerPtr and initializes it. 45 | /// 46 | /// This function returns a unique_ptr that will call 47 | /// JxlThreadParallelRunnerDestroy() when releasing the pointer. See @ref 48 | /// JxlThreadParallelRunnerCreate for details on the instance creation. 49 | /// 50 | /// @param memory_manager custom allocator function. It may be NULL. The memory 51 | /// manager will be copied internally. 52 | /// @param num_worker_threads the number of worker threads to create. 53 | /// @return a @c NULL JxlThreadParallelRunnerPtr if the instance can not be 54 | /// allocated or initialized 55 | /// @return initialized JxlThreadParallelRunnerPtr instance otherwise. 56 | static inline JxlThreadParallelRunnerPtr JxlThreadParallelRunnerMake( 57 | const JxlMemoryManager* memory_manager, size_t num_worker_threads) { 58 | return JxlThreadParallelRunnerPtr( 59 | JxlThreadParallelRunnerCreate(memory_manager, num_worker_threads)); 60 | } 61 | 62 | #endif // JXL_THREAD_PARALLEL_RUNNER_CXX_H_ 63 | 64 | /// @} 65 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/include/jxl/version.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) the JPEG XL Project Authors. All rights reserved. 2 | * 3 | * Use of this source code is governed by a BSD-style 4 | * license that can be found in the LICENSE file. 5 | */ 6 | 7 | /** @addtogroup libjxl_common 8 | * @{ 9 | * @file version.h 10 | * @brief libjxl version information 11 | */ 12 | 13 | #ifndef JXL_VERSION_H_ 14 | #define JXL_VERSION_H_ 15 | 16 | #define JPEGXL_MAJOR_VERSION 0 ///< JPEG XL Major version 17 | #define JPEGXL_MINOR_VERSION 9 ///< JPEG XL Minor version 18 | #define JPEGXL_PATCH_VERSION 0 ///< JPEG XL Patch version 19 | 20 | /** Can be used to conditionally compile code for a specific JXL version 21 | * @param[maj] major version 22 | * @param[min] minor version 23 | * 24 | * @code 25 | * #if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,8,0) 26 | * // use old/deprecated api 27 | * #else 28 | * // use current api 29 | * #endif 30 | * @endcode 31 | */ 32 | #define JPEGXL_COMPUTE_NUMERIC_VERSION(major,minor,patch) ((major<<24) | (minor<<16) | (patch<<8) | 0) 33 | 34 | /* Numeric representation of the version */ 35 | #define JPEGXL_NUMERIC_VERSION JPEGXL_COMPUTE_NUMERIC_VERSION(JPEGXL_MAJOR_VERSION,JPEGXL_MINOR_VERSION,JPEGXL_PATCH_VERSION) 36 | 37 | #endif /* JXL_VERSION_H_ */ 38 | 39 | /** @}*/ 40 | -------------------------------------------------------------------------------- /src/JPEGView/libjxl/lib/jxl_dec.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/lib/jxl_dec.lib -------------------------------------------------------------------------------- /src/JPEGView/libjxl/lib/jxl_threads.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/lib/jxl_threads.lib -------------------------------------------------------------------------------- /src/JPEGView/libjxl/lib64/jxl_dec.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/lib64/jxl_dec.lib -------------------------------------------------------------------------------- /src/JPEGView/libjxl/lib64/jxl_threads.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libjxl/lib64/jxl_threads.lib -------------------------------------------------------------------------------- /src/JPEGView/libpng-apng/lib/libpng16.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libpng-apng/lib/libpng16.lib -------------------------------------------------------------------------------- /src/JPEGView/libpng-apng/lib/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libpng-apng/lib/zlib.lib -------------------------------------------------------------------------------- /src/JPEGView/libpng-apng/lib64/libpng16.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libpng-apng/lib64/libpng16.lib -------------------------------------------------------------------------------- /src/JPEGView/libpng-apng/lib64/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libpng-apng/lib64/zlib.lib -------------------------------------------------------------------------------- /src/JPEGView/libraw/bin/libraw.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libraw/bin/libraw.dll -------------------------------------------------------------------------------- /src/JPEGView/libraw/bin64/libraw.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libraw/bin64/libraw.dll -------------------------------------------------------------------------------- /src/JPEGView/libraw/include/libraw/libraw_version.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * File: libraw_version.h 3 | * Copyright 2008-2021 LibRaw LLC (info@libraw.org) 4 | * Created: Mon Sept 8, 2008 5 | * 6 | * LibRaw C++ interface 7 | * 8 | 9 | LibRaw is free software; you can redistribute it and/or modify 10 | it under the terms of the one of two licenses as you choose: 11 | 12 | 1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1 13 | (See the file LICENSE.LGPL provided in LibRaw distribution archive for details). 14 | 15 | 2. COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 16 | (See the file LICENSE.CDDL provided in LibRaw distribution archive for details). 17 | 18 | */ 19 | 20 | #ifndef __VERSION_H 21 | #define __VERSION_H 22 | 23 | #define LIBRAW_MAJOR_VERSION 0 24 | #define LIBRAW_MINOR_VERSION 21 25 | #define LIBRAW_PATCH_VERSION 1 26 | #define LIBRAW_VERSION_TAIL Release 27 | 28 | #define LIBRAW_SHLIB_CURRENT 23 29 | #define LIBRAW_SHLIB_REVISION 0 30 | #define LIBRAW_SHLIB_AGE 0 31 | 32 | #define _LIBRAW_VERSION_MAKE(a, b, c, d) #a "." #b "." #c "-" #d 33 | #define LIBRAW_VERSION_MAKE(a, b, c, d) _LIBRAW_VERSION_MAKE(a, b, c, d) 34 | 35 | #define LIBRAW_VERSION_STR \ 36 | LIBRAW_VERSION_MAKE(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, \ 37 | LIBRAW_PATCH_VERSION, LIBRAW_VERSION_TAIL) 38 | 39 | #define LIBRAW_MAKE_VERSION(major, minor, patch) \ 40 | (((major) << 16) | ((minor) << 8) | (patch)) 41 | 42 | #define LIBRAW_VERSION \ 43 | LIBRAW_MAKE_VERSION(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, \ 44 | LIBRAW_PATCH_VERSION) 45 | 46 | #define LIBRAW_CHECK_VERSION(major, minor, patch) \ 47 | (LibRaw::versionNumber() >= LIBRAW_MAKE_VERSION(major, minor, patch)) 48 | 49 | #define LIBRAW_RUNTIME_CHECK_VERSION_EXACT() \ 50 | ((LibRaw::versionNumber() & 0xffff00) == \ 51 | LIBRAW_MAKE_VERSION(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, 0)) 52 | 53 | #define LIBRAW_RUNTIME_CHECK_VERSION_NOTLESS() \ 54 | ((LibRaw::versionNumber() & 0xffff00) >= \ 55 | LIBRAW_MAKE_VERSION(LIBRAW_MAJOR_VERSION, LIBRAW_MINOR_VERSION, 0)) 56 | 57 | #define LIBRAW_COMPILE_CHECK_VERSION(major, minor) \ 58 | (LIBRAW_MAKE_VERSION(major, minor, 0) == (LIBRAW_VERSION & 0xffff00)) 59 | 60 | #define LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(major, minor) \ 61 | (LIBRAW_MAKE_VERSION(major, minor, 0) <= (LIBRAW_VERSION & 0xffff00)) 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/JPEGView/libraw/lib/libraw.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libraw/lib/libraw.lib -------------------------------------------------------------------------------- /src/JPEGView/libraw/lib64/libraw.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libraw/lib64/libraw.lib -------------------------------------------------------------------------------- /src/JPEGView/libwebp/include/webp/types.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 Google Inc. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style license 4 | // that can be found in the COPYING file in the root of the source 5 | // tree. An additional intellectual property rights grant can be found 6 | // in the file PATENTS. All contributing project authors may 7 | // be found in the AUTHORS file in the root of the source tree. 8 | // ----------------------------------------------------------------------------- 9 | // 10 | // Common types + memory wrappers 11 | // 12 | // Author: Skal (pascal.massimino@gmail.com) 13 | 14 | #ifndef WEBP_WEBP_TYPES_H_ 15 | #define WEBP_WEBP_TYPES_H_ 16 | 17 | #include // for size_t 18 | 19 | #ifndef _MSC_VER 20 | #include 21 | #if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \ 22 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) 23 | #define WEBP_INLINE inline 24 | #else 25 | #define WEBP_INLINE 26 | #endif 27 | #else 28 | typedef signed char int8_t; 29 | typedef unsigned char uint8_t; 30 | typedef signed short int16_t; 31 | typedef unsigned short uint16_t; 32 | typedef signed int int32_t; 33 | typedef unsigned int uint32_t; 34 | typedef unsigned long long int uint64_t; 35 | typedef long long int int64_t; 36 | #define WEBP_INLINE __forceinline 37 | #endif /* _MSC_VER */ 38 | 39 | #ifndef WEBP_EXTERN 40 | // This explicitly marks library functions and allows for changing the 41 | // signature for e.g., Windows DLL builds. 42 | # if defined(__GNUC__) && __GNUC__ >= 4 43 | # define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) 44 | # else 45 | # if defined(_MSC_VER) && defined(WEBP_DLL) 46 | # define WEBP_EXTERN __declspec(dllexport) 47 | # else 48 | # define WEBP_EXTERN extern 49 | # endif 50 | # endif /* __GNUC__ >= 4 */ 51 | #endif /* WEBP_EXTERN */ 52 | 53 | // Macro to check ABI compatibility (same major revision number) 54 | #define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8)) 55 | 56 | #ifdef __cplusplus 57 | extern "C" { 58 | #endif 59 | 60 | // Allocates 'size' bytes of memory. Returns NULL upon error. Memory 61 | // must be deallocated by calling WebPFree(). This function is made available 62 | // by the core 'libwebp' library. 63 | WEBP_EXTERN void* WebPMalloc(size_t size); 64 | 65 | // Releases memory returned by the WebPDecode*() functions (from decode.h). 66 | WEBP_EXTERN void WebPFree(void* ptr); 67 | 68 | #ifdef __cplusplus 69 | } // extern "C" 70 | #endif 71 | 72 | #endif // WEBP_WEBP_TYPES_H_ 73 | -------------------------------------------------------------------------------- /src/JPEGView/libwebp/lib/libwebp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libwebp/lib/libwebp.lib -------------------------------------------------------------------------------- /src/JPEGView/libwebp/lib/libwebpdemux.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libwebp/lib/libwebpdemux.lib -------------------------------------------------------------------------------- /src/JPEGView/libwebp/lib64/libwebp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libwebp/lib64/libwebp.lib -------------------------------------------------------------------------------- /src/JPEGView/libwebp/lib64/libwebpdemux.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/libwebp/lib64/libwebpdemux.lib -------------------------------------------------------------------------------- /src/JPEGView/res/JPEGView.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/JPEGView/res/JPEGView.ico -------------------------------------------------------------------------------- /src/JPEGView/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // JPEGView.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | #if (_ATL_VER < 0x0700) 8 | #include 9 | #endif //(_ATL_VER < 0x0700) 10 | 11 | #if defined(_MSC_VER) && (_MSC_VER >= 1900) 12 | 13 | FILE _iob[] = { *stdin, *stdout, *stderr }; 14 | 15 | extern "C" FILE * __cdecl __iob_func(void) 16 | { 17 | return _iob; 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /src/JPEGView/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | 5 | #pragma once 6 | 7 | // disable these useless warnings 8 | #pragma warning(disable:4018) 9 | #pragma warning(disable:4800) 10 | 11 | // Change these values to use different versions 12 | #define WINVER 0x0501 13 | #define _WIN32_WINNT 0x0501 14 | #define _WIN32_IE 0x0600 15 | #define _RICHEDIT_VER 0x0300 16 | 17 | #define _CRT_SECURE_NO_DEPRECATE 18 | 19 | #include 20 | #include 21 | #pragma warning(push) 22 | #pragma warning(disable:4996) 23 | #pragma warning(disable:4838) 24 | #pragma warning(disable:4302) 25 | #include 26 | #include 27 | 28 | extern CAppModule _Module; 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #pragma warning(pop) 39 | 40 | // STL stuff 41 | #include 42 | 43 | #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 44 | 45 | // own stuff 46 | #include "ImageProcessingTypes.h" 47 | 48 | #define VK_PAGE_UP 0x021 49 | #define VK_PAGE_DOWN 0x22 50 | #define VK_PLUS 0x6b 51 | #define VK_MINUS 0x6d 52 | 53 | // a type that has enough bits to hold a pointer and allowing arithmetic operations 54 | #ifdef _WIN64 55 | #define PTR_INTEGRAL_TYPE unsigned long long 56 | #else 57 | #define PTR_INTEGRAL_TYPE unsigned int 58 | #endif 59 | 60 | #ifndef _UNICODE 61 | #error _UNICODE symbol must be defined 62 | #endif 63 | 64 | #if defined _M_IX86 65 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 66 | #elif defined _M_IA64 67 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") 68 | #elif defined _M_X64 69 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 70 | #else 71 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 72 | #endif 73 | -------------------------------------------------------------------------------- /src/JPEGView_VS2017.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.33026.149 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JPEGView_VS2017", "JPEGView\JPEGView_VS2017.vcxproj", "{F6D355BF-A245-46FA-AE41-DAA541556245}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {91D548E5-3C0D-4AE3-9429-391910852D8C} = {91D548E5-3C0D-4AE3-9429-391910852D8C} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WICLoader_VS2017", "WICLoader\WICLoader_VS2017.vcxproj", "{91D548E5-3C0D-4AE3-9429-391910852D8C}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Win32 = Debug|Win32 16 | Debug|x64 = Debug|x64 17 | Release|Win32 = Release|Win32 18 | Release|x64 = Release|x64 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Debug|Win32.ActiveCfg = Debug|Win32 22 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Debug|Win32.Build.0 = Debug|Win32 23 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Debug|x64.ActiveCfg = Debug|x64 24 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Debug|x64.Build.0 = Debug|x64 25 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Release|Win32.ActiveCfg = Release|Win32 26 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Release|Win32.Build.0 = Release|Win32 27 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Release|x64.ActiveCfg = Release|x64 28 | {F6D355BF-A245-46FA-AE41-DAA541556245}.Release|x64.Build.0 = Release|x64 29 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Debug|Win32.ActiveCfg = Debug|Win32 30 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Debug|Win32.Build.0 = Debug|Win32 31 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Debug|x64.ActiveCfg = Debug|x64 32 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Debug|x64.Build.0 = Debug|x64 33 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Release|Win32.ActiveCfg = Release|Win32 34 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Release|Win32.Build.0 = Release|Win32 35 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Release|x64.ActiveCfg = Release|x64 36 | {91D548E5-3C0D-4AE3-9429-391910852D8C}.Release|x64.Build.0 = Release|x64 37 | EndGlobalSection 38 | GlobalSection(SolutionProperties) = preSolution 39 | HideSolutionNode = FALSE 40 | EndGlobalSection 41 | GlobalSection(ExtensibilityGlobals) = postSolution 42 | SolutionGuid = {D9D69E9B-F16C-4D81-96E4-B3E75436FD87} 43 | EndGlobalSection 44 | EndGlobal 45 | -------------------------------------------------------------------------------- /src/README.txt: -------------------------------------------------------------------------------- 1 | This directory and subdirectories hold the Solution and VCProjects. JPEGView source code. 2 | -------------------------------------------------------------------------------- /src/WICLoader/MaxImageDef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _WIN64 4 | const unsigned int MAX_IMAGE_PIXELS = 1024 * 1024 * 300; 5 | #else 6 | const unsigned int MAX_IMAGE_PIXELS = 1024 * 1024 * 100; 7 | #endif 8 | 9 | // That must not be bigger than 65535 due to internal limitations 10 | const unsigned int MAX_IMAGE_DIMENSION = 65535; -------------------------------------------------------------------------------- /src/WICLoader/WICLoader.rc: -------------------------------------------------------------------------------- 1 | 2 | ///////////////////////////////////////////////////////////////////////////// 3 | // 4 | // Version 5 | // 6 | 7 | 1 VERSIONINFO 8 | FILEVERSION 1,0,0,0 9 | PRODUCTVERSION 1,0,0,0 10 | FILEFLAGSMASK 0x3fL 11 | #ifdef _DEBUG 12 | FILEFLAGS 0x1L 13 | #else 14 | FILEFLAGS 0x0L 15 | #endif 16 | FILEOS 0x4L 17 | FILETYPE 0x2L 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "040904B0" 23 | BEGIN 24 | VALUE "CompanyName", "\0" 25 | VALUE "FileDescription", "WIC interface DLL\0" 26 | VALUE "FileVersion", "1.0.0.0\0" 27 | VALUE "InternalName", "JPEGView WICLoader\0" 28 | VALUE "LegalCopyright", "Copyright 2006-2011 David Kleiner\0" 29 | VALUE "OriginalFilename", "WICLoader.dll\0" 30 | VALUE "ProductName", "WIC Interface\0" 31 | VALUE "ProductVersion", "1.0.0.0\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x0409, 0x04B0 37 | END 38 | END 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | 42 | -------------------------------------------------------------------------------- /src/WICLoader/WICLoader.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | 40 | 41 | Resource Files 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/WICLoader/WICLoader_VS2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | 40 | 41 | Resource Files 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/WICLoader/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp 2 | #include "stdafx.h" 3 | 4 | BOOL APIENTRY DllMain( HMODULE hModule, 5 | DWORD ul_reason_for_call, 6 | LPVOID lpReserved 7 | ) 8 | { 9 | switch (ul_reason_for_call) 10 | { 11 | case DLL_PROCESS_ATTACH: 12 | case DLL_THREAD_ATTACH: 13 | case DLL_THREAD_DETACH: 14 | case DLL_PROCESS_DETACH: 15 | break; 16 | } 17 | return TRUE; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/WICLoader/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sylikc/jpegview/efd55a1a0b922bd7274c1d44717dac4104bb0fa3/src/WICLoader/stdafx.cpp -------------------------------------------------------------------------------- /src/WICLoader/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h 2 | 3 | #pragma once 4 | 5 | #include "targetver.h" 6 | 7 | #define WIN32_LEAN_AND_MEAN 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | -------------------------------------------------------------------------------- /src/WICLoader/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WINVER 0x0501 4 | #define _WIN32_WINNT 0x0501 5 | 6 | #include 7 | --------------------------------------------------------------------------------