Ticket #477 (closed enhancement: fixed)
semitransparency support for png256
| Reported by: | mar_rud | Owned by: | artem |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.7.1 |
| Component: | Core Library | Version: | SVN Trunk |
| Severity: | Normal | Keywords: | |
| Cc: | Patch Needs Improvement: | no | |
| Needs Docmentation: | no | Has Patch?: | yes |
| Design Decision Needed: | no |
Description
Current png256 format allows only full opacity or full transparency pixels. Discussion about it can be found in http://trac.mapnik.org/ticket/202#comment:5. Now I'm presenting patch implementing mentioned solution: using 3 octrees, one per alpha range. Boundaries and assigned color numbers are computed based on image alpha distribution. This allows more smooth transparency changes and eliminates jagged edges.
In attachment, beside patch and fixed files, there are: readme.txt with more info, some sample images for testing different cases and little program, that can be used to test png256 without need to compile all mapnik libraries. I used it while writing this fix to test different approaches.
In image attachments below You can see effects in different cases. Those images are divided to 3 columns:
- left : source image
- center : new algorithm
- right : previous algorithm
Codes are prepared against 0.7 branch (including latest fix to #445, #447). I suggest testing in different scenarios before committing. It isn't perfect, but in most situations should be enough, without much cputime or image size trade off (only 10% longer time and bigger image).
