diff --git a/escher/image/inliner.c b/escher/image/inliner.c index 05ddcc757..0b8a7806a 100644 --- a/escher/image/inliner.c +++ b/escher/image/inliner.c @@ -148,12 +148,15 @@ void generateHeaderFromImage(FILE * file, const char * guardian, const char * va void generateImplementationFromImage(FILE * file, const char * header, const char * variable, uint32_t width, uint32_t height, png_bytep * pixelsRowPointers) { fprintf(file, "// This file is auto-generated by Inliner. Do not edit manually.\n"); fprintf(file, "#include \"%s.h\"\n\n", header); - fprintf(file, "const unsigned char data[] = {"); + fprintf(file, "#define P(c) KDColor::RGB24(c)\n\n"); + fprintf(file, "const KDColor pixels[] = {"); for (int j=0; j> 8); + fprintf(file, "P(0x%02X%02X%02X)", (int)(blendedRed*0xFF), (int)(blendedGreen*0xFF), (int)(blendedBlue*0xFF)); if (i!=width-1 || j!= height-1) { - fprintf(file, ", "); + fprintf(file, ","); } } } fprintf(file, "\n};\n\n"); - fprintf(file, "constexpr Image image = Image(%d, %d, data);\n\n", width, height); + fprintf(file, "constexpr Image image = Image(%d, %d, pixels);\n\n", width, height); fprintf(file, "const Image * ImageStore::%s = ℑ\n", variable); } diff --git a/escher/include/escher/image.h b/escher/include/escher/image.h index 155360aeb..3f1a18855 100644 --- a/escher/include/escher/image.h +++ b/escher/include/escher/image.h @@ -5,15 +5,15 @@ class Image { public: - constexpr Image(KDCoordinate width, KDCoordinate height, const unsigned char * data) : - m_width(width), m_height(height), m_data(data) {} + constexpr Image(KDCoordinate width, KDCoordinate height, const KDColor * pixels) : + m_width(width), m_height(height), m_pixels(pixels) {} KDCoordinate width() const { return m_width; } KDCoordinate height() const { return m_height; } - const KDColor * pixels() const { return (const KDColor *)m_data; } + const KDColor * pixels() const { return m_pixels; } private: KDCoordinate m_width; KDCoordinate m_height; - const unsigned char * m_data; + const KDColor * m_pixels; }; #endif