/** * Returns the value of a single preference for the rendering algorithms. * Hint categories include controls for rendering quality and overall * time/quality trade-off in the rendering process. Refer to the * <code>RenderingHints</code> class for definitions of some common * keys and values. * @param hintKey the key corresponding to the hint to get. * @return an object representing the value for the specified hint key. * Some of the keys and their associated values are defined in the * <code>RenderingHints</code> class. * @see RenderingHints */ public Object getRenderingHint(RenderingHints.Key hintKey){ return _hints.get(hintKey); }
PathGradientContext( ColorModel cm , Rectangle deviceBounds , Rectangle2D userBounds , AffineTransform xform , RenderingHints hints ) { shape = (Shape)hints.get(Drawable.GRADIENT_SHAPE); if (shape == null) { throw new IllegalPathStateException("PathGradientPaint needs a shape to be set via the rendering hint Drawable.GRADIANT_SHAPE."); } this.deviceBounds = deviceBounds; this.userBounds = userBounds; this.xform = xform; this.hints = hints; gradientSteps = getGradientSteps(shape); Point2D start = new Point2D.Double(0, 0); Point2D end = new Point2D.Double(gradientSteps, 0); LinearGradientPaint gradientPaint = new LinearGradientPaint(start, end, fractions, colors, CycleMethod.NO_CYCLE, ColorSpaceType.SRGB, new AffineTransform()); Rectangle bounds = new Rectangle(0, 0, gradientSteps, 1); pCtx = gradientPaint.createContext(cm, bounds, bounds, new AffineTransform(), hints); }
/** Returns the rendering hint for the specified key, or {@code null} if none. */ public final Object getRenderingHint(final RenderingHints.Key key) { return (commonHints != null) ? commonHints.get(key) : null; }
public static BorderExtender getBorderExtenderHint(RenderingHints renderHints) { if (renderHints == null || !renderHints.containsKey(JAI.KEY_BORDER_EXTENDER)) { return null; } else { return (BorderExtender) renderHints.get(JAI.KEY_BORDER_EXTENDER); } }
public static TileCache getTileCacheHint(RenderingHints renderHints) { if (renderHints == null || !renderHints.containsKey(JAI.KEY_TILE_CACHE)) { return null; } else { return (TileCache) renderHints.get(JAI.KEY_TILE_CACHE); } }
public static ImageLayout getImageLayoutHint(RenderingHints renderHints) { if (renderHints == null || !renderHints.containsKey(JAI.KEY_IMAGE_LAYOUT)) { return null; } else { return (ImageLayout) renderHints.get(JAI.KEY_IMAGE_LAYOUT); } }
/** * Gets the image layout from the specified rendering hints, creating a new one if needed. This * method do not modify the specified hints. If the caller modifies the image layout, it should * invoke {@code hints.put(JAI.KEY_IMAGE_LAYOUT, layout)} explicitly. */ private static ImageLayout getImageLayout(final RenderingHints hints) { final Object candidate = hints.get(JAI.KEY_IMAGE_LAYOUT); if (candidate instanceof ImageLayout) { return (ImageLayout) candidate; } return new ImageLayout(); }
public static TileScheduler getTileSchedulerHint(RenderingHints renderHints) { if (renderHints == null || !renderHints.containsKey(JAI.KEY_TILE_SCHEDULER)) { return null; } else { return (TileScheduler) renderHints.get(JAI.KEY_TILE_SCHEDULER); } }
/** * Returns the {@link JAI} instance to use for operations on {@link RenderedImage}. If no JAI * instance is defined for the {@link Hints#JAI_INSTANCE} key, then the default instance is * returned. * * @param hints The rendering hints, or {@code null} if none. * @return The JAI instance to use (never {@code null}). */ public static final JAI getJAI(final RenderingHints hints) { if (hints != null) { final Object value = hints.get(Hints.JAI_INSTANCE); if (value instanceof JAI) { return (JAI) value; } } return JAI.getDefaultInstance(); }
Object value = pHints.get(KEY_RESAMPLE_INTERPOLATION); else if (RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.equals(pHints.get(RenderingHints.KEY_INTERPOLATION)) || (!pHints.containsKey(RenderingHints.KEY_INTERPOLATION) && (RenderingHints.VALUE_RENDER_SPEED.equals(pHints.get(RenderingHints.KEY_RENDERING)) || RenderingHints.VALUE_COLOR_RENDER_SPEED.equals(pHints.get(RenderingHints.KEY_COLOR_RENDERING))))) { else if (RenderingHints.VALUE_INTERPOLATION_BILINEAR.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))) { else if (RenderingHints.VALUE_INTERPOLATION_BICUBIC.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))) { return FILTER_QUADRATIC;// No idea if this is correct..? else if (RenderingHints.VALUE_RENDER_QUALITY.equals(pHints.get(RenderingHints.KEY_RENDERING)) || RenderingHints.VALUE_COLOR_RENDER_QUALITY.equals(pHints.get(RenderingHints.KEY_COLOR_RENDERING))) {
private ImageLayout getImageLayout(RenderedImage image, RenderingHints hints) { ImageLayout layout = (ImageLayout) hints.get(JAI.KEY_IMAGE_LAYOUT); if (layout == null) layout = new ImageLayout(image); layout.setColorModel(this.paletteBuilder.getIndexColorModel()); layout.setSampleModel( paletteBuilder .getIndexColorModel() .createCompatibleSampleModel(image.getWidth(), image.getHeight())); return layout; }
Interpolation getRenderingInterpolation(Layer currLayer) { if (currLayer != null && currLayer.getUserData().containsKey(BYLAYER_INTERPOLATION)) { return (Interpolation) currLayer.getUserData().get(BYLAYER_INTERPOLATION); } if (java2dHints == null) { return Interpolation.getInstance(Interpolation.INTERP_NEAREST); } Object interpolationHint = java2dHints.get(RenderingHints.KEY_INTERPOLATION); if (interpolationHint == null || interpolationHint == RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR) { return Interpolation.getInstance(Interpolation.INTERP_NEAREST); } else if (interpolationHint == RenderingHints.VALUE_INTERPOLATION_BILINEAR) { return Interpolation.getInstance(Interpolation.INTERP_BILINEAR); } else { return Interpolation.getInstance(Interpolation.INTERP_BICUBIC); } }
Object l = localHints.get(JAI.KEY_IMAGE_LAYOUT); if ((l != null) && (l instanceof ImageLayout)) { final ImageLayout layout = (ImageLayout) ((ImageLayout) l).clone();
Object l = localHints.get(JAI.KEY_IMAGE_LAYOUT); if ((l != null) && (l instanceof ImageLayout)) { final ImageLayout layout = (ImageLayout) ((ImageLayout) l).clone();
final ImageLayout layout2 = (ImageLayout) localHints.get(JAI.KEY_IMAGE_LAYOUT); layout2.setColorModel(ColorUtilities.GRAY_CM); layout2.setSampleModel(
final RenderedImage sourceImage, final RenderingHints hints) { ImageLayout layout = (ImageLayout) hints.get(JAI.KEY_IMAGE_LAYOUT); if (layout != null) { layout = (ImageLayout) layout.clone();
ImageLayout layout = (ImageLayout) hints.get(JAI.KEY_IMAGE_LAYOUT); newImageLayout = new ImageLayout2(