Lines 529-535
Link Here
|
529 |
png_structp png_ptr = png_create_read_struct |
529 |
png_structp png_ptr = png_create_read_struct |
530 |
( |
530 |
( |
531 |
PNG_LIBPNG_VER_STRING, |
531 |
PNG_LIBPNG_VER_STRING, |
532 |
(voidp) NULL, |
532 |
NULL, |
533 |
wx_png_error, |
533 |
wx_png_error, |
534 |
wx_png_warning |
534 |
wx_png_warning |
535 |
); |
535 |
); |
Lines 586-601
Link Here
|
586 |
#if wxUSE_PALETTE |
586 |
#if wxUSE_PALETTE |
587 |
if (color_type == PNG_COLOR_TYPE_PALETTE) |
587 |
if (color_type == PNG_COLOR_TYPE_PALETTE) |
588 |
{ |
588 |
{ |
589 |
const size_t ncolors = info_ptr->num_palette; |
589 |
int ncolors = 0; |
|
|
590 |
png_colorp palette; |
591 |
png_get_PLTE( png_ptr, info_ptr, &palette, &ncolors); |
590 |
unsigned char* r = new unsigned char[ncolors]; |
592 |
unsigned char* r = new unsigned char[ncolors]; |
591 |
unsigned char* g = new unsigned char[ncolors]; |
593 |
unsigned char* g = new unsigned char[ncolors]; |
592 |
unsigned char* b = new unsigned char[ncolors]; |
594 |
unsigned char* b = new unsigned char[ncolors]; |
593 |
|
595 |
|
594 |
for (size_t j = 0; j < ncolors; j++) |
596 |
for (size_t j = 0; j < ncolors; j++) |
595 |
{ |
597 |
{ |
596 |
r[j] = info_ptr->palette[j].red; |
598 |
r[j] = palette[j].red; |
597 |
g[j] = info_ptr->palette[j].green; |
599 |
g[j] = palette[j].green; |
598 |
b[j] = info_ptr->palette[j].blue; |
600 |
b[j] = palette[j].blue; |
599 |
} |
601 |
} |
600 |
|
602 |
|
601 |
image->SetPalette(wxPalette(ncolors, r, g, b)); |
603 |
image->SetPalette(wxPalette(ncolors, r, g, b)); |