mapnik-org/mapnik — Issue #183: Need to normalize rgb color ranges to 0-255
Author: artemp
Created: 2011-10-11 07:40:50+00:00
State: open
Labels: Core_Library

According to the W3C CSS spec, the colour components need to be clamped to 0-255. Right now I think we wrap the numbers which is incorrect.

http://www.w3.org/TR/css3-color/#rgb-color

The alpha value of rgba() similarly needs to be clamped to 0.0 - 1.0.

{{{
em { color: rgb(255,0,0) } /* integer range 0 - 255 */
em { color: rgb(300,0,0) } /* clipped to rgb(255,0,0) */
em { color: rgb(255,-10,0) } /* clipped to rgb(255,0,0) */
em { color: rgb(110%, 0%, 0%) } /* clipped to rgb(100%,0%,0%) */
}}}