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


Java SunGraphics2D.COMP_XOR属性代码示例

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


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

示例1: copyArea

@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    final int state = sg2d.transformState;
    if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
        || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
        x += sg2d.transX;
        y += sg2d.transY;
    } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
        final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
        sg2d.transform.transform(coords, 0, coords, 0, 3);
        x = (int) Math.ceil(coords[0] - 0.5);
        y = (int) Math.ceil(coords[1] - 0.5);
        w = ((int) Math.ceil(coords[2] - 0.5)) - x;
        h = ((int) Math.ceil(coords[3] - 0.5)) - y;
        dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
        dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:CGLSurfaceData.java

示例2: copyArea

public boolean copyArea(SunGraphics2D sg2d,
                        int x, int y, int w, int h, int dx, int dy)
{
    if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
        sg2d.compositeState < SunGraphics2D.COMP_XOR)
    {
        x += sg2d.transX;
        y += sg2d.transY;

        oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);

        return true;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:OGLSurfaceData.java

示例3: validateAsDestination

/**
 * Validates the Surface when used as destination.
 */
public void validateAsDestination(SunGraphics2D sg2d, Region clip) {
    if (!isValid()) {
        throw new InvalidPipeException("bounds changed");
    }

    boolean updateGCClip = false;
    if (clip != validatedClip) {
        renderQueue.setClipRectangles(picture, clip);
        validatedClip = clip;
        updateGCClip = true;
    }

    if (sg2d != null && sg2d.compositeState == SunGraphics2D.COMP_XOR) {
        if (validatedXorComp != sg2d.getComposite()) {
            validatedXorComp = (XORComposite) sg2d.getComposite();
            renderQueue.setGCMode(xgc, false);
        }

        // validate pixel
        int pixel = sg2d.pixel;
        if (validatedGCForegroundPixel != pixel) {
            int xorpixelmod = validatedXorComp.getXorPixel();
            renderQueue.setGCForeground(xgc, pixel ^ xorpixelmod);
            validatedGCForegroundPixel = pixel;
        }

        if (updateGCClip) {
            renderQueue.setGCClipRectangles(xgc, clip);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:XRSurfaceData.java

示例4: copyArea

@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    if (sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:OGLSurfaceData.java

示例5: copyArea

@Override
public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
                        int dx, int dy) {
    if (sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
        return false;
    }
    d3dRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:D3DSurfaceData.java

示例6: validatePipe

@Override
public void validatePipe(SunGraphics2D sg2d) {
    TextPipe textpipe;
    boolean validated = false;

    /*
     * The textpipe for now can't handle TexturePaint when extra-alpha is
     * specified nore XOR mode
     */
    if ((textpipe = getTextPipe(sg2d)) == null)
    {
        super.validatePipe(sg2d);
        textpipe = sg2d.textpipe;
        validated = true;
    }

    PixelToShapeConverter txPipe = null;
    XRRenderer nonTxPipe = null;

    /*
     * TODO: Can we rely on the GC for ARGB32 surfaces?
     */
    if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
            if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
        } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
            if (XRPaints.isValid(sg2d)) {
                txPipe = xrtxpipe;
                nonTxPipe = xrpipe;
            }
            // custom paints handled by super.validatePipe() below
        }
    }

    if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON &&
        JulesPathBuf.isCairoAvailable())
    {
        sg2d.shapepipe = aaShapePipe;
        sg2d.drawpipe = aaPixelToShapeConv;
        sg2d.fillpipe = aaPixelToShapeConv;
    } else {
        if (txPipe != null) {
            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = txPipe;
            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
                sg2d.drawpipe = txPipe;
                sg2d.fillpipe = nonTxPipe;
            } else {
                sg2d.drawpipe = nonTxPipe;
                sg2d.fillpipe = nonTxPipe;
            }
            sg2d.shapepipe = nonTxPipe;
        } else {
            if (!validated) {
                super.validatePipe(sg2d);
            }
        }
    }

    // install the text pipe based on our earlier decision
    sg2d.textpipe = textpipe;

    // always override the image pipe with the specialized XRender pipe
    sg2d.imagepipe = xrDrawImage;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:69,代码来源:XRSurfaceData.java

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