Changeset 19948 in osm for applications/editors/josm/plugins
- Timestamp:
- 2010-02-09T19:27:41+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/VectorImageModifier.java
r18544 r19948 16 16 public static int cadastreBackgroundTransp = 1; // original white but transparent 17 17 18 private boolean withBackground = false;19 20 18 private int backgroundPixel = 0; 21 22 private int backgroundSampleX, backgroundSampleY;23 19 24 20 public VectorImageModifier(BufferedImage bi) { … … 44 40 if (pixel == cadastreBackground) { 45 41 bufferedImage.setRGB(x, y, josmBackgroundColor); 46 if (!withBackground)47 withBackground = true;48 backgroundSampleX = x;49 backgroundSampleY = y;50 42 } 51 43 } 52 44 } 45 // The cadastre has now a new background (for invertGrey()) 46 cadastreBackground = josmBackgroundColor; 53 47 } 54 48 … … 81 75 int b = col.getBlue(); 82 76 if ((b == r) && (b == g)) { 83 pixel = ( 0x00 << 32) + ((byte) (255 - r) << 16) + ((byte) (255 - r) << 8) + ((byte) (255 - r));77 pixel = ((byte) col.getAlpha() << 24) + ((byte) (255 - r) << 16) + ((byte) (255 - r) << 8) + ((byte) (255 - r)); 84 78 } 79 // Maybe we should try to find a better formula to avoid discontinuity when text is drawn on a colored item 80 // (building, ...). One could use the conversion to and from HSB to only change the brightness not the color. 81 // Note: the color palette does not have the inverse colors so it may be very weird! 85 82 return pixel; 86 83 } … … 93 90 WritableRaster raster = bufferedImage.getRaster(); 94 91 // pixel is offset in ICM's palette 95 if (withBackground) 96 backgroundPixel = raster.getSample(backgroundSampleX, backgroundSampleY, 0); 97 else 98 backgroundPixel = 1; // default Cadastre background sample 92 backgroundPixel = 1; // default Cadastre background sample 99 93 int size = icm.getMapSize(); 100 94 byte[] reds = new byte[size]; … … 104 98 icm.getGreens(greens); 105 99 icm.getBlues(blues); 100 // The cadastre background has now an alpha to 0 (for invertGrey()) 101 cadastreBackground = 0x00ffffff; 106 102 IndexColorModel icm2 = new IndexColorModel(colorModel.getPixelSize(), size, reds, greens, blues, 107 103 backgroundPixel);
Note:
See TracChangeset
for help on using the changeset viewer.