Minor: better doc

This commit is contained in:
Christophe Meneboeuf 2018-10-07 00:37:44 +02:00
parent 93ee71ab7c
commit 2c73051e30
6 changed files with 56 additions and 28 deletions

View File

@ -1,7 +1,7 @@
#Rgb2Hires
This program converts an RGB image to the Apple II's "HiRes" format. Provided it complies with this format's constraints:
* Source image must be 140x280. Pixels are anamorphic: twice wider than tall.
* Source image must be 140x192. Pixels are anamorphic: twice wider than tall.
* Source image must contains six colors : BLACK, WHITE, ORANGE, GREEN, BLUE and PURPLE
For more information about the "Hires" format and its limitations, please refer to Wikipedia: https://en.wikipedia.org/wiki/Apple_II_graphics#High-Resolution_.28Hi-Res.29_graphics
@ -30,3 +30,4 @@ It is a Makefile project and must be crosscompiled using **[CC65](https://cc65.g
# Running
A correct source image, *test.png*, is provided as an example. Convert it into a file named *test.picture* and copy it along the Apple II *Loader*, then execute on the actual hardware ;)

View File

@ -0,0 +1,24 @@
cmake_minimum_required (VERSION 2.6)
project (Rgb2Hires)
# The version number.
set (Rgb2Hires_VERSION_MAJOR 1)
set (Rgb2Hires_VERSION_MINOR 0)
#Warning level
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(warnings "-Wall -Wextra -Werror")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(warnings "/W4 /WX /EHsc")
endif()
add_executable(${PROJECT_NAME} src/Common.h
src/HiRes.cpp
src/HiRes.h
src/ImageQuantized.cpp
src/ImageQuantized.h
src/Main.cpp
)

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -32,33 +32,33 @@
<ProjectGuid>{754364B2-84E3-40A5-B838-C153775D8F4C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>RgbToHiRes</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<ProjectName>Rgb2HiRes</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@ -35,27 +35,27 @@ namespace RgbToHires {
class BlockHr
{
public:
/// \brief Default constructor: all black
/// @brief Default constructor: all black
BlockHr();
/// \brief Construction from 7 pixels
/// @brief Construction from 7 pixels
BlockHr(const BlockPixel& );
/// \brief returns the position of the first element
/// @brief returns the position of the first element
inline std::array<uint8_t, 2>::const_iterator begin() const {
return _data.begin();
}
/// \brief returns the position after the last element
/// @brief returns the position after the last element
inline std::array<uint8_t, 2>::const_iterator end() const {
return _data.end();
}
private:
/// \brief color group as defined in Apple's documentation
/// @brief color group as defined in Apple's documentation
enum eColorGroup {
GROUP_1,
GROUP_2
};
/// \brief Returns the color group of these two 3.5 pixel blocks
/// @brief Returns the color group of these two 3.5 pixel blocks
std::pair<eColorGroup, eColorGroup> getGroup(const BlockPixel&) const;
/// \brief Returns the bit pait corresponding to the given color
/// @brief Returns the bit pait corresponding to the given color
uint8_t getDibit(const Magick::Color&) const;
std::array<uint8_t, 2> _data;
@ -68,7 +68,7 @@ namespace RgbToHires {
using Blob = std::array<LineHr, NB_LINES_PER_SCREEN>;
/// @brief Describes an HIRES image
class HiRes
{
public:
@ -77,9 +77,9 @@ namespace RgbToHires {
HiRes(const ImageQuantized&);
~HiRes() = default;
/// \brief Returns the binary hires picture
/// @brief Returns the binary hires picture
std::unique_ptr <std::array<uint8_t, FRAME_SIZE>> getBlob() const;
/// \brief Returns asm code corresponding to the image in memory (CA65 format)
/// @brief Returns asm code corresponding to the image in memory (CA65 format)
std::string getAsm() const;
private:

View File

@ -27,6 +27,8 @@
namespace RgbToHires {
/// @brief Image quantized to the HIRES colors.
/// @details Quantization works with a nearest distance algorithm.
class ImageQuantized :
public Magick::Image
{
@ -39,10 +41,11 @@ namespace RgbToHires {
ImageQuantized(const Magick::Image& src);
~ImageQuantized()=default;
/// @brief Returns an array of bytes forming the RGB quantized image
std::unique_ptr<Blob> getBlob() const;
private:
/// @brief Computes the euclidian distance between two colors
double Distance(const Magick::Color&, const Magick::Color&);
};

View File

@ -31,14 +31,14 @@
using namespace std;
using namespace RgbToHires;
/// \brief Returns true if a file exists
/// @brief Returns true if a file exists
inline bool exists(const std::string& path)
{
struct stat buffer;
return (stat(path.c_str(), &buffer) == 0);
}
/// \brief Program entry point
/// @brief Program entry point
int main( int argc, char *argv[] )
{
Magick::InitializeMagick(*argv);