Mercurial > hg > nginx
comparison src/http/modules/ngx_http_image_filter_module.c @ 3133:28a6aa24b453
fix alpha-channel transparency in PNG
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 15 Sep 2009 09:47:12 +0000 |
parents | e2a510ac53db |
children | e6f5cb5eff8b |
comparison
equal
deleted
inserted
replaced
3132:6cb238e091a9 | 3133:28a6aa24b453 |
---|---|
766 if (dst == NULL) { | 766 if (dst == NULL) { |
767 gdImageDestroy(src); | 767 gdImageDestroy(src); |
768 return NULL; | 768 return NULL; |
769 } | 769 } |
770 | 770 |
771 if (colors == 0) { | |
772 gdImageSaveAlpha(dst, 1); | |
773 gdImageAlphaBlending(dst, 0); | |
774 } | |
775 | |
771 gdImageCopyResampled(dst, src, 0, 0, 0, 0, dx, dy, sx, sy); | 776 gdImageCopyResampled(dst, src, 0, 0, 0, 0, dx, dy, sx, sy); |
772 | 777 |
773 gdImageDestroy(src); | 778 gdImageDestroy(src); |
774 | 779 |
775 } else { | 780 } else { |
807 oy /= 2; | 812 oy /= 2; |
808 | 813 |
809 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 814 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
810 "image crop: %d x %d @ %d x %d", | 815 "image crop: %d x %d @ %d x %d", |
811 dx, dy, ox, oy); | 816 dx, dy, ox, oy); |
817 | |
818 if (colors == 0) { | |
819 gdImageSaveAlpha(dst, 1); | |
820 gdImageAlphaBlending(dst, 0); | |
821 } | |
812 | 822 |
813 gdImageCopy(dst, src, 0, 0, ox, oy, dx - ox, dy - oy); | 823 gdImageCopy(dst, src, 0, 0, ox, oy, dx - ox, dy - oy); |
814 | 824 |
815 gdImageDestroy(src); | 825 gdImageDestroy(src); |
816 } | 826 } |