summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/image.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/image.c b/src/image.c
index d059192..45c3352 100644
--- a/src/image.c
+++ b/src/image.c
@@ -30,17 +30,15 @@
#include "i18n.h"
#include "text.h"
-#define BIT_DEPTH 4
-#define PALETTE_SIZE (1 << BIT_DEPTH)
-#define PIXEL_SIZE ((BIT_DEPTH + 7) / 8)
+#define BIT_DEPTH 8
+#define CHANNELS 3
+#define PIXEL_SIZE ((BIT_DEPTH + 7) / 8) * CHANNELS
struct image {
png_structp png_ptr;
png_infop info_ptr;
};
-static png_color palette[PALETTE_SIZE];
-
struct image *
image_new(const char *file_name)
{
@@ -86,9 +84,8 @@ image_render(struct image *image, struct text *text, struct font *font)
height = text_get_height(text) * font_get_height(font);
png_set_IHDR(image->png_ptr, image->info_ptr, width, height,
- BIT_DEPTH, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
+ BIT_DEPTH, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
- png_set_PLTE(image->png_ptr, image->info_ptr, palette, PALETTE_SIZE);
rows = png_malloc(image->png_ptr, height * sizeof(*rows));
for (i = 0; i < height; ++i) {