rundel / carto-parser

12 stars 7 forks source link

Cannot perform multiplications with color and scalar value #24

Open ghost opened 12 years ago

ghost commented 12 years ago

The following fails:

color: #fff * 0.7;

Since #fff gets turned into a utree node, multiplication by 0.7 is not possible in carto::expression::eval_node as it directly tries to multiply a utree with a double.

The only way I can see around this is to create a new data structure for colors that overloads arithmetic operations, but it may require an overhaul of internals.

springmeyer commented 12 years ago

issues have now been created at https://github.com/mapnik/carto-parser/issues, so cool to file them from there now.

springmeyer commented 12 years ago

btw, I think the proper solution for this will be for mapnik internally to use an expression type for colors. See the expressions label for some related ideas: https://github.com/mapnik/mapnik/issues?labels=expressions

rundel commented 12 years ago

@rfw @springmeyer Just added the functionality to handle this. I haven't kept up-to-date on what has changed with the branch on the mapnik page and if things are now severely out of sync. We should obviously merge everything and get things more organized.

It is an easy change, but we should also come to an exact definition on how the operators should work since it wasn't clear if we should be touching the alpha channel or not or if we should allow silly things like multiplying two colors together.