Rgb2Hires/Readme.md

91 lines
4.0 KiB
Markdown
Raw Normal View History

2020-11-13 00:03:50 +00:00
# Rgb2Hires
2021-02-15 20:49:54 +00:00
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
2021-01-25 23:21:52 +00:00
This repository contains three "PC" projects:
2020-11-13 00:03:50 +00:00
* **libRgb2Hires**: a library to convert RGB image to the Apple II's HIRES format
2021-02-14 22:43:24 +00:00
* **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.
2021-01-27 23:09:45 +00:00
* Source image must be 140x192. Pixels are anamorphic: they will be displayed twice wider than tall.
2020-11-13 00:03:50 +00:00
* Source image must contains six colors : BLACK, WHITE, ORANGE, GREEN, BLUE and PURPLE. The color may be approximation of the Apple II 6 colors. Please refer to the provided pic.
2021-01-27 23:09:45 +00:00
* **Tile**: given a RGB png tile sheet that satisfies the same requirements as above, it extracts a 14x16 tile and converts it to ASM data. This data **is not interleaved**.
2020-11-13 00:03:50 +00:00
And one Apple II project:
2021-01-27 23:09:45 +00:00
* **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*.
2021-02-01 23:35:49 +00:00
__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).
2018-10-06 22:37:44 +00:00
2021-02-15 20:49:54 +00:00
## Build from sources
This project has been tested with VisualStudio 2019, Gcc 9 (Ubuntu 20.04) and Gcc8.3.0 (Debian 10).
2021-01-25 23:21:52 +00:00
### Dependencies
2021-02-14 22:43:24 +00:00
* **Magick++** from ImageMagick 6 and **SDL2**
* On **Windows**
* ImageMagick
* 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*.
* SDL2
* Download the latest version of the *development library* from the [official website](https://www.libsdl.org/download-2.0.php) and unarchive it.
* 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
2021-02-15 20:49:54 +00:00
> 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/
2021-01-25 23:21:52 +00:00
### How to build
* **Linux** a CMakeList is provided:
> mkdir build && cd build
> cmake ..
2021-01-25 23:21:52 +00:00
> cmake --build . --config release
* **Windows** a VisualStudio solution is provided
## Apple II project (Loader)
2018-10-06 22:37:44 +00:00
2020-11-13 00:03:50 +00:00
### Dependencies
* [CC65](https://cc65.github.io/cc65/)
* The crosscompiler suit. Please provide an environment variable, *CC65_HOME* pointing to your CC65 folder.
2021-01-25 23:21:52 +00:00
### Build
2021-01-27 23:09:45 +00:00
> make
2021-01-27 23:09:45 +00:00
## Test
A correct source image, *test.png*, is provided as an example. Convert it using Picture, then copy it on a dsk image along with the Apple II loader. You can use or refer to the provided script in the *Loader_Apple2* folder.
2021-02-14 22:43:24 +00:00
### Demo
The live preview can help to visualise color clashing and artifacts. You can edit your file using *Photoshop* or any other application. The *Preview* window will be ubdated each tile the file is saved.
2021-02-14 22:58:19 +00:00
<a href="https://pub.xtof.info/github/demo-rgb2hires.mp4">
<img src="https://pub.xtof.info/github/demo-rgb2hires.png"/>
</a>