sun.java2d.pipe.Region Java Examples
The following examples show how to use
sun.java2d.pipe.Region.
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: X11PMBlitBgLoops.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override public void BlitBg(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int bgColor, int sx, int sy, int dx, int dy, int w, int h) { SunToolkit.awtLock(); try { int pixel = dst.pixelFor(bgColor); X11SurfaceData x11sd = (X11SurfaceData)dst; // use false for needExposures since we clip to the pixmap long xgc = x11sd.getBlitGC(clip, false); nativeBlitBg(src.getNativeOps(), dst.getNativeOps(), xgc, pixel, sx, sy, dx, dy, w, h); } finally { SunToolkit.awtUnlock(); } }
Example #2
Source File: D3DBlitLoops.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override public synchronized void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform at, int hint, int srcx, int srcy, int dstx, int dsty, int width, int height){ Blit convertsrc = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, SurfaceType.IntArgbPre); // use cached intermediate surface, if available final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null; // convert source to IntArgbPre src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE); // transform IntArgbPre intermediate surface to D3D surface performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty, width, height); if (src != cachedSrc) { // cache the intermediate surface srcTmp = new WeakReference<>(src); } }
Example #3
Source File: GeneralRenderer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void DrawPolygons(SunGraphics2D sg2d, SurfaceData sData, int xPoints[], int yPoints[], int nPoints[], int numPolys, int transx, int transy, boolean close) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); int off = 0; Region clip = sg2d.getCompClip(); for (int i = 0; i < numPolys; i++) { int numpts = nPoints[i]; GeneralRenderer.doDrawPoly(sData, pw, xPoints, yPoints, off, numpts, clip, transx, transy, close); off += numpts; } }
Example #4
Source File: X11PMBlitBgLoops.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public void BlitBg(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int bgColor, int sx, int sy, int dx, int dy, int w, int h) { SunToolkit.awtLock(); try { int pixel = dst.pixelFor(bgColor); X11SurfaceData x11sd = (X11SurfaceData)dst; // use false for needExposures since we clip to the pixmap long xgc = x11sd.getBlitGC(clip, false); nativeBlitBg(src.getNativeOps(), dst.getNativeOps(), xgc, pixel, sx, sy, dx, dy, w, h); } finally { SunToolkit.awtUnlock(); } }
Example #5
Source File: D3DBlitLoops.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public synchronized void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform at, int hint, int srcx, int srcy, int dstx, int dsty, int width, int height){ Blit convertsrc = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, SurfaceType.IntArgbPre); // use cached intermediate surface, if available final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null; // convert source to IntArgbPre src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE); // transform IntArgbPre intermediate surface to D3D surface performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty, width, height); if (src != cachedSrc) { // cache the intermediate surface srcTmp = new WeakReference<>(src); } }
Example #6
Source File: Container.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override final Region getOpaqueShape() { checkTreeLock(); if (isLightweight() && isNonOpaqueForMixing() && hasLightweightDescendants()) { Region s = Region.EMPTY_REGION; for (int index = 0; index < getComponentCount(); index++) { Component c = getComponent(index); if (c.isLightweight() && c.isShowing()) { s = s.getUnion(c.getOpaqueShape()); } } return s.getIntersection(getNormalShape()); } return super.getOpaqueShape(); }
Example #7
Source File: GraphicsPrimitive.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected static void convertTo(Blit ob, SurfaceData srcImg, SurfaceData dstImg, Region clip, int dstX, int dstY, int w, int h) { if (ob != null) { ob.Blit(srcImg, dstImg, AlphaComposite.Src, clip, 0, 0, dstX, dstY, w, h); } }
Example #8
Source File: OGLBlitLoops.java From openjdk-jdk9 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 #9
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, true); }
Example #10
Source File: D3DBlitLoops.java From openjdk-8-source 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.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, typeval, true); }
Example #11
Source File: MaskBlit.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 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) { tracePrimitive(target); target.MaskBlit(src, dst, comp, clip, srcx, srcy, dstx, dsty, width, height, mask, maskoff, maskscan); }
Example #12
Source File: D3DMaskBlit.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void validateContext(SurfaceData dstData, Composite comp, Region clip) { D3DSurfaceData d3dDst = (D3DSurfaceData)dstData; D3DContext.validateContext(d3dDst, d3dDst, clip, comp, null, null, null, D3DContext.NO_CONTEXT_FLAGS); }
Example #13
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 #14
Source File: D3DMaskBlit.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override protected void validateContext(SurfaceData dstData, Composite comp, Region clip) { D3DSurfaceData d3dDst = (D3DSurfaceData)dstData; D3DContext.validateContext(d3dDst, d3dDst, clip, comp, null, null, null, D3DContext.NO_CONTEXT_FLAGS); }
Example #15
Source File: DrawGlyphListColor.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphListColor(SunGraphics2D sg2d, SurfaceData dest, GlyphList gl, int fromGlyph, int toGlyph) { Region clip = sg2d.getCompClip(); int cx1 = clip.getLoX(); int cy1 = clip.getLoY(); int cx2 = clip.getHiX(); int cy2 = clip.getHiY(); for (int i = fromGlyph; i < toGlyph; i++) { gl.setGlyphIndex(i); int metrics[] = gl.getMetrics(); int x = metrics[0]; int y = metrics[1]; int w = metrics[2]; int h = metrics[3]; int gx1 = x; int gy1 = y; int gx2 = x + w; int gy2 = y + h; if (gx1 < cx1) gx1 = cx1; if (gy1 < cy1) gy1 = cy1; if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { blit.Blit(gl.getColorGlyphData(), dest, AlphaComposite.SrcOver, clip, gx1 - x, gy1 - y, gx1, gy1, gx2 - gx1, gy2 - gy1); } } }
Example #16
Source File: OGLUtilities.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Returns the Rectangle describing the OpenGL scissor box on the * Java 2D surface associated with the given Graphics object. When a * third-party library is performing OpenGL rendering directly * into the visible region of the associated surface, this scissor box * must be set to avoid drawing over existing rendering results. * * Note that the x/y values in the returned Rectangle object represent * the lower-left corner of the scissor region, relative to the * lower-left corner of the given surface. * * @param g the Graphics object for the corresponding destination surface; * cannot be null * @return a Rectangle describing the OpenGL scissor box for the given * Graphics object and corresponding destination surface, or null if the * given Graphics object is invalid or the clip region is non-rectangular */ public static Rectangle getOGLScissorBox(Graphics g) { if (!(g instanceof SunGraphics2D)) { return null; } SunGraphics2D sg2d = (SunGraphics2D)g; SurfaceData sData = (SurfaceData)sg2d.surfaceData; Region r = sg2d.getCompClip(); if (!r.isRectangular()) { // caller probably doesn't know how to handle shape clip // appropriately, so just return null (Swing currently never // sets a shape clip, but that could change in the future) return null; } // this is the upper-left origin of the scissor box relative to the // upper-left origin of the surface (in Java 2D coordinates) int x0 = r.getLoX(); int y0 = r.getLoY(); // this is the width and height of the scissor region int w = r.getWidth(); int h = r.getHeight(); // this is the lower-left origin of the scissor box relative to the // lower-left origin of the surface (in OpenGL coordinates) Rectangle surfaceBounds = sData.getBounds(); int x1 = x0; int y1 = surfaceBounds.height - (y0 + h); return new Rectangle(x1, y1, w, h); }
Example #17
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 #18
Source File: LWComponentPeer.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public final void applyShape(final Region shape) { synchronized (getStateLock()) { if (region == shape || (region != null && region.equals(shape))) { return; } } applyShapeImpl(shape); }
Example #19
Source File: TransformHelper.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public native 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);
Example #20
Source File: LWComponentPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Finds a top-most visible component for the given point. The location is * specified relative to the peer's parent. */ LWComponentPeer<?, ?> findPeerAt(final int x, final int y) { final Rectangle r = getBounds(); final Region sh = getRegion(); final boolean found = isVisible() && sh.contains(x - r.x, y - r.y); return found ? this : null; }
Example #21
Source File: D3DBlitLoops.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) { D3DBlitLoops.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: D3DBlitLoops.java From jdk8u-jdk 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.IsoBlit(src, dst, null, null, comp, clip, at, hint, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, true); }
Example #23
Source File: OGLBlitLoops.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) { OGLBlitLoops.IsoBlit(src, dst, null, null, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, true); }
Example #24
Source File: D3DBlitLoops.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) { D3DBlitLoops.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, typeval, false); }
Example #25
Source File: OGLUtilities.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns the Rectangle describing the OpenGL scissor box on the * Java 2D surface associated with the given Graphics object. When a * third-party library is performing OpenGL rendering directly * into the visible region of the associated surface, this scissor box * must be set to avoid drawing over existing rendering results. * * Note that the x/y values in the returned Rectangle object represent * the lower-left corner of the scissor region, relative to the * lower-left corner of the given surface. * * @param g the Graphics object for the corresponding destination surface; * cannot be null * @return a Rectangle describing the OpenGL scissor box for the given * Graphics object and corresponding destination surface, or null if the * given Graphics object is invalid or the clip region is non-rectangular */ public static Rectangle getOGLScissorBox(Graphics g) { if (!(g instanceof SunGraphics2D)) { return null; } SunGraphics2D sg2d = (SunGraphics2D)g; SurfaceData sData = sg2d.surfaceData; Region r = sg2d.getCompClip(); if (!r.isRectangular()) { // caller probably doesn't know how to handle shape clip // appropriately, so just return null (Swing currently never // sets a shape clip, but that could change in the future) return null; } // this is the upper-left origin of the scissor box relative to the // upper-left origin of the surface (in Java 2D coordinates) int x0 = r.getLoX(); int y0 = r.getLoY(); // this is the width and height of the scissor region int w = r.getWidth(); int h = r.getHeight(); // this is the lower-left origin of the scissor box relative to the // lower-left origin of the surface (in OpenGL coordinates) Rectangle surfaceBounds = sData.getBounds(); int x1 = x0; int y1 = surfaceBounds.height - (y0 + h); return new Rectangle(x1, y1, w, h); }
Example #26
Source File: BlitBg.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public void BlitBg(SurfaceData srcData, SurfaceData dstData, Composite comp, Region clip, int bgArgb, int srcx, int srcy, int dstx, int dsty, int width, int height) { ColorModel dstModel = dstData.getColorModel(); boolean bgHasAlpha = (bgArgb >>> 24) != 0xff; if (!dstModel.hasAlpha() && bgHasAlpha) { dstModel = ColorModel.getRGBdefault(); } WritableRaster wr = dstModel.createCompatibleWritableRaster(width, height); boolean isPremult = dstModel.isAlphaPremultiplied(); BufferedImage bimg = new BufferedImage(dstModel, wr, isPremult, null); SurfaceData tmpData = BufImgSurfaceData.createData(bimg); Color bgColor = new Color(bgArgb, bgHasAlpha); SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor, defaultFont); FillRect fillop = FillRect.locate(SurfaceType.AnyColor, CompositeType.SrcNoEa, tmpData.getSurfaceType()); Blit combineop = Blit.getFromCache(srcData.getSurfaceType(), CompositeType.SrcOverNoEa, tmpData.getSurfaceType()); Blit blitop = Blit.getFromCache(tmpData.getSurfaceType(), compositeType, dstData.getSurfaceType()); fillop.FillRect(sg2d, tmpData, 0, 0, width, height); combineop.Blit(srcData, tmpData, AlphaComposite.SrcOver, null, srcx, srcy, 0, 0, width, height); blitop.Blit(tmpData, dstData, comp, clip, 0, 0, dstx, dsty, width, height); }
Example #27
Source File: D3DBlitLoops.java From openjdk-jdk8u 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, true); }
Example #28
Source File: OGLBlitLoops.java From openjdk-8-source 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.Blit(src, dst, comp, clip, at, hint, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, typeval, false); }
Example #29
Source File: LWComponentPeer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public final void applyShape(final Region shape) { synchronized (getStateLock()) { if (region == shape || (region != null && region.equals(shape))) { return; } } applyShapeImpl(shape); }
Example #30
Source File: D3DBlitLoops.java From TencentKona-8 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.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx, sy, sx+w, sy+h, dx, dy, dx+w, dy+h, typeval, true); }