diff --git a/.gitignore b/.gitignore index c082964..b5cb8e9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ **/Debug/ **/Release/ **/build/ +**/build_*/ *.user *.filters *.o diff --git a/Loader_Apple2/disk.dsk b/Loader_Apple2/disk.dsk index e47afcb..fae47c3 100644 Binary files a/Loader_Apple2/disk.dsk and b/Loader_Apple2/disk.dsk differ diff --git a/Readme.md b/Readme.md index 8f5be29..4a0faee 100644 --- a/Readme.md +++ b/Readme.md @@ -10,15 +10,18 @@ This repository contains three "PC" projects: And one Apple II project: * **Loader**: a program that will load and display a picture generated by the *Picture* program. A bash scripts is provided as an exemple to load the picture and the loader on an image disk. [AppleCommander](https://applecommander.github.io/) is required to do so. Once in ProDOS, just type *-DISPLAY*. -For more information about the "Hires" format and its limitations, you can refer to my [website](https://www.xtof.info/hires-graphics-apple-ii.html). +__Note:__ For more information about the "Hires" format and its limitations, you can refer to my [website](https://www.xtof.info/hires-graphics-apple-ii.html). -__Note:__ ## Windows / Linux projects (libHires, Picture, Tile) ### Dependencies -* Magick++ - * On Windows, you have provide an environment variable called *MAGICK_HOME* and pointing to the ImageMagick folder. +* Magick++, from ImageMagick 6 + * On Windows + * Download ImageMagick 6 from the [official website](https://legacy.imagemagick.org/script/install-source.php) + * Compile it in *Dynamic Multithreaded* + * Provide an environment variable called *MAGICK_HOME* and pointing to the root ImageMagick folder. + * Copy *ImageMagick-config* from the *script/* folder to *MAGICK_HOME* * On Linux, install libmagick++-dev for version 6 > sudo apt install libmagick++-6.q16-dev diff --git a/Rgb2Hires_PC/CMakeLists.txt b/Rgb2Hires_PC/CMakeLists.txt index 08a1a63..a6d838a 100644 --- a/Rgb2Hires_PC/CMakeLists.txt +++ b/Rgb2Hires_PC/CMakeLists.txt @@ -1,14 +1,34 @@ -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.12) +cmake_policy(SET CMP0074 NEW) + project (Rgb2Hires) +# flags not compatibles with magick++ +if(WIN32) + string (REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + string (REPLACE "/DWIN32" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +endif(WIN32) + # The version number. set (Rgb2Hires_VERSION_MAJOR 1) set (Rgb2Hires_VERSION_MINOR 0) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_VERBOSE_MAKEFILE ON) # dependencies -find_package(ImageMagick COMPONENTS Magick++ REQUIRED) +if(WIN32) + # imagemagik + if(NOT DEFINED ENV{MAGICK_HOME}) + message(FATAL_ERROR "Please set a MAGICK_HOME environment variable to the root directory of ImageMagick6") + endif() + find_package(ImageMagick HINTS $ENV{MAGICK_HOME} REQUIRED COMPONENTS Magick++) +else() + find_package(ImageMagick 6.9 EXACT REQUIRED COMPONENTS Magick++ ) +endif(WIN32) + +# directories +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/debug) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/release) # library add_library(${PROJECT_NAME} src/Common.h @@ -22,7 +42,7 @@ add_library(${PROJECT_NAME} src/Common.h src/Tile.cpp ) target_compile_definitions(${PROJECT_NAME} PRIVATE MAGICKCORE_QUANTUM_DEPTH=16 MAGICKCORE_HDRI_ENABLE=0) -target_include_directories(${PROJECT_NAME} PRIVATE ${ImageMagick_Magick++_INCLUDE_DIRS}) +target_include_directories(${PROJECT_NAME} PRIVATE ${ImageMagick_INCLUDE_DIRS}) # Application Picture @@ -30,9 +50,26 @@ add_executable(Picture src/App_Picture.cpp) target_compile_definitions(Picture PUBLIC MAGICKCORE_QUANTUM_DEPTH=16 MAGICKCORE_HDRI_ENABLE=0) target_include_directories(Picture PRIVATE src ${ImageMagick_INCLUDE_DIRS}) target_link_libraries(Picture ${ImageMagick_LIBRARIES} ${PROJECT_NAME}) +set_property(TARGET Picture PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}) # Application Tile add_executable(Tile src/App_Tile.cpp) target_compile_definitions(Tile PUBLIC MAGICKCORE_QUANTUM_DEPTH=16 MAGICKCORE_HDRI_ENABLE=0) target_include_directories(Tile PRIVATE src ${ImageMagick_INCLUDE_DIRS}) target_link_libraries(Tile ${ImageMagick_LIBRARIES} ${PROJECT_NAME}) +set_property(TARGET Tile PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}) + + +# Windows only: copy dlls +if(WIN32) + if(CMAKE_BUILD_TYPE MATCHES DEBUG) + string (REPLACE "/" "\\" WIN_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}) + add_custom_command(TARGET Picture POST_BUILD COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/copy_im_db_dlls.bat ${WIN_BIN_DIR}) + add_custom_command(TARGET Tile POST_BUILD COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/copy_im_db_dlls.bat ${WIN_BIN_DIR}) + else() + string (REPLACE "/" "\\" WIN_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}) + add_custom_command(TARGET Picture POST_BUILD COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/copy_im_rl_dlls.bat ${WIN_BIN_DIR}) + add_custom_command(TARGET Tile POST_BUILD COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/copy_im_rl_dlls.bat ${WIN_BIN_DIR}) + endif() + +endif(WIN32) \ No newline at end of file diff --git a/Rgb2Hires_PC/RgbToHiRes.sln b/Rgb2Hires_PC/RgbToHiRes.sln deleted file mode 100644 index 2c35e07..0000000 --- a/Rgb2Hires_PC/RgbToHiRes.sln +++ /dev/null @@ -1,57 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30204.135 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libRgb2Hires", "projects\libRgb2Hires\libRgb2Hires.vcxproj", "{CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Picture", "projects\picture\Picture.vcxproj", "{754364B2-84E3-40A5-B838-C153775D8F4C}" - ProjectSection(ProjectDependencies) = postProject - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB} = {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tile", "projects\Tile\Tile.vcxproj", "{C0C03B35-A98E-4F57-9399-A07068B23AB2}" - ProjectSection(ProjectDependencies) = postProject - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB} = {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Debug|x64.ActiveCfg = Debug|x64 - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Debug|x64.Build.0 = Debug|x64 - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Debug|x86.ActiveCfg = Debug|Win32 - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Debug|x86.Build.0 = Debug|Win32 - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Release|x64.ActiveCfg = Release|x64 - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Release|x64.Build.0 = Release|x64 - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Release|x86.ActiveCfg = Release|Win32 - {CA6F93C8-86B1-4F88-A1E8-8613ED5802AB}.Release|x86.Build.0 = Release|Win32 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Debug|x64.ActiveCfg = Debug|x64 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Debug|x64.Build.0 = Debug|x64 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Debug|x86.ActiveCfg = Debug|Win32 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Debug|x86.Build.0 = Debug|Win32 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Release|x64.ActiveCfg = Release|x64 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Release|x64.Build.0 = Release|x64 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Release|x86.ActiveCfg = Release|Win32 - {754364B2-84E3-40A5-B838-C153775D8F4C}.Release|x86.Build.0 = Release|Win32 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Debug|x64.ActiveCfg = Debug|x64 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Debug|x64.Build.0 = Debug|x64 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Debug|x86.ActiveCfg = Debug|Win32 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Debug|x86.Build.0 = Debug|Win32 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Release|x64.ActiveCfg = Release|x64 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Release|x64.Build.0 = Release|x64 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Release|x86.ActiveCfg = Release|Win32 - {C0C03B35-A98E-4F57-9399-A07068B23AB2}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {EE267891-D9B2-4FE4-B329-44CB520456DE} - EndGlobalSection -EndGlobal diff --git a/Rgb2Hires_PC/scripts/ImageMagick-config.cmake b/Rgb2Hires_PC/scripts/ImageMagick-config.cmake new file mode 100644 index 0000000..34f9d40 --- /dev/null +++ b/Rgb2Hires_PC/scripts/ImageMagick-config.cmake @@ -0,0 +1,9 @@ +set(ImageMagick_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/ImageMagick ${CMAKE_CURRENT_LIST_DIR}/ImageMagick/Magick++/lib) + +set(ImageMagickLibDir ${CMAKE_CURRENT_LIST_DIR}/VisualMagick/lib) +if(CMAKE_BUILD_TYPE MATCHES DEBUG) + set(ImageMagick_LIBRARIES ${ImageMagickLibDir}/CORE_DB_Magick++_.lib ${ImageMagickLibDir}/CORE_DB_Magick_.lib ${ImageMagickLibDir}/CORE_DB_wand_.lib) +else() + set(ImageMagick_LIBRARIES ${ImageMagickLibDir}/CORE_RL_Magick++_.lib ${ImageMagickLibDir}/CORE_RL_Magick_.lib ${ImageMagickLibDir}/CORE_RL_wand_.lib) +endif() + diff --git a/Rgb2Hires_PC/scripts/copy_im_db_dlls.bat b/Rgb2Hires_PC/scripts/copy_im_db_dlls.bat new file mode 100644 index 0000000..2972b0e --- /dev/null +++ b/Rgb2Hires_PC/scripts/copy_im_db_dlls.bat @@ -0,0 +1,9 @@ +copy %MAGICK_HOME%\VisualMagick\bin\CORE_DB_magick_.dll %1 +copy "%MAGICK_HOME%\VisualMagick\bin\CORE_DB_Magick++_.dll" %1 +copy %MAGICK_HOME%\VisualMagick\bin\CORE_DB_png_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\CORE_DB_wand_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_DB_bmp_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_DB_jpeg_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_DB_png_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_DB_tiff_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_DB_webp_.dll %1 diff --git a/Rgb2Hires_PC/scripts/copy_im_rl_dlls.bat b/Rgb2Hires_PC/scripts/copy_im_rl_dlls.bat new file mode 100644 index 0000000..44947ad --- /dev/null +++ b/Rgb2Hires_PC/scripts/copy_im_rl_dlls.bat @@ -0,0 +1,9 @@ +copy %MAGICK_HOME%\VisualMagick\bin\CORE_RL_magick_.dll %1 +copy "%MAGICK_HOME%\VisualMagick\bin\CORE_RL_Magick++_.dll" %1 +copy %MAGICK_HOME%\VisualMagick\bin\CORE_RL_png_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\CORE_RL_wand_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_RL_bmp_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_RL_jpeg_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_RL_png_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_RL_tiff_.dll %1 +copy %MAGICK_HOME%\VisualMagick\bin\IM_MOD_RL_webp_.dll %1 diff --git a/Rgb2Hires_PC/src/Picture.cpp b/Rgb2Hires_PC/src/Picture.cpp index 21e4ee5..ff82f26 100644 --- a/Rgb2Hires_PC/src/Picture.cpp +++ b/Rgb2Hires_PC/src/Picture.cpp @@ -6,6 +6,16 @@ using namespace std; namespace RgbToHires { + const std::array Picture::_lineAdresses = { + 0x2000, 0x2080, 0x2100, 0x2180, 0x2200, 0x2280, 0x2300, 0x2380, + 0x2028, 0x20a8, 0x2128, 0x21a8, 0x2228, 0x22a8, 0x2328, 0x23a8, + 0x2050, 0x20d0, 0x2150, 0x21d0, 0x2250, 0x22d0, 0x2350, 0x23d0 + }; + + const std::array Picture::_lineOffsets = { + 0x0, 0x400, 0x800, 0xc00, 0x1000, 0x1400, 0x1800, 0x1c00 + }; + Picture::Picture(const ImageQuantized& source) { auto pixel_src = source.getConstPixels(0u, 0u, WIDTH, HEIGHT); diff --git a/Rgb2Hires_PC/src/Picture.h b/Rgb2Hires_PC/src/Picture.h index d3b3036..80b8adf 100644 --- a/Rgb2Hires_PC/src/Picture.h +++ b/Rgb2Hires_PC/src/Picture.h @@ -47,14 +47,8 @@ namespace RgbToHires using Blob = std::array; Blob _blob; ///< A frame ordered buffer of hires data - static constexpr std::array _lineAdresses = { - 0x2000, 0x2080, 0x2100, 0x2180, 0x2200, 0x2280, 0x2300, 0x2380, - 0x2028, 0x20a8, 0x2128, 0x21a8, 0x2228, 0x22a8, 0x2328, 0x23a8, - 0x2050, 0x20d0, 0x2150, 0x21d0, 0x2250, 0x22d0, 0x2350, 0x23d0 - }; - static constexpr std::array _lineOffsets = { - 0x0, 0x400, 0x800, 0xc00, 0x1000, 0x1400, 0x1800, 0x1c00 - }; + static const std::array _lineAdresses; + static const std::array _lineOffsets; std::map _hrOrderedLines; ///< map };