Changeset 6749 in josm


Ignore:
Timestamp:
2014-01-21T13:38:07+01:00 (10 years ago)
Author:
simon04
Message:

fix #9596 - MapCSS style: determine opacity/transparency of a color using alpha()

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r6737 r6749  
    216216        /**
    217217         * Get the value of the red color channel in the rgb color model
     218         * @return the red color channel in the range [0;1]
    218219         * @see java.awt.Color#getRed()
    219220         */
     
    224225        /**
    225226         * Get the value of the green color channel in the rgb color model
     227         * @return the green color channel in the range [0;1]
    226228         * @see java.awt.Color#getGreen()
    227229         */
     
    232234        /**
    233235         * Get the value of the blue color channel in the rgb color model
     236         * @return the blue color channel in the range [0;1]
    234237         * @see java.awt.Color#getBlue()
    235238         */
    236239        public static float blue(Color c) {
    237240            return Utils.color_int2float(c.getBlue());
     241        }
     242
     243        /**
     244         * Get the value of the alpha channel in the rgba color model
     245         * @return the alpha channel in the range [0;1]
     246         * @see java.awt.Color#getAlpha()
     247         */
     248        public static float alpha(Color c) {
     249            return Utils.color_int2float(c.getAlpha());
    238250        }
    239251
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r6742 r6749  
    257257
    258258    /**
    259      * convert back
     259     * convert integer range 0..255 to float range 0 <= x <= 1
     260     * when dealing with colors and color alpha value
    260261     */
    261262    public static Float color_int2float(Integer val) {
Note: See TracChangeset for help on using the changeset viewer.