Java Code Examples for java.awt.RenderingHints#VALUE_RENDER_QUALITY
The following examples show how to use
java.awt.RenderingHints#VALUE_RENDER_QUALITY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiGradientTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 2
Source File: MultiGradientTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 3
Source File: MultiGradientTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 4
Source File: MultiGradientTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 5
Source File: MultiGradientTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 6
Source File: MultiGradientTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 7
Source File: MultiGradientTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 8
Source File: MultiGradientTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 9
Source File: MultiGradientTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 10
Source File: ColorTools.java From commons-imaging with Apache License 2.0 | 6 votes |
public BufferedImage convertToColorSpace(final BufferedImage bi, final ColorSpace to) { final ColorSpace from = bi.getColorModel().getColorSpace(); final RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); final ColorConvertOp op = new ColorConvertOp(from, to, hints); BufferedImage result = op.filter(bi, null); result = relabelColorSpace(result, to); return result; }
Example 11
Source File: ColorTools.java From commons-imaging with Apache License 2.0 | 6 votes |
public BufferedImage convertBetweenColorSpaces(BufferedImage bi, final ColorSpace from, final ColorSpace to) { final RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); final ColorConvertOp op = new ColorConvertOp(from, to, hints); bi = relabelColorSpace(bi, from); BufferedImage result = op.filter(bi, null); result = relabelColorSpace(result, to); return result; }
Example 12
Source File: MultiGradientTest.java From hottub with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == cmbPaint) { paintType = (PaintType)cmbPaint.getSelectedItem(); } else if (source == cmbCycle) { cycleMethod = (CycleMethod)cmbCycle.getSelectedItem(); } else if (source == cmbSpace) { colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem(); } else if (source == cmbShape) { shapeType = (ShapeType)cmbShape.getSelectedItem(); } else if (source == cmbXform) { xformType = (XformType)cmbXform.getSelectedItem(); } else if (source == cbAntialias) { antialiasHint = cbAntialias.isSelected() ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF; } else if (source == cbRender) { renderHint = cbRender.isSelected() ? RenderingHints.VALUE_RENDER_QUALITY : RenderingHints.VALUE_RENDER_SPEED; } gradientPanel.updatePaint(); }
Example 13
Source File: ApplicationPDFPanel.java From wandora with GNU General Public License v3.0 | 5 votes |
@Override protected void paintComponent(Graphics g) { int w = getWidth(); int h = getHeight(); if(g instanceof Graphics2D) { RenderingHints qualityHints = new RenderingHints( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); RenderingHints antialiasHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ((Graphics2D) g).addRenderingHints(qualityHints); ((Graphics2D) g).addRenderingHints(antialiasHints); } if(currentBufferedImage == null) { g.setColor(getBackground()); g.fillRect(0, 0, w, h); g.setColor(Color.black); g.drawString("No page selected", getWidth() / 2 - 30, getHeight() / 2); } else { g.setColor(getBackground()); g.fillRect(0, 0, w, h); g.drawImage(currentBufferedImage, 0, 0, currentBufferedImage.getWidth(), currentBufferedImage.getHeight(), null); } }
Example 14
Source File: ColorTools.java From commons-imaging with Apache License 2.0 | 5 votes |
public BufferedImage convertBetweenColorSpacesX2(BufferedImage bi, final ColorSpace from, final ColorSpace to) { final RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); // bi = relabelColorSpace(bi, cs); // dumpColorSpace("\tcs_sRGB", cs_sRGB); // dumpColorSpace("\tColorModel.getRGBdefaultc", // ColorModel.getRGBdefault().getColorSpace()); bi = relabelColorSpace(bi, from); final ColorConvertOp op = new ColorConvertOp(from, to, hints); bi = op.filter(bi, null); bi = relabelColorSpace(bi, from); bi = op.filter(bi, null); bi = relabelColorSpace(bi, to); return bi; }
Example 15
Source File: Sparkle.java From scava with Eclipse Public License 2.0 | 5 votes |
public BufferedImage renderAsBufferedImage(SparkDimension xdim, SparkDimension ydim) { BufferedImage im = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB); Graphics2D g = (Graphics2D) im.getGraphics(); RenderingHints rh = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHints(rh); g.setColor(Color.white); g.fillRect(0, 0, imgWidth, imgHeight); Color c = new Color(0, 115, 180); g.setColor(c); BasicStroke stroke = new BasicStroke(2); g.setStroke(stroke); // Draw lines int prevX = xdim.get(0); int prevY = imgHeight - ydim.get(0); for (int i = 1; i< xdim.size(); i++) { int x = xdim.get(i); int y = imgHeight - ydim.get(i); g.drawLine(prevX, prevY, x, y); prevX = x; prevY = y; } // Draw high and low Color orange = new Color(255, 148, 0); g.setColor(orange); g.fillOval(xdim.get(ydim.indexOf(ydim.getMinValue()))-5, imgHeight - ydim.scale(ydim.getMinValue())-5, 10, 10); g.fillOval(xdim.get(ydim.indexOf(ydim.getMaxValue()))-5, imgHeight - ydim.scale(ydim.getMaxValue())-5, 10, 10); g.dispose(); return im; }
Example 16
Source File: AffineTransformOp.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Constructs an {@code AffineTransformOp} given an affine transform. * The interpolation type is determined from the * {@code RenderingHints} object. If the interpolation hint is * defined, it will be used. Otherwise, if the rendering quality hint is * defined, the interpolation type is determined from its value. If no * hints are specified ({@code hints} is null), * the interpolation type is {@link #TYPE_NEAREST_NEIGHBOR * TYPE_NEAREST_NEIGHBOR}. * * @param xform The {@code AffineTransform} to use for the * operation. * * @param hints The {@code RenderingHints} object used to specify * the interpolation type for the operation. * * @throws ImagingOpException if the transform is non-invertible. * @see java.awt.RenderingHints#KEY_INTERPOLATION * @see java.awt.RenderingHints#KEY_RENDERING */ public AffineTransformOp(AffineTransform xform, RenderingHints hints){ validateTransform(xform); this.xform = (AffineTransform) xform.clone(); this.hints = hints; if (hints != null) { Object value = hints.get(RenderingHints.KEY_INTERPOLATION); if (value == null) { value = hints.get(RenderingHints.KEY_RENDERING); if (value == RenderingHints.VALUE_RENDER_SPEED) { interpolationType = TYPE_NEAREST_NEIGHBOR; } else if (value == RenderingHints.VALUE_RENDER_QUALITY) { interpolationType = TYPE_BILINEAR; } } else if (value == RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR) { interpolationType = TYPE_NEAREST_NEIGHBOR; } else if (value == RenderingHints.VALUE_INTERPOLATION_BILINEAR) { interpolationType = TYPE_BILINEAR; } else if (value == RenderingHints.VALUE_INTERPOLATION_BICUBIC) { interpolationType = TYPE_BICUBIC; } } else { interpolationType = TYPE_NEAREST_NEIGHBOR; } }
Example 17
Source File: AffineTransformOp.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Constructs an {@code AffineTransformOp} given an affine transform. * The interpolation type is determined from the * {@code RenderingHints} object. If the interpolation hint is * defined, it will be used. Otherwise, if the rendering quality hint is * defined, the interpolation type is determined from its value. If no * hints are specified ({@code hints} is null), * the interpolation type is {@link #TYPE_NEAREST_NEIGHBOR * TYPE_NEAREST_NEIGHBOR}. * * @param xform The {@code AffineTransform} to use for the * operation. * * @param hints The {@code RenderingHints} object used to specify * the interpolation type for the operation. * * @throws ImagingOpException if the transform is non-invertible. * @see java.awt.RenderingHints#KEY_INTERPOLATION * @see java.awt.RenderingHints#KEY_RENDERING */ public AffineTransformOp(AffineTransform xform, RenderingHints hints){ validateTransform(xform); this.xform = (AffineTransform) xform.clone(); this.hints = hints; if (hints != null) { Object value = hints.get(RenderingHints.KEY_INTERPOLATION); if (value == null) { value = hints.get(RenderingHints.KEY_RENDERING); if (value == RenderingHints.VALUE_RENDER_SPEED) { interpolationType = TYPE_NEAREST_NEIGHBOR; } else if (value == RenderingHints.VALUE_RENDER_QUALITY) { interpolationType = TYPE_BILINEAR; } } else if (value == RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR) { interpolationType = TYPE_NEAREST_NEIGHBOR; } else if (value == RenderingHints.VALUE_INTERPOLATION_BILINEAR) { interpolationType = TYPE_BILINEAR; } else if (value == RenderingHints.VALUE_INTERPOLATION_BICUBIC) { interpolationType = TYPE_BICUBIC; } } else { interpolationType = TYPE_NEAREST_NEIGHBOR; } }
Example 18
Source File: InfiniteProgressPanel.java From qmcflactomp3 with GNU General Public License v3.0 | 5 votes |
public InfiniteProgressPanel(String text, int barsCount, float shield, float fps, int rampDelay) { this.text = text; this.rampDelay = rampDelay >= 0 ? rampDelay : 0; this.shield = shield >= 0.0f ? shield : 0.0f; this.fps = fps > 0.0f ? fps : 15.0f; this.barsCount = barsCount > 0 ? barsCount : 14; this.hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); this.hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); this.hints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); }
Example 19
Source File: AnimatedPanel.java From qmcflactomp3 with GNU General Public License v3.0 | 5 votes |
/** * Modifie la luminosit茅 de l'image. * * @param multiple Le taux de luminosit茅 */ private void setBrightness(float multiple) { float[] brightKernel = { multiple }; RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); BufferedImageOp bright = new ConvolveOp(new Kernel(1, 1, brightKernel), ConvolveOp.EDGE_NO_OP, hints); bright.filter(originalImage, convolvedImage); repaint(); }
Example 20
Source File: InfiniteProgressPanel.java From ghidra with Apache License 2.0 | 5 votes |
public InfiniteProgressPanel( String text, int barsCount, float shield, int fps, int rampDelay ) { setText( text ); this.fadeDelay = rampDelay >= 0 ? rampDelay : 0; this.shield = shield >= 0.0f ? shield : 0.0f; this.fps = fps > 0 ? fps : 15; this.barsCount = barsCount > 0 ? barsCount : 14; this.hints = new RenderingHints( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY ); this.hints.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); this.hints.put( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON ); }