/** * Default constructor. */ public FilterChainRable8Bit(Filter source, Rectangle2D filterRegion){ if(source == null){ throw new IllegalArgumentException(); } if(filterRegion == null){ throw new IllegalArgumentException(); } // Build crop with chain source and dummy region (will be lazily evaluated // later on). Rectangle2D padRect = (Rectangle2D)filterRegion.clone(); crop = new PadRable8Bit(source, padRect, PadMode.ZERO_PAD); // Keep a reference to the chain source and filter // regions. this.chainSource = source; this.filterRegion = filterRegion; // crop is the real shource for this filter // The filter chain is a simple passthrough to its // crop node. init(crop); }
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); // We only depend on our source for stuff that is inside // our bounds and his bounds (remember our bounds may be // tighter than his in one or both directions). Rectangle2D srect = getSource().getBounds2D(); if ( ! srect.intersects(outputRgn) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, outputRgn, srect); Rectangle2D bounds = getBounds2D(); if ( ! srect.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, bounds, srect); return srect; }
/** * Should perform the equivilent action as * createRendering followed by drawing the RenderedImage to * Graphics2D, or return false. * * @param g2d The Graphics2D to draw to. * @return true if the paint call succeeded, false if * for some reason the paint failed (in which * case a createRendering should be used). */ public boolean paintRable(Graphics2D g2d) { // This optimization only apply if we are using // SrcOver. Otherwise things break... Composite c = g2d.getComposite(); if (!SVGComposite.OVER.equals(c)) return false; if (getPadMode() != PadMode.ZERO_PAD) return false; Rectangle2D padBounds = getPadRect(); Shape clip = g2d.getClip(); g2d.clip(padBounds); GraphicsUtil.drawImage(g2d, getSource()); g2d.setClip(clip); return true; }
/** * Set the current extension mode for pad * @param padMode the new pad mode */ public void setPadMode(PadMode padMode) { touch(); this.padMode = padMode; }
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); inputRgn = (Rectangle2D)inputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Changes in the input region don't propogate outside our // bounds. if ( ! inputRgn.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(inputRgn, bounds, inputRgn); return inputRgn; }
/** * Set the current rectangle for padding. * @param rect the new rectangle to use for pad. */ public void setPadRect(Rectangle2D rect) { touch(); this.padRect = rect; }
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); inputRgn = (Rectangle2D)inputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Changes in the input region don't propogate outside our // bounds. if ( ! inputRgn.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(inputRgn, bounds, inputRgn); return inputRgn; }
/** * Default constructor. */ public FilterChainRable8Bit(Filter source, Rectangle2D filterRegion){ if(source == null){ throw new IllegalArgumentException(); } if(filterRegion == null){ throw new IllegalArgumentException(); } // Build crop with chain source and dummy region (will be lazily evaluated // later on). Rectangle2D padRect = (Rectangle2D)filterRegion.clone(); crop = new PadRable8Bit(source, padRect, PadMode.ZERO_PAD); // Keep a reference to the chain source and filter // regions. this.chainSource = source; this.filterRegion = filterRegion; // crop is the real shource for this filter // The filter chain is a simple passthrough to its // crop node. init(crop); }
/** * Should perform the equivilent action as * createRendering followed by drawing the RenderedImage to * Graphics2D, or return false. * * @param g2d The Graphics2D to draw to. * @return true if the paint call succeeded, false if * for some reason the paint failed (in which * case a createRendering should be used). */ public boolean paintRable(Graphics2D g2d) { // This optimization only apply if we are using // SrcOver. Otherwise things break... Composite c = g2d.getComposite(); if (!SVGComposite.OVER.equals(c)) return false; if (getPadMode() != PadMode.ZERO_PAD) return false; Rectangle2D padBounds = getPadRect(); Shape clip = g2d.getClip(); g2d.clip(padBounds); GraphicsUtil.drawImage(g2d, getSource()); g2d.setClip(clip); return true; }
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); // We only depend on our source for stuff that is inside // our bounds and his bounds (remember our bounds may be // tighter than his in one or both directions). Rectangle2D srect = getSource().getBounds2D(); if ( ! srect.intersects(outputRgn) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, outputRgn, srect); Rectangle2D bounds = getBounds2D(); if ( ! srect.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, bounds, srect); return srect; }
/** * Set the current rectangle for padding. * @param rect the new rectangle to use for pad. */ public void setPadRect(Rectangle2D rect) { touch(); this.padRect = rect; }
public Shape getDirtyRegion(int srcIndex, Rectangle2D inputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); inputRgn = (Rectangle2D)inputRgn.clone(); Rectangle2D bounds = getBounds2D(); // Changes in the input region don't propogate outside our // bounds. if ( ! inputRgn.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(inputRgn, bounds, inputRgn); return inputRgn; }
/** * Default constructor. */ public FilterChainRable8Bit(Filter source, Rectangle2D filterRegion){ if(source == null){ throw new IllegalArgumentException(); } if(filterRegion == null){ throw new IllegalArgumentException(); } // Build crop with chain source and dummy region (will be lazily evaluated // later on). Rectangle2D padRect = (Rectangle2D)filterRegion.clone(); crop = new PadRable8Bit(source, padRect, PadMode.ZERO_PAD); // Keep a reference to the chain source and filter // regions. this.chainSource = source; this.filterRegion = filterRegion; // crop is the real shource for this filter // The filter chain is a simple passthrough to its // crop node. init(crop); }
/** * Should perform the equivilent action as * createRendering followed by drawing the RenderedImage to * Graphics2D, or return false. * * @param g2d The Graphics2D to draw to. * @return true if the paint call succeeded, false if * for some reason the paint failed (in which * case a createRendering should be used). */ public boolean paintRable(Graphics2D g2d) { // This optimization only apply if we are using // SrcOver. Otherwise things break... Composite c = g2d.getComposite(); if (!SVGComposite.OVER.equals(c)) return false; if (getPadMode() != PadMode.ZERO_PAD) return false; Rectangle2D padBounds = getPadRect(); Shape clip = g2d.getClip(); g2d.clip(padBounds); GraphicsUtil.drawImage(g2d, getSource()); g2d.setClip(clip); return true; }
public Shape getDependencyRegion(int srcIndex, Rectangle2D outputRgn) { if (srcIndex != 0) throw new IndexOutOfBoundsException("Affine only has one input"); // We only depend on our source for stuff that is inside // our bounds and his bounds (remember our bounds may be // tighter than his in one or both directions). Rectangle2D srect = getSource().getBounds2D(); if ( ! srect.intersects(outputRgn) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, outputRgn, srect); Rectangle2D bounds = getBounds2D(); if ( ! srect.intersects(bounds) ) return new Rectangle2D.Float(); Rectangle2D.intersect(srect, bounds, srect); return srect; }
/** * Set the current extension mode for pad * @param padMode the new pad mode */ public void setPadMode(PadMode padMode) { touch(); this.padMode = padMode; }
source = new PadRable8Bit(source, filterRegion, PadMode.ZERO_PAD); source = new PadRable8Bit(source, filterRegion, PadMode.ZERO_PAD);
if (rh == null) rh = new RenderingHints(null); Filter src = getSource(); Shape aoi = rc.getAreaOfInterest(); aoi = getBounds2D(); Rectangle2D rect = getBounds2D(); Rectangle2D arect = aoi.getBounds2D();
/** * Set the current extension mode for pad * @param padMode the new pad mode */ public void setPadMode(PadMode padMode) { touch(); this.padMode = padMode; }
source = new PadRable8Bit(source, filterRegion, PadMode.ZERO_PAD); source = new PadRable8Bit(source, filterRegion, PadMode.ZERO_PAD);