Changeset 16700 in josm for trunk/src/org
- Timestamp:
- 2020-06-21T18:53:41+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r16393 r16700 6 6 import java.awt.Color; 7 7 import java.awt.Component; 8 import java.awt.Composite; 8 9 import java.awt.Dimension; 9 10 import java.awt.Font; … … 682 683 * @param spacing spacing between two images 683 684 * @param phase initial spacing 685 * @param opacity the opacity 684 686 * @param align alignment of the image. The top, center or bottom edge can be aligned with the way. 685 687 */ 686 688 public void drawRepeatImage(IWay<?> way, MapImage pattern, boolean disabled, double offset, double spacing, double phase, 687 LineImageAlignment align) {689 float opacity, LineImageAlignment align) { 688 690 final int imgWidth = pattern.getWidth(); 689 691 final double repeat = imgWidth + spacing; … … 730 732 int sx1 = Math.max(0, -x); 731 733 int sx2 = imgWidth - Math.max(0, x + imgWidth - (int) Math.ceil(segmentLength)); 734 Composite saveComposite = g.getComposite(); 735 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity)); 732 736 g.drawImage(image, x + sx1, dy1, x + sx2, dy2, sx1, 0, sx2, imgHeight, null); 737 g.setComposite(saveComposite); 733 738 imageStart += repeat; 734 739 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.java
r16630 r16700 67 67 public float phase; 68 68 /** 69 * The opacity 70 */ 71 public float opacity; 72 /** 69 73 * The alignment of the image 70 74 */ … … 81 85 * @param spacing The space between the images 82 86 * @param phase The offset of the first image along the way 87 * @param opacity The opacity 83 88 * @param align The alignment of the image 84 89 */ 85 public RepeatImageElement(Cascade c, MapImage pattern, float offset, float spacing, float phase, LineImageAlignment align) {90 public RepeatImageElement(Cascade c, MapImage pattern, float offset, float spacing, float phase, float opacity, LineImageAlignment align) { 86 91 super(c, 2.9f); 87 92 CheckParameterUtil.ensureParameterNotNull(pattern); … … 91 96 this.spacing = spacing; 92 97 this.phase = phase; 98 this.opacity = opacity; 93 99 this.align = align; 94 100 } … … 107 113 float spacing = c.get(REPEAT_IMAGE_SPACING, 0f, Float.class); 108 114 float phase = -c.get(REPEAT_IMAGE_PHASE, 0f, Float.class); 115 float opacity = c.get(REPEAT_IMAGE_OPACITY, 1f, Float.class); 109 116 110 117 LineImageAlignment align = LineImageAlignment.CENTER; … … 116 123 } 117 124 118 return new RepeatImageElement(c, pattern, offset, spacing, phase, align);125 return new RepeatImageElement(c, pattern, offset, spacing, phase, opacity, align); 119 126 } 120 127 … … 124 131 if (primitive instanceof IWay) { 125 132 IWay<?> w = (IWay<?>) primitive; 126 painter.drawRepeatImage(w, pattern, painter.isInactiveMode() || w.isDisabled(), offset, spacing, phase, align);133 painter.drawRepeatImage(w, pattern, painter.isInactiveMode() || w.isDisabled(), offset, spacing, phase, opacity, align); 127 134 } 128 135 } … … 148 155 @Override 149 156 public int hashCode() { 150 return Objects.hash(super.hashCode(), pattern, offset, spacing, phase, align);157 return Objects.hash(super.hashCode(), pattern, offset, spacing, phase, opacity, align); 151 158 } 152 159 … … 155 162 return "RepeatImageStyle{" + super.toString() + "pattern=[" + pattern + 156 163 "], offset=" + offset + ", spacing=" + spacing + 157 ", phase=" + -phase + ", align=" + align + '}';164 ", phase=" + -phase + ", opacity=" + opacity + ", align=" + align + '}'; 158 165 } 159 166 }
Note:
See TracChangeset
for help on using the changeset viewer.