sun.java2d.SurfaceData Java Examples
The following examples show how to use
sun.java2d.SurfaceData.
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 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 #2
Source File: TransformHelper.java From jdk8u_jdk with GNU General Public License v2.0 | 6 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) { if ((traceflags & TRACEPTIME) == 0) { tracePrimitive(target); } long time = System.nanoTime(); target.Transform(output, src, dst, comp, clip, itx, txtype, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, edges, dxoff, dyoff); tracePrimitiveTime(target, System.nanoTime() - time); }
Example #3
Source File: D3DBlitLoops.java From jdk8u60 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 #4
Source File: GeneralRenderer.java From openjdk-jdk8u 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 #5
Source File: BufImgSurfaceData.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static SurfaceData createDataBC(BufferedImage bImg, SurfaceType sType, int primaryBank, double scaleX, double scaleY) { ByteComponentRaster bcRaster = (ByteComponentRaster)bImg.getRaster(); BufImgSurfaceData bisd = new BufImgSurfaceData(bcRaster.getDataBuffer(), bImg, sType, scaleX, scaleY); ColorModel cm = bImg.getColorModel(); IndexColorModel icm = ((cm instanceof IndexColorModel) ? (IndexColorModel) cm : null); bisd.initRaster(bcRaster.getDataStorage(), bcRaster.getDataOffset(primaryBank), 0, bcRaster.getWidth(), bcRaster.getHeight(), bcRaster.getPixelStride(), bcRaster.getScanlineStride(), icm); return bisd; }
Example #6
Source File: VolatileSurfaceManager.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Creates a software-based surface (of type BufImgSurfaceData). * The software representation is only created when needed, which * is only during some situation in which the hardware surface * cannot be allocated. This allows apps to at least run, * albeit more slowly than they would otherwise. */ protected SurfaceData getBackupSurface() { if (sdBackup == null) { GraphicsConfiguration gc = vImg.getGraphicsConfig(); AffineTransform tx = gc.getDefaultTransform(); double scaleX = tx.getScaleX(); double scaleY = tx.getScaleY(); BufferedImage bImg = vImg.getBackupImage(scaleX, scaleY); // Sabotage the acceleration capabilities of the BufImg surface SunWritableRaster.stealTrackable(bImg .getRaster() .getDataBuffer()).setUntrackable(); sdBackup = BufImgSurfaceData.createData(bImg, scaleX, scaleY); } return sdBackup; }
Example #7
Source File: LoopPipe.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) { // REMIND: Eventually, the plan is that it will not be possible for // fs to be null since the FillSpans loop will be the fundamental // loop implemented for any destination type... if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { si = sg2d.clipRegion.filter(si); // REMIND: Region.filter produces a Java-only iterator // with no native counterpart... } else { sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop; if (fs != null) { fs.FillSpans(sg2d, sg2d.getSurfaceData(), si); return; } } int spanbox[] = new int[4]; SurfaceData sd = sg2d.getSurfaceData(); while (si.nextSpan(spanbox)) { int x = spanbox[0]; int y = spanbox[1]; int w = spanbox[2] - x; int h = spanbox[3] - y; sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h); } }
Example #8
Source File: GeneralRenderer.java From jdk8u-dev-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.createSolidPixelWriter(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 #9
Source File: LoopPipe.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void fillSpans(SunGraphics2D sg2d, SpanIterator si) { // REMIND: Eventually, the plan is that it will not be possible for // fs to be null since the FillSpans loop will be the fundamental // loop implemented for any destination type... if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { si = sg2d.clipRegion.filter(si); // REMIND: Region.filter produces a Java-only iterator // with no native counterpart... } else { sun.java2d.loops.FillSpans fs = sg2d.loops.fillSpansLoop; if (fs != null) { fs.FillSpans(sg2d, sg2d.getSurfaceData(), si); return; } } int spanbox[] = new int[4]; SurfaceData sd = sg2d.getSurfaceData(); while (si.nextSpan(spanbox)) { int x = spanbox[0]; int y = spanbox[1]; int w = spanbox[2] - x; int h = spanbox[3] - y; sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h); } }
Example #10
Source File: BufImgSurfaceData.java From hottub with GNU General Public License v2.0 | 6 votes |
public static SurfaceData createDataBC(BufferedImage bImg, SurfaceType sType, int primaryBank) { ByteComponentRaster bcRaster = (ByteComponentRaster)bImg.getRaster(); BufImgSurfaceData bisd = new BufImgSurfaceData(bcRaster.getDataBuffer(), bImg, sType); ColorModel cm = bImg.getColorModel(); IndexColorModel icm = ((cm instanceof IndexColorModel) ? (IndexColorModel) cm : null); bisd.initRaster(bcRaster.getDataStorage(), bcRaster.getDataOffset(primaryBank), 0, bcRaster.getWidth(), bcRaster.getHeight(), bcRaster.getPixelStride(), bcRaster.getScanlineStride(), icm); return bisd; }
Example #11
Source File: GeneralRenderer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); ProcessPath.fillPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy); }
Example #12
Source File: Blit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void Blit(SurfaceData srcData, SurfaceData dstData, Composite comp, Region clip, int srcx, int srcy, int dstx, int dsty, int width, int height) { ColorModel srcCM = srcData.getColorModel(); ColorModel dstCM = dstData.getColorModel(); // REMIND: Should get RenderingHints from sg2d CompositeContext ctx = comp.createContext(srcCM, dstCM, new RenderingHints(null)); Raster srcRas = srcData.getRaster(srcx, srcy, width, height); WritableRaster dstRas = (WritableRaster) dstData.getRaster(dstx, dsty, width, height); if (clip == null) { clip = Region.getInstanceXYWH(dstx, dsty, width, height); } int span[] = {dstx, dsty, dstx+width, dsty+height}; SpanIterator si = clip.getSpanIterator(span); srcx -= dstx; srcy -= dsty; while (si.nextSpan(span)) { int w = span[2] - span[0]; int h = span[3] - span[1]; Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1], w, h, 0, 0, null); WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1], w, h, 0, 0, null); ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas); } ctx.dispose(); }
Example #13
Source File: GeneralRenderer.java From Bytecoder with Apache License 2.0 | 5 votes |
public void DrawLine(SunGraphics2D sg2d, SurfaceData sData, int x1, int y1, int x2, int y2) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); if (y1 >= y2) { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x2, y2, x1, y1); } else { GeneralRenderer.doDrawLine(sData, pw, null, sg2d.getCompClip(), x1, y1, x2, y2); } }
Example #14
Source File: WComponentPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void disposeImpl() { SurfaceData oldData = surfaceData; surfaceData = null; ScreenUpdateManager.getInstance().dropScreenSurface(oldData); oldData.invalidate(); // remove from updater before calling targetDisposedPeer WToolkit.targetDisposedPeer(target, this); _dispose(); }
Example #15
Source File: D3DBlitLoops.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) { D3DBlitLoops.Blit(src, dst, comp, clip, null, AffineTransformOp.TYPE_NEAREST_NEIGHBOR, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, typeval, false); }
Example #16
Source File: GeneralRenderer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void FillSpans(SunGraphics2D sg2d, SurfaceData sData, SpanIterator si) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); int span[] = new int[4]; while (si.nextSpan(span)) { GeneralRenderer.doSetRect(sData, pw, span[0], span[1], span[2], span[3]); } }
Example #17
Source File: CustomComponent.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static Region getRegionOfInterest(SurfaceData src, SurfaceData dst, Region clip, int srcx, int srcy, int dstx, int dsty, int w, int h) { /* * Intersect all of: * - operation area (dstx, dsty, w, h) * - destination bounds * - (translated) src bounds * - supplied clip (may be non-rectangular) * Intersect the rectangular regions first since those are * simpler operations. */ Region ret = Region.getInstanceXYWH(dstx, dsty, w, h); ret = ret.getIntersection(dst.getBounds()); Rectangle r = src.getBounds(); // srcxy in src space maps to dstxy in dst space r.translate(dstx - srcx, dsty - srcy); ret = ret.getIntersection(r); if (clip != null) { // Intersect with clip last since it may be non-rectangular ret = ret.getIntersection(clip); } return ret; }
Example #18
Source File: MaskFill.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData, Composite comp, double x, double y, double dx1, double dy1, double dx2, double dy2) { tracePrimitive(fillPgramTarget); target.FillAAPgram(sg2d, sData, comp, x, y, dx1, dy1, dx2, dy2); }
Example #19
Source File: GeneralRenderer.java From Bytecoder with Apache License 2.0 | 5 votes |
public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); ProcessPath.fillPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy); }
Example #20
Source File: DrawGlyphList.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void DrawGlyphList(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 gx1 = metrics[0]; int gy1 = metrics[1]; int w = metrics[2]; int gx2 = gx1 + w; int gy2 = gy1 + metrics[3]; int off = 0; if (gx1 < cx1) { off = cx1 - gx1; gx1 = cx1; } if (gy1 < cy1) { off += (cy1 - gy1) * w; gy1 = cy1; } if (gx2 > cx2) gx2 = cx2; if (gy2 > cy2) gy2 = cy2; if (gx2 > gx1 && gy2 > gy1) { byte alpha[] = gl.getGrayBits(); maskop.MaskFill(sg2d, dest, sg2d.composite, gx1, gy1, gx2 - gx1, gy2 - gy1, alpha, off, w); } } }
Example #21
Source File: D3DBlitLoops.java From jdk8u-dev-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, true); }
Example #22
Source File: WGLGraphicsConfig.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Creates a new SurfaceData that will be associated with the given * WComponentPeer. */ @Override public SurfaceData createSurfaceData(WComponentPeer peer, int numBackBuffers) { SurfaceData sd = WGLSurfaceData.createData(peer); if (sd == null) { sd = GDIWindowSurfaceData.createData(peer); } return sd; }
Example #23
Source File: D3DBlitLoops.java From openjdk-jdk9 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 #24
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 #25
Source File: D3DScreenUpdateManager.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Adds a surface to the list of tracked surfaces. * * @param d3dw the surface to be added */ private void trackScreenSurface(SurfaceData sd) { if (!done && sd instanceof D3DWindowSurfaceData) { synchronized (this) { if (d3dwSurfaces == null) { d3dwSurfaces = new ArrayList<D3DWindowSurfaceData>(); } D3DWindowSurfaceData d3dw = (D3DWindowSurfaceData)sd; if (!d3dwSurfaces.contains(d3dw)) { d3dwSurfaces.add(d3dw); } } startUpdateThread(); } }
Example #26
Source File: D3DScreenUpdateManager.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Adds a surface to the list of tracked surfaces. * * @param d3dw the surface to be added */ private void trackScreenSurface(SurfaceData sd) { if (!done && sd instanceof D3DWindowSurfaceData) { synchronized (this) { if (d3dwSurfaces == null) { d3dwSurfaces = new ArrayList<D3DWindowSurfaceData>(); } D3DWindowSurfaceData d3dw = (D3DWindowSurfaceData)sd; if (!d3dwSurfaces.contains(d3dw)) { d3dwSurfaces.add(d3dw); } } startUpdateThread(); } }
Example #27
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.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: MaskFill.java From openjdk-jdk9 with GNU General Public License v2.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 #29
Source File: X11SurfaceDataProxy.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public boolean isSupportedOperation(SurfaceData srcData, int txtype, CompositeType comp, Color bgColor) { // These could probably be combined into a single // nested if, but the logic is easier to follow this way. // we don't have X11 scale loops, so always use // software surface in case of scaling if (txtype >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { return false; } if (bgColor != null && bgColor.getTransparency() != Transparency.OPAQUE) { return false; } // for transparent images SrcNoEa+bgColor has the // same effect as SrcOverNoEa+bgColor, so we allow // copying from pixmap SD using accelerated blitbg loops: // SrcOver will be changed to SrcNoEa in DrawImage.blitSD if (CompositeType.SrcOverNoEa.equals(comp) || (CompositeType.SrcNoEa.equals(comp) && bgColor != null)) { return true; } return false; }
Example #30
Source File: GeneralRenderer.java From hottub with GNU General Public License v2.0 | 5 votes |
public void FillSpans(SunGraphics2D sg2d, SurfaceData sData, SpanIterator si) { PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData); int span[] = new int[4]; while (si.nextSpan(span)) { GeneralRenderer.doSetRect(sData, pw, span[0], span[1], span[2], span[3]); } }