当前位置: 首页>>代码示例>>Java>>正文


Java SunGraphics2D.CLIP_SHAPE属性代码示例

本文整理汇总了Java中sun.java2d.SunGraphics2D.CLIP_SHAPE属性的典型用法代码示例。如果您正苦于以下问题:Java SunGraphics2D.CLIP_SHAPE属性的具体用法?Java SunGraphics2D.CLIP_SHAPE怎么用?Java SunGraphics2D.CLIP_SHAPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sun.java2d.SunGraphics2D的用法示例。


在下文中一共展示了SunGraphics2D.CLIP_SHAPE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillSpans

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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:LoopPipe.java

示例2: copyArea

public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    CompositeType comptype = sg2d.imageComp;
    if (sg2d.clipState != SunGraphics2D.CLIP_SHAPE &&
        (CompositeType.SrcOverNoEa.equals(comptype) ||
         CompositeType.SrcNoEa.equals(comptype)))
    {
        int dstx1 = x + dx;
        int dsty1 = y + dy;
        int dstx2 = dstx1 + w;
        int dsty2 = dsty1 + h;
        Region clip = sg2d.getCompClip();
        if (dstx1 < clip.getLoX()) dstx1 = clip.getLoX();
        if (dsty1 < clip.getLoY()) dsty1 = clip.getLoY();
        if (dstx2 > clip.getHiX()) dstx2 = clip.getHiX();
        if (dsty2 > clip.getHiY()) dsty2 = clip.getHiY();
        if (dstx1 < dstx2 && dsty1 < dsty2) {
            gdiPipe.devCopyArea(this, dstx1 - dx, dsty1 - dy,
                                dx, dy,
                                dstx2 - dstx1, dsty2 - dsty1);
        }
        return true;
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:GDIWindowSurfaceData.java

示例3: validatePipe

public void validatePipe(SunGraphics2D sg2d) {
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON &&
        sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
        (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY ||
         sg2d.compositeState == SunGraphics2D.COMP_XOR))
    {
        if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
            // Do this to init textpipe correctly; we will override the
            // other non-text pipes below
            // REMIND: we should clean this up eventually instead of
            // having this work duplicated.
            super.validatePipe(sg2d);
        } else {
            switch (sg2d.textAntialiasHint) {

            case SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT:
                /* equate DEFAULT to OFF which it is for us */
            case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
                sg2d.textpipe = solidTextRenderer;
                break;

            case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
                sg2d.textpipe = aaTextRenderer;
                break;

            default:
                switch (sg2d.getFontInfo().aaHint) {

                case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
                case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
                    sg2d.textpipe = lcdTextRenderer;
                    break;

                case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
                    sg2d.textpipe = aaTextRenderer;
                    break;

                default:
                    sg2d.textpipe = solidTextRenderer;
                }
            }
        }
        sg2d.imagepipe = imagepipe;
        if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
            sg2d.drawpipe = gdiTxPipe;
            sg2d.fillpipe = gdiTxPipe;
        } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN){
            sg2d.drawpipe = gdiTxPipe;
            sg2d.fillpipe = gdiPipe;
        } else {
            sg2d.drawpipe = gdiPipe;
            sg2d.fillpipe = gdiPipe;
        }
        sg2d.shapepipe = gdiPipe;
        // This is needed for AA text.
        // Note that even a SolidTextRenderer can dispatch AA text
        // if a GlyphVector overrides the AA setting.
        // We use getRenderLoops() rather than setting solidloops
        // directly so that we get the appropriate loops in XOR mode.
        if (sg2d.loops == null) {
            // assert(some pipe will always be a LoopBasedPipe)
            sg2d.loops = getRenderLoops(sg2d);
        }
    } else {
        super.validatePipe(sg2d);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:67,代码来源:GDIWindowSurfaceData.java


注:本文中的sun.java2d.SunGraphics2D.CLIP_SHAPE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。