List of usage examples for java.awt Rectangle getMinY
public double getMinY()
From source file:org.photovault.dcraw.AHDInterpolateOp.java
/** * Compute a rectangle of destination image by downsampling original * @param img Array of soruce images (containing just one image in this case * @param dst Raster for the results// ww w. ja v a 2s . c o m * @param area Area of dst that needs to be computed */ private void computeDownsample(PlanarImage[] img, WritableRaster dst, Rectangle area) { log.debug("entry: computeDownsample " + area); long entryTime = System.currentTimeMillis(); // Current line of image int rgb[][] = new int[(int) area.getWidth()][3]; int sampleCount[][] = new int[(int) area.getWidth()][3]; Rectangle srcArea = mapDestRect(area, 0); int srcMinx = (int) srcArea.getMinX(); int srcMaxx = (int) srcArea.getMaxX(); int srcMiny = (int) srcArea.getMinY(); int srcMaxy = (int) srcArea.getMaxY(); int dstY = (int) area.getMinY(); int dstMinx = (int) area.getMinX(); int sampleY = 0; RandomIter riter = RandomIterFactory.create(img[0], srcArea); for (int y = srcMiny; y < srcMaxy; y++) { int sampleX = 0; int dstX = 0; for (int x = srcMinx; x < srcMaxx; x++) { int val = riter.getSample(x, y, 0); int color = fc(y, x); color = (color == 3) ? 1 : color; rgb[dstX][color] += val; sampleCount[dstX][color]++; sampleX++; if (sampleX >= downSample) { dstX++; sampleX = 0; } } sampleY++; if (sampleY >= downSample) { for (int x = 0; x < rgb.length; x++) { for (int c = 0; c < 3; c++) { int count = sampleCount[x][c]; if (count == 0) { throw new IllegalStateException("zero samples for color component"); } rgb[x][c] /= count; rgb[x][c] = (int) (rgb[x][c] * mult[c]); } dst.setPixel(dstMinx + x, dstY, rgb[x]); } for (int x = 0; x < rgb.length; x++) { for (int c = 0; c < 3; c++) { rgb[x][c] = 0; sampleCount[x][c] = 0; } } sampleY = 0; dstY++; } } long dur = System.currentTimeMillis() - entryTime; log.debug("exit: computeDownsample in " + dur + "ms"); }
From source file:org.photovault.dcraw.DCRawReaderOp.java
@Override protected void computeRect(PlanarImage[] srcs, WritableRaster dst, Rectangle area) { log.debug("entry: computeRect " + area); checkDataUnpacked();/* w w w . j a va 2 s . c om*/ int[] intVals = new int[1]; for (int row = (int) area.getMinY(); row < area.getMaxY(); row++) { int py = row / 2; for (int col = (int) area.getMinX(); col < area.getMaxX(); col++) { int px = col / 2; int color = fc(row, col); intVals[0] = lrd.image.getChar(8 * (py * lrd.sizes.iwidth + px) + 2 * color) - black; if (intVals[0] < 0) intVals[0] = 0; dst.setPixel(col, row, intVals); } } log.debug("exit: computeRect" + area); }
From source file:ru.runa.wfe.graph.image.figure.AbstractFigure.java
public Line createBorderLine(AngleInfo angle) { Line line = null;// w ww.j a v a 2s . com Rectangle r = getRectangle(); switch (angle.getQuarter()) { case AngleInfo.QUARTER_I: line = LineUtils.createLine(new Point((int) r.getMaxX(), (int) r.getMinY()), new Point((int) r.getMaxX(), (int) r.getMaxY())); break; case AngleInfo.QUARTER_II: line = LineUtils.createLine(new Point((int) r.getMinX(), (int) r.getMinY()), new Point((int) r.getMaxX(), (int) r.getMinY())); break; case AngleInfo.QUARTER_III: line = LineUtils.createLine(new Point((int) r.getMinX(), (int) r.getMinY()), new Point((int) r.getMinX(), (int) r.getMaxY())); break; case AngleInfo.QUARTER_IV: line = LineUtils.createLine(new Point((int) r.getMinX(), (int) r.getMaxY()), new Point((int) r.getMaxX(), (int) r.getMaxY())); break; } return line; }