From 5b1e824640a4466e09a7752e06db51a19b28b56f Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 17 Jul 2019 17:59:56 -0400 Subject: image_render(): Switch to 8-bit/color RGB --- 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) { -- cgit v0.9.1