java.awt.image.ShortLookupTable#sun.java2d.SurfaceData源码实例Demo

下面列出了java.awt.image.ShortLookupTable#sun.java2d.SurfaceData 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u-jdk   文件: LoopPipe.java
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);
    }
}
 
源代码2 项目: jdk8u-dev-jdk   文件: GeneralRenderer.java
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;
    }
}
 
源代码3 项目: jdk8u-jdk   文件: LoopPipe.java
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);
    }
}
 
源代码4 项目: jdk8u_jdk   文件: BufImgSurfaceData.java
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;
}
 
源代码5 项目: openjdk-jdk8u   文件: X11PMBlitBgLoops.java
@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();
    }
}
 
源代码6 项目: jdk8u60   文件: D3DBlitLoops.java
@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);
    }
}
 
源代码7 项目: openjdk-jdk8u   文件: GeneralRenderer.java
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;
    }
}
 
源代码8 项目: Bytecoder   文件: VolatileSurfaceManager.java
/**
 * 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;
}
 
源代码9 项目: hottub   文件: BufImgSurfaceData.java
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;
}
 
源代码10 项目: jdk8u_jdk   文件: TransformHelper.java
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);
}
 
源代码11 项目: openjdk-8   文件: GlyphListPipe.java
public void drawString(SunGraphics2D sg2d, String s,
                       double x, double y)
{
    FontInfo info = sg2d.getFontInfo();
    if (info.pixelHeight > OutlineTextRenderer.THRESHHOLD) {
        SurfaceData.outlineTextRenderer.drawString(sg2d, s, x, y);
        return;
    }

    float devx, devy;
    if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        double origin[] = {x + info.originX, y + info.originY};
        sg2d.transform.transform(origin, 0, origin, 0, 1);
        devx = (float)origin[0];
        devy = (float)origin[1];
    } else {
        devx = (float)(x + info.originX + sg2d.transX);
        devy = (float)(y + info.originY + sg2d.transY);
    }
    /* setFromString returns false if shaping is needed, and we then back
     * off to a TextLayout. Such text may benefit slightly from a lower
     * overhead in this approach over the approach in previous releases.
     */
    GlyphList gl = GlyphList.getInstance();
    if (gl.setFromString(info, s, devx, devy)) {
        drawGlyphList(sg2d, gl);
        gl.dispose();
    } else {
        gl.dispose(); // release this asap.
        TextLayout tl = new TextLayout(s, sg2d.getFont(),
                                       sg2d.getFontRenderContext());
        tl.draw(sg2d, (float)x, (float)y);
    }
}
 
源代码12 项目: Bytecoder   文件: OGLSurfaceDataProxy.java
@Override
public SurfaceData validateSurfaceData(SurfaceData srcData,
                                       SurfaceData cachedData,
                                       int w, int h)
{
    if (cachedData == null) {
        try {
            cachedData = oglgc.createManagedSurface(w, h, transparency);
        } catch (OutOfMemoryError er) {
            return null;
        }
    }
    return cachedData;
}
 
源代码13 项目: openjdk-8   文件: GeneralRenderer.java
public void FillRect(SunGraphics2D sg2d, SurfaceData sData,
                     int x, int y, int w, int h)
{
    PixelWriter pw = GeneralRenderer.createSolidPixelWriter(sg2d, sData);

    Region r = sg2d.getCompClip().getBoundsIntersectionXYWH(x, y, w, h);

    GeneralRenderer.doSetRect(sData, pw,
                              r.getLoX(), r.getLoY(),
                              r.getHiX(), r.getHiY());
}
 
源代码14 项目: openjdk-8   文件: CPlatformView.java
public SurfaceData replaceSurfaceData() {
    if (!LWCToolkit.getSunAwtDisableCALayers()) {
        surfaceData = windowLayer.replaceSurfaceData();
    } else {
        if (surfaceData == null) {
            CGraphicsConfig graphicsConfig = (CGraphicsConfig)getGraphicsConfiguration();
            surfaceData = graphicsConfig.createSurfaceData(this);
        } else {
            validateSurface();
        }
    }
    return surfaceData;
}
 
源代码15 项目: jdk8u60   文件: MaskBlit.java
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);
}
 
源代码16 项目: jdk8u-dev-jdk   文件: GeneralRenderer.java
static PixelWriter createSolidPixelWriter(SunGraphics2D sg2d,
                                          SurfaceData sData)
{
    ColorModel dstCM = sData.getColorModel();
    Object srcPixel = dstCM.getDataElements(sg2d.eargb, null);

    return new SolidPixelWriter(srcPixel);
}
 
源代码17 项目: openjdk-8-source   文件: WGLGraphicsConfig.java
/**
 * 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;
}
 
源代码18 项目: openjdk-jdk9   文件: GeneralRenderer.java
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]);
    }
}
 
源代码19 项目: TencentKona-8   文件: MaskFill.java
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);
}
 
源代码20 项目: jdk8u-dev-jdk   文件: D3DBlitLoops.java
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);
}
 
源代码21 项目: jdk8u-dev-jdk   文件: OGLMaskBlit.java
@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);
}
 
源代码22 项目: jdk8u60   文件: D3DScreenUpdateManager.java
/**
 * 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();
    }
}
 
源代码23 项目: dragonwell8_jdk   文件: D3DScreenUpdateManager.java
/**
 * 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();
    }
}
 
源代码24 项目: TencentKona-8   文件: D3DBlitLoops.java
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);
}
 
源代码25 项目: openjdk-jdk9   文件: MaskFill.java
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);
}
 
源代码26 项目: hottub   文件: X11SurfaceDataProxy.java
@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;
}
 
源代码27 项目: jdk8u_jdk   文件: WComponentPeer.java
@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();
}
 
源代码28 项目: hottub   文件: D3DBlitLoops.java
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);
}
 
源代码29 项目: Bytecoder   文件: GeneralRenderer.java
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);
    }
}
 
源代码30 项目: openjdk-8   文件: X11SurfaceDataProxy.java
@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;
}