Changeset 11692 in josm for trunk/src/org
- Timestamp:
- 2017-03-05T17:31:39+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java
r10748 r11692 146 146 Color color = c.get(TEXT_COLOR, defaultTextColor, Color.class); 147 147 float alpha = c.get(TEXT_OPACITY, 1f, Float.class); 148 color = new Color(color.getRed(), color.getGreen(), 149 color.getBlue(), Utils.colorFloat2int(alpha)); 148 color = Utils.alphaMultiply(color, alpha); 150 149 151 150 Float haloRadius = c.get(TEXT_HALO_RADIUS, null, Float.class); … … 156 155 if (haloRadius != null) { 157 156 haloColor = c.get(TEXT_HALO_COLOR, Utils.complement(color), Color.class); 158 float haloAlpha = c.get(TEXT_HALO_OPACITY, 1f, Float.class); 159 haloColor = new Color(haloColor.getRed(), haloColor.getGreen(), 160 haloColor.getBlue(), Utils.colorFloat2int(haloAlpha)); 157 float haloAlphaFactor = c.get(TEXT_HALO_OPACITY, 1f, Float.class); 158 haloColor = Utils.alphaMultiply(haloColor, haloAlphaFactor); 161 159 } 162 160 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r11493 r11692 295 295 296 296 /** 297 * Multiply the alpha value of the given color with the factor. The alpha value is clamped to 0..255 298 * @param color The color 299 * @param alphaFactor The factor to multiply alpha with. 300 * @return The new color. 301 * @since 11692 302 */ 303 public static Color alphaMultiply(Color color, float alphaFactor) { 304 int alpha = Utils.colorFloat2int(Utils.colorInt2float(color.getAlpha()) * alphaFactor); 305 alpha = clamp(alpha, 0, 255); 306 return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); 307 } 308 309 /** 297 310 * Returns the complementary color of {@code clr}. 298 311 * @param clr the color to complement
Note:
See TracChangeset
for help on using the changeset viewer.