Changeset 20390 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java
- Timestamp:
- 2010-03-09T22:02:00+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java
r20247 r20390 3 3 package cadastre_fr; 4 4 5 import java.awt.Color; 5 6 import java.awt.Transparency; 6 7 import java.awt.image.BufferedImage; … … 17 18 private static final long serialVersionUID = 1L; 18 19 20 protected int parcelColor = Color.RED.getRGB(); 21 19 22 public BufferedImage bufferedImage; 23 24 public static int[] cRoofColors = new int[] {-197380, -592138}; 25 public static int[] cBuilingFootColors = new int[] {-256}; 20 26 21 27 protected BufferedImage convert1(BufferedImage src) { … … 107 113 return dest; 108 114 } 115 116 public boolean isBuildingColor(int rgb, boolean ignoreParcelColor) { 117 for (int i = 0; i < cBuilingFootColors.length; i++) 118 if (rgb == cBuilingFootColors[i]) 119 return true; 120 if (ignoreParcelColor && (rgb == parcelColor)) 121 return true; 122 return false; 123 } 124 125 public boolean isRoofColor(int rgb, boolean ignoreParcelColor) { 126 for (int i = 0; i < cRoofColors.length; i++) 127 if (rgb == cRoofColors[i]) 128 return true; 129 if (ignoreParcelColor && (rgb == parcelColor)) 130 return true; 131 return false; 132 } 133 134 public boolean isBuildingOrRoofColor(BufferedImage img, int x, int y, boolean ignoreParcelColor) { 135 int rgb = img.getRGB(x, y); 136 boolean ret = isBuildingColor(rgb, ignoreParcelColor) || isRoofColor(rgb, ignoreParcelColor); 137 return ret; 138 } 139 140 public boolean isBuildingOrRoofColor(BufferedImage img, int x, int y, boolean colorType, boolean ignoreParcelColor) { 141 int rgb = img.getRGB(x, y); 142 boolean ret; 143 if (colorType) 144 ret = isBuildingColor(rgb, ignoreParcelColor); 145 else 146 ret = isRoofColor(rgb, ignoreParcelColor); 147 return ret; 148 } 149 150 /** 151 * Checks if the rgb value is the black background color 152 * @param 153 * @return 154 */ 155 public boolean isBackgroundColor(BufferedImage img, int x, int y) { 156 return (img.getRGB(x, y) == -1); 157 } 158 109 159 }
Note:
See TracChangeset
for help on using the changeset viewer.