Ticket #511 (new defect)

Opened 5 weeks ago

Last modified 11 days ago

Change in alpha value in Mapnik color constructor between Mapnik 0.7 and 0.8

Reported by: springmeyer Owned by: artem
Priority: critical (top) Milestone: 0.8.0
Component: Core Library Version: SVN Trunk
Severity: Normal Keywords:
Cc: Patch Needs Improvement: no
Needs Docmentation: no Has Patch?: no
Design Decision Needed: no

Description

Is this an intended change? Previously the alpha input was interpreted as a fraction:

0.7:

>>> mapnik.mapnik_version()
700
>>> c = mapnik.Color('rgba(235,217,194,20)')
>>> c.a
255
>>> c = mapnik.Color('rgba(235,217,194,.5)')
>>> c.a
128

trunk:

>>> mapnik.mapnik_version()
800
>>> c = mapnik.Color('rgba(235,217,194,.5)')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Failed to parse color value: Expected a color, but got 'rgba(235,217,194,.5)'
>>> c = mapnik.Color('rgba(235,217,194,128)')
>>> c.a
128
]}}

Change History

Changed 5 weeks ago by artem

Internally, color components (RGBA) stored as uint8_t so I introduced this behaviour by accident. Having just read http://www.w3.org/TR/css3-color/ I think we should revert to using normalised 0...1.0 alpha as per CSS.

Changed 11 days ago by springmeyer

  • priority changed from normal to critical (top)
Note: See TracTickets for help on using tickets.