Skip to content

Commit

Permalink
Expand PNG_COLOR_TYPE_GRAY_ALPHA to RGBA
Browse files Browse the repository at this point in the history
Fixes #494

(cherry picked from commit ae0b7c4)
(cherry picked from commit df9552d)
  • Loading branch information
slouken committed Dec 26, 2024
1 parent a0afc65 commit ca290d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/IMG_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,11 @@ static void LIBPNG_LoadPNG_RW(SDL_RWops *src, struct loadpng_vars *vars)
lib.png_set_packing(vars->png_ptr);

/* scale greyscale values to the range 0..255 */
if (color_type == PNG_COLOR_TYPE_GRAY)
if (color_type == PNG_COLOR_TYPE_GRAY) {
lib.png_set_expand(vars->png_ptr);
} else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
lib.png_set_gray_to_rgb(vars->png_ptr);
}

/* For images with a single "transparent colour", set colour key;
if more than one index has transparency, or if partially transparent
Expand Down

0 comments on commit ca290d7

Please sign in to comment.