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


Java SunGraphics2D.getCompClip方法代码示例

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


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

示例1: drawLine

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
    Region compClip = sg2d.getCompClip();
    int transX1 = Region.clipAdd(x1, sg2d.transX);
    int transY1 = Region.clipAdd(y1, sg2d.transY);
    int transX2 = Region.clipAdd(x2, sg2d.transX);
    int transY2 = Region.clipAdd(y2, sg2d.transY);

    SunToolkit.awtLock();
    try {
        validateSurface(sg2d);
        lineGen.rasterizeLine(rectBuffer, transX1, transY1,
                transX2, transY2, compClip.getLoX(), compClip.getLoY(),
                compClip.getHiX(), compClip.getHiY(), true, true);
        tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:XRRenderer.java

示例2: fillParallelogram

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void fillParallelogram(SunGraphics2D sg,
                              double ux1, double uy1,
                              double ux2, double uy2,
                              double x, double y,
                              double dx1, double dy1,
                              double dx2, double dy2)
{
    Region clip = sg.getCompClip();
    int abox[] = new int[4];
    AATileGenerator aatg =
        renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
                                        clip, abox);
    if (aatg == null) {
        // Nothing to render
        return;
    }

    renderTiles(sg, computeBBox(ux1, uy1, ux2, uy2), aatg, abox);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:AAShapePipe.java

示例3: fill

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void fill(SunGraphics2D sg, Shape s) {
    if (s instanceof Rectangle2D &&
        (sg.transform.getType() & NON_RECTILINEAR_TRANSFORM_MASK) == 0)
    {
        renderRect(sg, (Rectangle2D) s);
        return;
    }

    Region clipRegion = sg.getCompClip();
    ShapeSpanIterator sr = LoopPipe.getFillSSI(sg);
    try {
        sr.setOutputArea(clipRegion);
        sr.appendPath(s.getPathIterator(sg.transform));
        renderSpans(sg, clipRegion, s, sr);
    } finally {
        sr.dispose();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:SpanShapeRenderer.java

示例4: doFillSpans

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void doFillSpans(SunGraphics2D sg2d, SpanIterator si) {
    int box[] = new int[4];
    GDIWindowSurfaceData sd;
    try {
        sd = (GDIWindowSurfaceData)sg2d.surfaceData;
    } catch (ClassCastException e) {
        throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
    }
    Region clip = sg2d.getCompClip();
    Composite comp = sg2d.composite;
    int eargb = sg2d.eargb;
    while (si.nextSpan(box)) {
        doFillRect(sd, clip, comp, eargb,
                   box[0], box[1], box[2]-box[0], box[3]-box[1]);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:GDIRenderer.java

示例5: DrawPolygons

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:GeneralRenderer.java

示例6: drawParallelogram

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void drawParallelogram(SunGraphics2D sg,
                              double ux1, double uy1,
                              double ux2, double uy2,
                              double x, double y,
                              double dx1, double dy1,
                              double dx2, double dy2,
                              double lw1, double lw2)
{
    Region clip = sg.getCompClip();
    int abox[] = new int[4];
    AATileGenerator aatg =
        renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1, lw2,
                                        clip, abox);
    if (aatg == null) {
        // Nothing to render
        return;
    }

    // Note that bbox is of the original shape, not the wide path.
    // This is appropriate for handing to Paint methods...
    renderTiles(sg, computeBBox(ux1, uy1, ux2, uy2), aatg, abox);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:AAShapePipe.java

示例7: DrawGlyphList

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void DrawGlyphList(SunGraphics2D sg2d, SurfaceData dest,
                          GlyphList gl) {

    int strbounds[] = gl.getBounds(); // Don't delete, bug 4895493
    int num = gl.getNumGlyphs();
    Region clip = sg2d.getCompClip();
    int cx1 = clip.getLoX();
    int cy1 = clip.getLoY();
    int cx2 = clip.getHiX();
    int cy2 = clip.getHiY();
    for (int i = 0; i < num; 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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:DrawGlyphList.java

示例8: DrawGlyphListAA

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData dest,
                            GlyphList gl)
{
    gl.getBounds(); // Don't delete, bug 4895493
    int num = gl.getNumGlyphs();
    Region clip = sg2d.getCompClip();
    int cx1 = clip.getLoX();
    int cy1 = clip.getLoY();
    int cx2 = clip.getHiX();
    int cy2 = clip.getHiY();
    for (int i = 0; i < num; 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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:DrawGlyphListAA.java

示例9: drawGlyphList

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
    SunToolkit.awtLock();
    try {
        X11SurfaceData x11sd = (X11SurfaceData)sg2d.surfaceData;
        Region clip = sg2d.getCompClip();
        long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY,
                                     null, sg2d.pixel);
        doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
    } finally {
        SunToolkit.awtUnlock();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:X11TextRenderer.java

示例10: validate

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
/**
 * This method needs to be called prior to each draw/fillPath()
 * operation to ensure the clip bounds are up to date.
 */
void validate(SunGraphics2D sg2d) {
    Region clip = sg2d.getCompClip();
    setBounds(clip.getLoX(), clip.getLoY(),
              clip.getHiX(), clip.getHiY(),
              sg2d.strokeHint);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:BufferedRenderPipe.java

示例11: validate

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
/**
 * This method needs to be called prior to each draw/fillPath()
 * operation to ensure the clip bounds are up to date.
 */
void validate(SunGraphics2D sg2d) {
    Region clip = sg2d.getCompClip();
    setBounds(clip.getLoX(), clip.getLoY(),
              clip.getHiX(), clip.getHiY(), sg2d.strokeHint);
    validateSurface(sg2d);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:XRRenderer.java

示例12: getOGLScissorBox

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:50,代码来源:OGLUtilities.java

示例13: fill

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
public void fill(SunGraphics2D sg2d, Shape s) {
    int transx, transy;

    if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
        // Here we are able to use fillPath() for
        // high-quality fills.
        Path2D.Float p2df;
        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
            if (s instanceof Path2D.Float) {
                p2df = (Path2D.Float) s;
            } else {
                p2df = new Path2D.Float(s);
            }
            transx = sg2d.transX;
            transy = sg2d.transY;
        } else {
            p2df = new Path2D.Float(s, sg2d.transform);
            transx = 0;
            transy = 0;
        }
        fillPath(sg2d, p2df, transx, transy);
        return;
    }

    AffineTransform at;
    if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
        // Transform (translation) will be done by FillSpans
        at = null;
        transx = sg2d.transX;
        transy = sg2d.transY;
    } else {
        // Transform will be done by the PathIterator
        at = sg2d.transform;
        transx = transy = 0;
    }

    ShapeSpanIterator ssi = LoopPipe.getFillSSI(sg2d);
    try {
        // Subtract transx/y from the SSI clip to match the
        // (potentially untranslated) geometry fed to it
        Region clip = sg2d.getCompClip();
        ssi.setOutputAreaXYXY(clip.getLoX() - transx,
                              clip.getLoY() - transy,
                              clip.getHiX() - transx,
                              clip.getHiY() - transy);
        ssi.appendPath(s.getPathIterator(at));
        fillSpans(sg2d, ssi, transx, transy);
    } finally {
        ssi.dispose();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:52,代码来源:XRRenderer.java

示例14: drawGlyphList

import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
    int num = gl.getNumGlyphs();
    Region clipRegion = sg2d.getCompClip();
    int cx1 = clipRegion.getLoX();
    int cy1 = clipRegion.getLoY();
    int cx2 = clipRegion.getHiX();
    int cy2 = clipRegion.getHiY();
    Object ctx = null;
    try {
        int[] bounds = gl.getBounds();
        Rectangle r = new Rectangle(bounds[0], bounds[1],
                                    bounds[2] - bounds[0],
                                    bounds[3] - bounds[1]);
        Shape s = sg2d.untransformShape(r);
        ctx = outpipe.startSequence(sg2d, s, r, bounds);
        for (int i = 0; i < num; 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 &&
                outpipe.needTile(ctx, gx1, gy1, gx2 - gx1, gy2 - gy1))
            {
                byte alpha[] = gl.getGrayBits();
                outpipe.renderPathTile(ctx, alpha, off, w,
                                       gx1, gy1, gx2 - gx1, gy2 - gy1);
            } else {
                outpipe.skipTile(ctx, gx1, gy1);
            }
        }
    } finally {
        if (ctx != null) {
            outpipe.endSequence(ctx);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:51,代码来源:TextRenderer.java


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