diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-17 18:03:01 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-07-17 18:03:47 (EDT) |
commit | ac148296c2b39816122924dda32afec4ed08735d (patch) | |
tree | 3f072521797b97cb8188109f41d835766ae53a91 /src | |
parent | 5b1e824640a4466e09a7752e06db51a19b28b56f (diff) |
src/image.c: Move macros to src/image.h
Diffstat (limited to 'src')
-rw-r--r-- | src/image.c | 8 | ||||
-rw-r--r-- | src/image.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/image.c b/src/image.c index 45c3352..04dca72 100644 --- a/src/image.c +++ b/src/image.c @@ -30,10 +30,6 @@ #include "i18n.h" #include "text.h" -#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; @@ -84,12 +80,12 @@ 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_RGB, PNG_INTERLACE_NONE, + IMAGE_BIT_DEPTH, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); rows = png_malloc(image->png_ptr, height * sizeof(*rows)); for (i = 0; i < height; ++i) { - rows[i] = png_malloc(image->png_ptr, width * PIXEL_SIZE); + rows[i] = png_malloc(image->png_ptr, width * IMAGE_PIXEL_SIZE); } png_set_rows(image->png_ptr, image->info_ptr, rows); diff --git a/src/image.h b/src/image.h index 361296e..1177cd0 100644 --- a/src/image.h +++ b/src/image.h @@ -26,6 +26,10 @@ #include "font.h" +#define IMAGE_BIT_DEPTH 8 +#define IMAGE_CHANNELS 3 +#define IMAGE_PIXEL_SIZE ((IMAGE_BIT_DEPTH + 7) / 8) * IMAGE_CHANNELS + struct image; struct image * |