summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-07-17 17:59:56 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-07-17 17:59:56 (EDT)
commit5b1e824640a4466e09a7752e06db51a19b28b56f (patch)
tree61af5330e723559135da9e236c6ca9e2130e7810
parent3077a5e0c9079d329dd08a5ffb6a75670d78dc4e (diff)
image_render(): Switch to 8-bit/color RGB
-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) {