List of usage examples for java.awt RenderingHints KEY_TEXT_ANTIALIASING
Key KEY_TEXT_ANTIALIASING
To view the source code for java.awt RenderingHints KEY_TEXT_ANTIALIASING.
Click Source Link
From source file:org.apache.fop.render.bitmap.AbstractBitmapDocumentHandler.java
/** {@inheritDoc} */ public IFPainter startPageContent() throws IFException { int bitmapWidth; int bitmapHeight; double scale; Point2D offset = null;/*from www .ja v a2 s . co m*/ if (targetBitmapSize != null) { //Fit the generated page proportionally into the given rectangle (in pixels) double scale2w = 1000 * targetBitmapSize.width / this.currentPageDimensions.getWidth(); double scale2h = 1000 * targetBitmapSize.height / this.currentPageDimensions.getHeight(); bitmapWidth = targetBitmapSize.width; bitmapHeight = targetBitmapSize.height; //Centering the page in the given bitmap offset = new Point2D.Double(); if (scale2w < scale2h) { scale = scale2w; double h = this.currentPageDimensions.height * scale / 1000; offset.setLocation(0, (bitmapHeight - h) / 2.0); } else { scale = scale2h; double w = this.currentPageDimensions.width * scale / 1000; offset.setLocation((bitmapWidth - w) / 2.0, 0); } } else { //Normal case: just scale according to the target resolution scale = scaleFactor * getUserAgent().getTargetResolution() / FopFactoryConfigurator.DEFAULT_TARGET_RESOLUTION; bitmapWidth = (int) ((this.currentPageDimensions.width * scale / 1000f) + 0.5f); bitmapHeight = (int) ((this.currentPageDimensions.height * scale / 1000f) + 0.5f); } //Set up bitmap to paint on this.currentImage = createBufferedImage(bitmapWidth, bitmapHeight); Graphics2D graphics2D = this.currentImage.createGraphics(); // draw page background if (!getSettings().hasTransparentPageBackground()) { graphics2D.setBackground(getSettings().getPageBackgroundColor()); graphics2D.setPaint(getSettings().getPageBackgroundColor()); graphics2D.fillRect(0, 0, bitmapWidth, bitmapHeight); } //Set rendering hints graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); if (getSettings().isAntiAliasingEnabled() && this.currentImage.getColorModel().getPixelSize() > 1) { graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } else { graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } if (getSettings().isQualityRenderingEnabled()) { graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); } else { graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); } graphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); //Set up initial coordinate system for the page if (offset != null) { graphics2D.translate(offset.getX(), offset.getY()); } graphics2D.scale(scale / 1000f, scale / 1000f); return new Java2DPainter(graphics2D, getContext(), getFontInfo()); }
From source file:org.broad.igv.renderer.SpliceJunctionRenderer.java
/** * Note: assumption is that featureList is sorted by pStart position. * * @param featureList// w w w.j a v a2 s .c om * @param context * @param trackRectangle * @param track */ @Override public void render(List<IGVFeature> featureList, RenderContext context, Rectangle trackRectangle, Track track) { double origin = context.getOrigin(); double locScale = context.getScale(); // TODO -- use enum instead of string "Color" if ((featureList != null) && !featureList.isEmpty()) { // Create a graphics object to draw font names. Graphics are not cached // by font, only by color, so its neccessary to create a new one to prevent // affecting other tracks. Font font = FontManager.getFont(track.getFontSize()); Graphics2D fontGraphics = (Graphics2D) context.getGraphic2DForColor(Color.BLACK).create(); if (PreferenceManager.getInstance().getAsBoolean(PreferenceManager.ENABLE_ANTIALISING)) { fontGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } fontGraphics.setFont(font); //determine whether to show flanking regions PreferenceManager prefs = PreferenceManager.getInstance(); boolean shouldShowFlankingRegions = prefs .getAsBoolean(PreferenceManager.SAM_SHOW_JUNCTION_FLANKINGREGIONS); // Track coordinates double trackRectangleX = trackRectangle.getX(); double trackRectangleMaxX = trackRectangle.getMaxX(); SpliceJunctionFeature selectedFeature = (SpliceJunctionFeature) ((FeatureTrack) track) .getSelectedFeature(); // Start of Roche-Tessella modification if (track.getAutoScale()) { Frequency f = new Frequency(); List<Integer> scores = new ArrayList<Integer>(); for (IGVFeature feature : featureList) { SpliceJunctionFeature junctionFeature = (SpliceJunctionFeature) feature; f.addValue(junctionFeature.getScore()); scores.add((int) junctionFeature.getScore()); } Collections.sort(scores); Collections.reverse(scores); for (int s : scores) { if (f.getCumPct(s) < 0.99) { maxDepth = s; break; } } } // End of Roche-Tessella modification for (IGVFeature feature : featureList) { SpliceJunctionFeature junctionFeature = (SpliceJunctionFeature) feature; //if same junction as selected feature, highlight boolean shouldHighlight = false; if (selectedFeature != null && selectedFeature.isSameJunction(junctionFeature)) { setHighlightFeature(junctionFeature); shouldHighlight = true; } // Get the pStart and pEnd of the entire feature. at extreme zoom levels the // virtual pixel value can be too large for an int, so the computation is // done in double precision and cast to an int only when its confirmed its // within the field of view. int flankingStart = junctionFeature.getStart(); int flankingEnd = junctionFeature.getEnd(); int junctionStart = junctionFeature.getJunctionStart(); int junctionEnd = junctionFeature.getJunctionEnd(); double virtualPixelStart = Math.round((flankingStart - origin) / locScale); double virtualPixelEnd = Math.round((flankingEnd - origin) / locScale); double virtualPixelJunctionStart = Math.round((junctionStart - origin) / locScale); double virtualPixelJunctionEnd = Math.round((junctionEnd - origin) / locScale); // If the any part of the feature fits in the // Track rectangle draw it if ((virtualPixelEnd >= trackRectangleX) && (virtualPixelStart <= trackRectangleMaxX)) { // int displayPixelEnd = (int) Math.min(trackRectangleMaxX, virtualPixelEnd); int displayPixelStart = (int) Math.max(trackRectangleX, virtualPixelStart); float depth = junctionFeature.getJunctionDepth(); Color color = feature.getColor(); drawFeature((int) virtualPixelStart, (int) virtualPixelEnd, (int) virtualPixelJunctionStart, (int) virtualPixelJunctionEnd, depth, trackRectangle, context, feature.getStrand(), junctionFeature, shouldHighlight, color, shouldShowFlankingRegions); } } //draw a central horizontal line Graphics2D g2D = context.getGraphic2DForColor(COLOR_CENTERLINE); g2D.drawLine((int) trackRectangleX, (int) trackRectangle.getCenterY(), (int) trackRectangleMaxX, (int) trackRectangle.getCenterY()); } }
From source file:org.broad.igv.renderer.SpliceJunctionRenderer.java
/** * Draw a filled arc representing a single feature. The thickness and height of the arc are proportional to the * depth of coverage. Some of this gets a bit arcane -- the result of lots of visual tweaking. * * @param pixelFeatureStart the starting position of the feature, whether on-screen or not * @param pixelFeatureEnd the ending position of the feature, whether on-screen or not * @param pixelJunctionStart the starting position of the junction, whether on-screen or not * @param pixelJunctionEnd the ending position of the junction, whether on-screen or not * @param depth coverage depth * @param trackRectangle/*from w w w . j a v a 2 s. c o m*/ * @param context * @param strand * @param junctionFeature * @param shouldHighlight * @param featureColor the color specified for this feature. May be null. */ protected void drawFeature(int pixelFeatureStart, int pixelFeatureEnd, int pixelJunctionStart, int pixelJunctionEnd, float depth, Rectangle trackRectangle, RenderContext context, Strand strand, SpliceJunctionFeature junctionFeature, boolean shouldHighlight, Color featureColor, boolean shouldShowFlankingRegions) { boolean isPositiveStrand = true; // Get the feature's direction, color appropriately if (strand != null && strand.equals(Strand.NEGATIVE)) isPositiveStrand = false; //If the feature color is specified, use it, except that we set our own alpha depending on whether //the feature is highlighted. Otherwise default based on strand and highlight. Color color; if (featureColor != null) { int r = featureColor.getRed(); int g = featureColor.getGreen(); int b = featureColor.getBlue(); int alpha = shouldHighlight ? 255 : 140; color = new Color(r, g, b, alpha); } else { if (isPositiveStrand) color = shouldHighlight ? ARC_COLOR_HIGHLIGHT_POS : ARC_COLOR_POS; else color = shouldHighlight ? ARC_COLOR_HIGHLIGHT_NEG : ARC_COLOR_NEG; } Graphics2D g2D = context.getGraphic2DForColor(color); if (PreferenceManager.getInstance().getAsBoolean(PreferenceManager.ENABLE_ANTIALISING)) { g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } //Height of top of an arc of maximum depth int maxPossibleArcHeight = (trackRectangle.height - 1) / 2; if (shouldShowFlankingRegions) { if (junctionFeature.hasFlankingRegionDepthArrays()) { //draw a wigglegram of the splice junction flanking region depth of coverage int startFlankingRegionPixelLength = pixelJunctionStart - pixelFeatureStart; int endFlankingRegionPixelLength = pixelFeatureEnd - pixelJunctionEnd; drawFlankingRegion(g2D, pixelFeatureStart, startFlankingRegionPixelLength, junctionFeature.getStartFlankingRegionDepthArray(), maxPossibleArcHeight, trackRectangle, isPositiveStrand); drawFlankingRegion(g2D, pixelJunctionEnd + 1, endFlankingRegionPixelLength, junctionFeature.getEndFlankingRegionDepthArray(), maxPossibleArcHeight, trackRectangle, isPositiveStrand); } else { //Draw rectangles indicating the overlap on each side of the junction int overlapRectHeight = 3; int overlapRectTopX = (int) trackRectangle.getCenterY() + (isPositiveStrand ? -2 : 0); if (pixelFeatureStart < pixelJunctionStart) { g2D.fillRect(pixelFeatureStart, overlapRectTopX, pixelJunctionStart - pixelFeatureStart, overlapRectHeight); } if (pixelJunctionEnd < pixelFeatureEnd) { g2D.fillRect(pixelJunctionEnd, overlapRectTopX, pixelFeatureEnd - pixelJunctionEnd, overlapRectHeight); } } } //Create a path describing the arc, using Bezier curves. The Bezier control points for the top and //bottom arcs are based on the boundary points of the rectangles containing the arcs //proportion of the maximum arc height used by a minimum-height arc double minArcHeightProportion = 0.33; int innerArcHeight = (int) (maxPossibleArcHeight * minArcHeightProportion); float depthProportionOfMax = Math.min(1, depth / maxDepth); int arcWidth = Math.max(1, (int) ((1 - minArcHeightProportion) * maxPossibleArcHeight * depthProportionOfMax)); int outerArcHeight = innerArcHeight + arcWidth; //Height of bottom of the arc int arcBeginY = (int) trackRectangle.getCenterY() + (isPositiveStrand ? -1 : 1); int outerArcPeakY = isPositiveStrand ? arcBeginY - outerArcHeight : arcBeginY + outerArcHeight; int innerArcPeakY = isPositiveStrand ? arcBeginY - innerArcHeight : arcBeginY + innerArcHeight; //dhmay: I don't really understand Bezier curves. For some reason I have to put the Bezier control //points farther up or down than I want the arcs to extend. This multiplier seems about right int outerBezierY = arcBeginY + (int) (1.3 * (outerArcPeakY - arcBeginY)); int innerBezierY = arcBeginY + (int) (1.3 * (innerArcPeakY - arcBeginY)); //Putting the Bezier control points slightly off to the sides of the arc int bezierXPad = Math.max(1, (pixelJunctionEnd - pixelJunctionStart) / 30); GeneralPath arcPath = new GeneralPath(); arcPath.moveTo(pixelJunctionStart, arcBeginY); arcPath.curveTo(pixelJunctionStart - bezierXPad, outerBezierY, //Bezier 1 pixelJunctionEnd + bezierXPad, outerBezierY, //Bezier 2 pixelJunctionEnd, arcBeginY); //Arc end arcPath.curveTo(pixelJunctionEnd + bezierXPad, innerBezierY, //Bezier 1 pixelJunctionStart - bezierXPad, innerBezierY, //Bezier 2 pixelJunctionStart, arcBeginY); //Arc end //Draw the arc, to ensure outline is drawn completely (fill won't do it, necessarily). This will also //give the arc a darker outline g2D.draw(arcPath); //Fill the arc g2D.fill(arcPath); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT); g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); }
From source file:org.colombbus.tangara.AboutWindow.java
private BufferedImage createBackgroundImage(Image baseBackgroundImg) { BufferedImage newImg = new BufferedImage(baseBackgroundImg.getWidth(null), baseBackgroundImg.getHeight(null), BufferedImage.TYPE_INT_RGB); newImg.getGraphics().drawImage(baseBackgroundImg, 0, 0, null); Graphics2D drawingGraphics = (Graphics2D) newImg.getGraphics(); Color titleColor = Configuration.instance().getColor("tangara.title.color"); String titleText = Configuration.instance().getString("tangara.title"); Font titleFont = Configuration.instance().getFont("tangara.title.font"); drawingGraphics.setFont(titleFont);/*from w w w .j av a2s .c om*/ drawingGraphics.setColor(titleColor); drawingGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); drawingGraphics.drawString(titleText, marginLeft, windowHeight / 2 - marginText); return newImg; }
From source file:org.cruk.mga.CreateReport.java
/** * Creates a summary plot for the given set of multi-genome alignment summaries. * * @param multiGenomeAlignmentSummaries//from w ww .ja v a 2s .com * @param the name of the image file * @throws IOException */ private void createSummaryPlot(Collection<MultiGenomeAlignmentSummary> multiGenomeAlignmentSummaries, String imageFilename) throws IOException { if (imageFilename == null) return; int n = multiGenomeAlignmentSummaries.size(); log.debug("Number of summaries = " + n); scaleForPlotWidth(); int fontHeight = getFontHeight(); int rowHeight = (int) (fontHeight * ROW_HEIGHT_SCALING_FACTOR); int labelOffset = (rowHeight - fontHeight) / 2; int rowGap = (int) (fontHeight * ROW_GAP_SCALING_FACTOR); int height = (rowHeight + rowGap) * (n + 3); int rowSeparation = rowHeight + rowGap; BufferedImage image = new BufferedImage(plotWidth, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2.setStroke(new BasicStroke(Math.max(1.0f, 0.65f * scaleFactor))); g2.setFont(font); g2.setColor(Color.WHITE); g2.fillRect(0, 0, plotWidth, height); g2.setColor(Color.BLACK); int offset = rowGap + rowHeight - labelOffset; int x0 = drawLabels(g2, offset, rowSeparation, multiGenomeAlignmentSummaries); long maxSequenceCount = getMaximumSequenceCount(multiGenomeAlignmentSummaries); log.debug("Maximum sequence count: " + maxSequenceCount); maxSequenceCount = Math.max(maxSequenceCount, minimumSequenceCount); long tickInterval = (int) getTickInterval(maxSequenceCount); log.debug("Tick interval: " + tickInterval); int tickIntervals = (int) (Math.max(1, maxSequenceCount) / tickInterval); if (maxSequenceCount % tickInterval != 0) tickIntervals += 1; maxSequenceCount = tickIntervals * tickInterval; log.debug("No. tick intervals: " + tickIntervals); log.debug("Maximum sequence count: " + maxSequenceCount); int y = rowGap + n * rowSeparation; int x1 = drawAxisAndLegend(g2, x0, y, tickIntervals, maxSequenceCount); offset = rowGap; drawAlignmentBars(g2, offset, rowHeight, rowSeparation, x0, x1, maxSequenceCount, multiGenomeAlignmentSummaries); BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(imageFilename)); ImageIO.write(image, "png", out); out.close(); }
From source file:org.csstudio.swt.widgets.figures.ImageFigure.java
private void initRenderingHints() { transcoder.getRenderingHints().put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); transcoder.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); transcoder.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); transcoder.getRenderingHints().put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); transcoder.getRenderingHints().put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); }
From source file:org.eclipse.birt.chart.device.g2d.G2dRendererBase.java
protected void prepareGraphicsContext() { _g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); _g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); getDisplayServer().setGraphicsContext(_g2d); }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
protected Element createText(String text) { // #232718 to support bidi boolean bRtl = false; if (text.length() > 0) { int iEnd = text.length(); if (chPDF == text.charAt(text.length() - 1)) { iEnd--;//w w w. j av a2 s.c o m } if (chRLE == text.charAt(0)) { bRtl = true; text = text.substring(1, iEnd); } } Element elem = dom.createElement("text"); //$NON-NLS-1$ elem.appendChild(dom.createTextNode(text)); switch (getFont().getStyle()) { case Font.BOLD: elem.setAttribute("font-weight", "bold"); //$NON-NLS-1$ //$NON-NLS-2$ break; case Font.ITALIC: elem.setAttribute("font-style", "italic"); //$NON-NLS-1$ //$NON-NLS-2$ break; case (Font.BOLD + Font.ITALIC): elem.setAttribute("font-style", "italic"); //$NON-NLS-1$ //$NON-NLS-2$ elem.setAttribute("font-weight", "bold"); //$NON-NLS-1$ //$NON-NLS-2$ break; } String textDecorator = null; Map<TextAttribute, ?> attributes = getFont().getAttributes(); if (attributes.get(TextAttribute.UNDERLINE) == TextAttribute.UNDERLINE_ON) { textDecorator = "underline"; //$NON-NLS-1$ } if (attributes.get(TextAttribute.STRIKETHROUGH) == TextAttribute.STRIKETHROUGH_ON) { if (textDecorator == null) textDecorator = "line-through"; //$NON-NLS-1$ else textDecorator += ",line-through"; //$NON-NLS-1$ } if (textDecorator != null) elem.setAttribute("text-decoration", textDecorator); //$NON-NLS-1$ // for now just preserve space for text elements Bug 182159 elem.setAttribute("xml:space", "preserve"); //$NON-NLS-1$ //$NON-NLS-2$ elem.setAttribute("stroke", "none"); //$NON-NLS-1$ //$NON-NLS-2$ // Here we still use Font.getName() as font-family for SVG instead of // Font.getFaimly(), since if current code is running on linux and there // isn't a valid font family to fit the font setting in chart model, // the call of Font.getFamily() will get a default 'Dialog' font family, // it will caused that the svg in client system can't correct display // mulitple-characters text(Chinese, Jpanese and so on). // We just need to set the original font family setting of chart model // into svg document, if the font family is valid in client system // and can support current text character, it will correct display. elem.setAttribute("font-family", getFont().getName()); //$NON-NLS-1$ elem.setAttribute("font-size", Integer.toString(getFont().getSize())); //$NON-NLS-1$ String style = getRenderingStyle(RenderingHints.KEY_TEXT_ANTIALIASING); if (color != null) { String alpha = alphaToString(color); if (alpha != null) style += "fill-opacity:" + alpha + ";"; //$NON-NLS-1$ //$NON-NLS-2$ style += "fill:" + serializeToString(color) + ";"; //$NON-NLS-1$ //$NON-NLS-2$ } if (bRtl) { style += sStyleBidi; } elem.setAttribute("style", style); //$NON-NLS-1$ if (transforms.getType() != AffineTransform.TYPE_IDENTITY) { double[] matrix = new double[6]; transforms.getMatrix(matrix); elem.setAttribute("transform", "matrix(" + toString(matrix, ',') + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return elem; }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
protected String getRenderingStyle(Object key) { Object value = renderingHints.get(key); if (key.equals(RenderingHints.KEY_TEXT_ANTIALIASING)) { if (value.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)) { // Adobe SVG viewer 3 bug. Rotated text with optimizelegibility // disappears. Replace // with optimizespeed for rotated text. if (transforms.getType() != AffineTransform.TYPE_IDENTITY) return "text-rendering:optimizeSpeed;";//$NON-NLS-1$ else//from w ww . j a va2 s.c om return "text-rendering:optimizeLegibility;";//$NON-NLS-1$ } else // SVG always turns on antialias return ""; //$NON-NLS-1$ } return "";//$NON-NLS-1$ }
From source file:org.esa.s2tbx.dataio.s2.l1b.L1bSceneDescription.java
public BufferedImage createTilePicture(int width) { Color[] colors = new Color[] { Color.GREEN, Color.RED, Color.BLUE, Color.YELLOW }; double scale = width / sceneRectangle.getWidth(); int height = (int) Math.round(sceneRectangle.getHeight() * scale); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = image.createGraphics(); graphics.scale(scale, scale);//from w ww.j a v a 2 s. co m graphics.translate(-sceneRectangle.getX(), -sceneRectangle.getY()); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); graphics.setPaint(Color.WHITE); graphics.fill(sceneRectangle); graphics.setStroke(new BasicStroke(100F)); graphics.setFont(new Font("Arial", Font.PLAIN, 800)); for (int i = 0; i < tileInfos.length; i++) { Rectangle rect = tileInfos[i].rectangle; graphics.setPaint(addAlpha(colors[i % colors.length].brighter(), 100)); graphics.fill(rect); } for (int i = 0; i < tileInfos.length; i++) { Rectangle rect = tileInfos[i].rectangle; graphics.setPaint(addAlpha(colors[i % colors.length].darker(), 100)); graphics.draw(rect); graphics.setPaint(colors[i % colors.length].darker().darker()); graphics.drawString("Tile " + (i + 1) + ": " + tileInfos[i].id, rect.x + 1200F, rect.y + 2200F); } return image; }