Compilation with GCC < 9
This commit is contained in:
parent
e8fe9565b8
commit
6f39e5a676
30
Readme.md
30
Readme.md
|
@ -1,5 +1,22 @@
|
|||
# Rgb2Hires
|
||||
|
||||
Rgb2Hires is a set of tools to help converting a modern RGB image (JPEG, PNG) to the HIRES format for Apple II computers ; either as a binary export or an assembly listing.
|
||||
|
||||
The color of the RGB imlage can be approximative: Rgb2Hires will match them with the nearest HIRES color.
|
||||
|
||||
## Apple II colors
|
||||
|
||||
RGB values of the targeted colors:
|
||||
|
||||
* **BLACK**: 00 00 00
|
||||
* **WHITE**: FF FF FF
|
||||
* **BLUE**: 07 A8 E0
|
||||
* **ORANGE**: F9 56 1D
|
||||
* **GREEN**: 43 C8 00
|
||||
* **VIOLET**: BB 36 FF
|
||||
|
||||
## Projects
|
||||
|
||||
This repository contains three "PC" projects:
|
||||
* **libRgb2Hires**: a library to convert RGB image to the Apple II's HIRES format
|
||||
* **Picture**: a program to convert a RGB png to a binary or an ASM excerpt, that can be loaded to the HIRES memory pages of an Apple II. An optional **live preview** can be displayed: its window will simulate an RGB monitor and will show the result, including color clashing and artifacts.
|
||||
|
@ -13,7 +30,9 @@ And one Apple II project:
|
|||
__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).
|
||||
|
||||
|
||||
## Windows / Linux projects (libHires, Picture, Tile)
|
||||
## Build from sources
|
||||
|
||||
This project has been tested with VisualStudio 2019, Gcc 9 (Ubuntu 20.04) and Gcc8.3.0 (Debian 10).
|
||||
### Dependencies
|
||||
|
||||
* **Magick++** from ImageMagick 6 and **SDL2**
|
||||
|
@ -28,7 +47,14 @@ __Note:__ For more information about the "Hires" format and its limitations, you
|
|||
* Provide an environment variable called *SDL2_HOME* and pointing to the root of the SDL2 library.
|
||||
|
||||
* On **Linux**, install libmagick++-dev for version 6 and libsdl2-dev
|
||||
> sudo apt install libmagick++-6.q16-dev libsdl2-dev
|
||||
|
||||
> sudo apt install libmagick++-6.q16-dev libsdl2-dev
|
||||
|
||||
Depending on your Linux distribution, you may have to set an environment variable *sdl2_DIR*, pointing to the directory hosting SDL2's cmake configuration, before running cmake.
|
||||
|
||||
Example on Debian:
|
||||
|
||||
> export sdl2_DIR=/usr/lib/x86_64-linux-gnu/cmake/SDL2/
|
||||
|
||||
### How to build
|
||||
|
||||
|
|
|
@ -13,24 +13,26 @@ endif(WIN32)
|
|||
set (Rgb2Hires_VERSION_MAJOR 1)
|
||||
set (Rgb2Hires_VERSION_MINOR 0)
|
||||
set(CMAKE_CXX_STANDARD 17) # required to use <filesystem>
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
|
||||
# dependencies
|
||||
if(WIN32)
|
||||
# sdl2
|
||||
if(NOT DEFINED ENV{SDL2_HOME})
|
||||
message(FATAL_ERROR "Please set a SDL2_HOME environment variable to the root directory of SDL2")
|
||||
endif()
|
||||
set(SDL2_DIR $ENV{SDL2_HOME})
|
||||
set(sdl2_DIR $ENV{SDL2_HOME})
|
||||
# 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++ )
|
||||
find_package(ImageMagick REQUIRED COMPONENTS Magick++ )
|
||||
endif(WIN32)
|
||||
find_package(SDL2 REQUIRED)
|
||||
find_package(sdl2 REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# directories
|
||||
|
@ -62,6 +64,9 @@ endif()
|
|||
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} ${CMAKE_THREAD_LIBS_INIT} ${PROJECT_NAME} ${SDL2_LIBRARIES}) # SDL2 must be at the end
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "9")
|
||||
target_link_libraries(Picture stdc++fs) # filesystem lib not included in stdc++ for gcc < 9
|
||||
endif()
|
||||
set_property(TARGET Picture PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG})
|
||||
|
||||
# Application Tile
|
||||
|
|
|
@ -47,7 +47,7 @@ int main( int argc, char *argv[] )
|
|||
Magick::InitializeMagick(*argv);
|
||||
|
||||
//Parsing command line
|
||||
TCLAP::CmdLine cmd("Picture", ' ', "0");
|
||||
TCLAP::CmdLine cmd("Picture - by Christophe Meneboeuf <christophe@xtof.info>", ' ', "0");
|
||||
TCLAP::ValueArg<string> imagePath("i", "image", "Source image path", true, "", "path_to_image");
|
||||
TCLAP::ValueArg<string> outputPath("o", "output", "Output path", true, "", "path_to_output");
|
||||
TCLAP::SwitchArg assembly("a", "asm", "Output asm format");
|
||||
|
@ -59,7 +59,7 @@ int main( int argc, char *argv[] )
|
|||
cmd.parse(argc, argv);
|
||||
|
||||
if (imagePath.getValue().size() == 0 || outputPath.getValue().size() == 0) {
|
||||
std::cout << "No input or output path privided.";
|
||||
std::cout << "No input or output path provided." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ int main( int argc, char *argv[] )
|
|||
Magick::InitializeMagick(*argv);
|
||||
|
||||
//Parsing command line
|
||||
TCLAP::CmdLine cmd("Tile", ' ', "0");
|
||||
TCLAP::CmdLine cmd("Tile - by Christophe Meneboeuf <christophe@xtof.info>", ' ', "0");
|
||||
TCLAP::ValueArg<string> imagePath("i", "image", "Source image path", true, "", "string");
|
||||
TCLAP::ValueArg<string> outputPath("o", "output", "Output path", true, "", "string");
|
||||
TCLAP::ValueArg<unsigned> column("c", "column", "Column number in the tile sheet. Starts at 0.", true, 0u, "integer");
|
||||
|
@ -58,15 +58,15 @@ int main( int argc, char *argv[] )
|
|||
cmd.parse(argc, argv);
|
||||
|
||||
if (imagePath.getValue().size() == 0 || outputPath.getValue().size() == 0) {
|
||||
std::cout << "No input or output path privided.";
|
||||
std::cout << "No input or output path provided." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
if (column.getValue() > 9) {
|
||||
std::cout << "Column number shall be < 9";
|
||||
std::cout << "Column number shall be < 9" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
if (line.getValue() > 11) {
|
||||
std::cout << "Line number shall be < 11";
|
||||
std::cout << "Line number shall be < 11" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue