Revision 18856

View differences:

trunk/extensions/extRasterTools-SE/src/org/gvsig/raster/regionalpha/filter/RegionAlphaFilter.java
161 161
		if ((windowExtent == null) || (gridExtent == null))
162 162
			return;
163 163
		double newX = windowExtent.minX() + ((((double) x) * windowExtent.width()) / ((double) raster.getWidth()));
164
		double newY = windowExtent.minY() + ((( (double) (raster.getHeight() - (y + 1))) * windowExtent.height()) / ((double) raster.getHeight()));
164
		double newY = windowExtent.minY() + ((( (double) (raster.getHeight() - (y ))) * windowExtent.height()) / ((double) raster.getHeight()));
165 165
		
166 166
		Point2D point2D = dataset.worldToRaster(new Point2D.Double(newX, newY));
167 167
		newX = point2D.getX();
......
169 169
		
170 170
		if(alphaBandNumber < 0) {
171 171
			for (int i = 0; i < rois.size(); i++) {
172
				if (((ROI) rois.get(i)).isInGrid((int) Math.floor(newX), (int) Math.floor(newY))) {
172
				if (((ROI) rois.get(i)).isInGrid((int) Math.round(newX), (int) Math.round(newY))) {
173 173
					rasterAlpha.setElem(y, x, 0, (byte) (255 - alpha));
174 174
					return;
175 175
				}
......
177 177
			rasterAlpha.setElem(y, x, 0, (byte) 255);
178 178
		} else {
179 179
			for (int i = 0; i < rois.size(); i++) {
180
				if (((ROI) rois.get(i)).isInGrid((int) Math.floor(newX), (int) Math.floor(newY))) {
180
				if (((ROI) rois.get(i)).isInGrid((int) Math.round(newX), (int) Math.round(newY))) {
181 181
					raster.setElem(y, x, alphaBandNumber, 
182 182
						(byte) (((255 - alpha) & 0xff) * (raster.getElemByte(y, x, alphaBandNumber) & 0xff) / 255));
183 183
					return;

Also available in: Unified diff