java.awt.Composite Java Examples
The following examples show how to use
java.awt.Composite.
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: Plot.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Draws the background image (if there is one) aligned within the * specified area. * * @param g2 the graphics device. * @param area the area. * * @see #getBackgroundImage() * @see #getBackgroundImageAlignment() * @see #getBackgroundImageAlpha() */ public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) { if (this.backgroundImage == null) { return; // nothing to do } Composite savedComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, this.backgroundImageAlpha)); Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0, this.backgroundImage.getWidth(null), this.backgroundImage.getHeight(null)); Align.align(dest, area, this.backgroundImageAlignment); Shape savedClip = g2.getClip(); g2.clip(area); g2.drawImage(this.backgroundImage, (int) dest.getX(), (int) dest.getY(), (int) dest.getWidth() + 1, (int) dest.getHeight() + 1, null); g2.setClip(savedClip); g2.setComposite(savedComposite); }
Example #2
Source File: X11PMBlitLoops.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) { SunToolkit.awtLock(); try { X11SurfaceData x11sd = (X11SurfaceData)dst; // pass null clip region here since we clip manually in native code // also use false for needExposures since we clip to the pixmap long xgc = x11sd.getBlitGC(null, false); nativeBlit(src.getNativeOps(), dst.getNativeOps(), xgc, clip, sx, sy, dx, dy, w, h); } finally { SunToolkit.awtUnlock(); } }
Example #3
Source File: MaskFill.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void MaskFill(SunGraphics2D sg2d, SurfaceData sData, Composite comp, int x, int y, int w, int h, byte mask[], int offset, int scan) { BufferedImage dstBI = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); SurfaceData tmpData = BufImgSurfaceData.createData(dstBI); // REMIND: This is not pretty. It would be nicer if we // passed a "FillData" object to the Pixel loops, instead // of a SunGraphics2D parameter... Region clip = sg2d.clipRegion; sg2d.clipRegion = null; int pixel = sg2d.pixel; sg2d.pixel = tmpData.pixelFor(sg2d.getColor()); fillop.FillRect(sg2d, tmpData, 0, 0, w, h); sg2d.pixel = pixel; sg2d.clipRegion = clip; maskop.MaskBlit(tmpData, sData, comp, null, 0, 0, x, y, w, h, mask, offset, scan); }
Example #4
Source File: LedgerSymbol.java From libreveris with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void paint (Graphics2D g, Params params, Point location, Alignment alignment) { Point loc = alignment.translatedPoint( AREA_CENTER, params.rect, location); if (decorated) { // Draw a note head (using composite) Composite oldComposite = g.getComposite(); g.setComposite(decoComposite); MusicFont.paint(g, params.layout, loc, AREA_CENTER); g.setComposite(oldComposite); } // Ledger g.drawLine( loc.x - (params.rect.width / 2), loc.y, loc.x + (params.rect.width / 2), loc.y); }
Example #5
Source File: PeekMetrics.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Record information about drawing done * with the supplied <code>Composite</code>. */ private void checkAlpha(Composite composite) { if (composite instanceof AlphaComposite) { AlphaComposite alphaComposite = (AlphaComposite) composite; float alpha = alphaComposite.getAlpha(); int rule = alphaComposite.getRule(); if (alpha != 1.0 || (rule != AlphaComposite.SRC && rule != AlphaComposite.SRC_OVER)) { mHasCompositing = true; } } else { mHasCompositing = true; } }
Example #6
Source File: XRMaskBlit.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void MaskBlit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int srcx, int srcy, int dstx, int dsty, int width, int height, byte[] mask, int maskoff, int maskscan) { if (width <= 0 || height <= 0) { return; } try { SunToolkit.awtLock(); XRSurfaceData x11sd = (XRSurfaceData) src; x11sd.validateAsSource(null, XRUtils.RepeatNone, XRUtils.FAST); XRCompositeManager maskBuffer = x11sd.maskBuffer; XRSurfaceData x11dst = (XRSurfaceData) dst; x11dst.validateAsDestination(null, clip); int maskPict = maskBuffer.getMaskBuffer(). uploadMask(width, height, maskscan, maskoff, mask); maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11dst.getPicture(), srcx, srcy, 0, 0, dstx, dsty, width, height); maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height); } finally { SunToolkit.awtUnlock(); } }
Example #7
Source File: GDIRenderer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
void doDrawLine(GDIWindowSurfaceData sData, Region clip, Composite comp, int color, int x1, int y1, int x2, int y2) { GraphicsPrimitive.tracePrimitive("GDIDrawLine"); super.doDrawLine(sData, clip, comp, color, x1, y1, x2, y2); }
Example #8
Source File: GDIRenderer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
void doFillRect(GDIWindowSurfaceData sData, Region clip, Composite comp, int color, int x, int y, int w, int h) { GraphicsPrimitive.tracePrimitive("GDIFillRect"); super.doFillRect(sData, clip, comp, color, x, y, w, h); }
Example #9
Source File: OGLBlitLoops.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { OGLBlitLoops.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, typeval, false); }
Example #10
Source File: OGLMaskBlit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void validateContext(SurfaceData dstData, Composite comp, Region clip) { OGLSurfaceData oglDst = (OGLSurfaceData)dstData; OGLContext.validateContext(oglDst, oglDst, clip, comp, null, null, null, OGLContext.NO_CONTEXT_FLAGS); }
Example #11
Source File: GDIRenderer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void doFillRoundRect(GDIWindowSurfaceData sData, Region clip, Composite comp, int color, int x, int y, int w, int h, int arcW, int arcH) { GraphicsPrimitive.tracePrimitive("GDIFillRoundRect"); super.doFillRoundRect(sData, clip, comp, color, x, y, w, h, arcW, arcH); }
Example #12
Source File: JCollapsiblePane.java From orbit-image-analysis with GNU General Public License v3.0 | 5 votes |
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; Composite oldComp = g2d.getComposite(); Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); g2d.setComposite(alphaComp); super.paint(g2d); g2d.setComposite(oldComp); }
Example #13
Source File: MaskFill.java From Bytecoder with Apache License 2.0 | 5 votes |
public void MaskFill(SunGraphics2D sg2d, SurfaceData sData, Composite comp, int x, int y, int w, int h, byte[] mask, int maskoff, int maskscan) { tracePrimitive(target); target.MaskFill(sg2d, sData, comp, x, y, w, h, mask, maskoff, maskscan); }
Example #14
Source File: OGLBlitLoops.java From Bytecoder with Apache License 2.0 | 5 votes |
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) { OGLBlitLoops.IsoBlit(src, dst, null, null, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, false); }
Example #15
Source File: D3DBlitLoops.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) { D3DBlitLoops.IsoBlit(src, dst, null, null, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, false); }
Example #16
Source File: SWTGraphics2D.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Sets the current composite. This implementation currently supports * only the {@link AlphaComposite} class. * * @param comp the composite (<code>null</code> not permitted). */ public void setComposite(Composite comp) { if (comp == null) { throw new IllegalArgumentException("Null 'comp' argument."); } this.composite = comp; if (comp instanceof AlphaComposite) { AlphaComposite acomp = (AlphaComposite) comp; int alpha = (int) (acomp.getAlpha() * 0xFF); this.gc.setAlpha(alpha); } }
Example #17
Source File: D3DBlitLoops.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { D3DBlitLoops.IsoBlit(src, dst, null, null, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, false); }
Example #18
Source File: OGLBlitLoops.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) { OGLBlitLoops.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, typeval, false); }
Example #19
Source File: D3DBlitLoops.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform at, int hint, int sx, int sy, int dx, int dy, int w, int h) { D3DBlitLoops.Blit(src, dst, comp, clip, at, hint, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, typeval, false); }
Example #20
Source File: D3DBlitLoops.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { D3DBlitLoops.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, typeval, false); }
Example #21
Source File: OGLBlitLoops.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { OGLBlitLoops.IsoBlit(src, dst, null, null, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, true); }
Example #22
Source File: MaskFill.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData, Composite comp, double x, double y, double dx1, double dy1, double dx2, double dy2, double lw1, double lw2) { tracePrimitive(drawPgramTarget); target.DrawAAPgram(sg2d, sData, comp, x, y, dx1, dy1, dx2, dy2, lw1, lw2); }
Example #23
Source File: BeamSymbol.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void paint (Graphics2D g, Params params, Point location, Alignment alignment) { MyParams p = (MyParams) params; Point loc = alignment.translatedPoint(TOP_RIGHT, p.rect, location); // Beams Rectangle2D quarterRect = p.layout.getBounds(); int beamHeight = (int) Math.rint(quarterRect.getHeight() * 0.12); int beamDelta = (int) Math.rint(quarterRect.getHeight() * 0.18); for (int i = 0; i < beamCount; i++) { Point left = new Point(loc.x - p.quarterDx, loc.y + (i * beamDelta) + p.quarterDy); Point right = new Point(loc.x, loc.y + (i * beamDelta)); Polygon polygon = new Polygon(); polygon.addPoint(left.x, left.y); polygon.addPoint(left.x, left.y + beamHeight); polygon.addPoint(right.x, right.y + beamHeight); polygon.addPoint(right.x, right.y); g.fill(polygon); } // Decorations (using composite) Composite oldComposite = g.getComposite(); g.setComposite(decoComposite); MusicFont.paint(g, p.layout, loc, TOP_RIGHT); loc.translate(-p.quarterDx, p.quarterDy); MusicFont.paint(g, p.layout, loc, TOP_RIGHT); g.setComposite(oldComposite); }
Example #24
Source File: OGLBlitLoops.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform at, int hint, int sx, int sy, int dx, int dy, int w, int h) { OGLBlitLoops.IsoBlit(src, dst, null, null, comp, clip, at, hint, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, true); }
Example #25
Source File: OGLBlitLoops.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) { OGLBlitLoops.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, typeval, false); }
Example #26
Source File: TransformHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void Transform(MaskBlit output, SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform itx, int txtype, int sx1, int sy1, int sx2, int sy2, int dx1, int dy1, int dx2, int dy2, int edges[], int dxoff, int dyoff) { tracePrimitive(target); target.Transform(output, src, dst, comp, clip, itx, txtype, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, edges, dxoff, dyoff); }
Example #27
Source File: ChurchLayerRenderer.java From dsworkbench with Apache License 2.0 | 5 votes |
void renderTempChurch(Graphics2D g2d, KnownVillage tmpVillage, Rectangle r) { Composite cb = g2d.getComposite(); Color cob = g2d.getColor(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .3f)); GeneralPath p = ChurchLayerRenderer.calculateChurchPath(tmpVillage, r.width, r.height); g2d.setColor(Constants.DS_BACK_LIGHT); g2d.fill(p); g2d.setComposite(cb); g2d.setColor(Constants.DS_BACK); g2d.draw(p); g2d.setColor(cob); }
Example #28
Source File: OGLBlitLoops.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { OGLBlitLoops.IsoBlit(src, dst, null, null, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, true); }
Example #29
Source File: D3DBlitLoops.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform at, int hint, int sx, int sy, int dx, int dy, int w, int h) { // see comment above D3DVolatileSurfaceManager.handleVItoScreenOp(src, dst); }
Example #30
Source File: D3DBlitLoops.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { D3DBlitLoops.IsoBlit(src, dst, null, null, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, false); }