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


Java Rasterizer.setUsage方法代码示例

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


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

示例1: getAATileGenerator

import sun.dc.pr.Rasterizer; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public AATileGenerator getAATileGenerator(double x, double y,
                                          double dx1, double dy1,
                                          double dx2, double dy2,
                                          double lw1, double lw2,
                                          Region clip,
                                          int bbox[])
{
    // REMIND: Deal with large coordinates!
    double ldx1, ldy1, ldx2, ldy2;
    boolean innerpgram = (lw1 > 0 && lw2 > 0);

    if (innerpgram) {
        ldx1 = dx1 * lw1;
        ldy1 = dy1 * lw1;
        ldx2 = dx2 * lw2;
        ldy2 = dy2 * lw2;
        x -= (ldx1 + ldx2) / 2.0;
        y -= (ldy1 + ldy2) / 2.0;
        dx1 += ldx1;
        dy1 += ldy1;
        dx2 += ldx2;
        dy2 += ldy2;
        if (lw1 > 1 && lw2 > 1) {
            // Inner parallelogram was entirely consumed by stroke...
            innerpgram = false;
        }
    } else {
        ldx1 = ldy1 = ldx2 = ldy2 = 0;
    }

    Rasterizer r = getRasterizer();

    r.setUsage(Rasterizer.EOFILL);

    r.beginPath();
    r.beginSubpath((float) x, (float) y);
    r.appendLine((float) (x+dx1), (float) (y+dy1));
    r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
    r.appendLine((float) (x+dx2), (float) (y+dy2));
    r.closedSubpath();
    if (innerpgram) {
        x += ldx1 + ldx2;
        y += ldy1 + ldy2;
        dx1 -= 2.0 * ldx1;
        dy1 -= 2.0 * ldy1;
        dx2 -= 2.0 * ldx2;
        dy2 -= 2.0 * ldy2;
        r.beginSubpath((float) x, (float) y);
        r.appendLine((float) (x+dx1), (float) (y+dy1));
        r.appendLine((float) (x+dx1+dx2), (float) (y+dy1+dy2));
        r.appendLine((float) (x+dx2), (float) (y+dy2));
        r.closedSubpath();
    }

    try {
        r.endPath();
        r.getAlphaBox(bbox);
        clip.clipBoxToBounds(bbox);
        if (bbox[0] >= bbox[2] || bbox[1] >= bbox[3]) {
            dropRasterizer(r);
            return null;
        }
        r.setOutputArea(bbox[0], bbox[1],
                        bbox[2] - bbox[0],
                        bbox[3] - bbox[1]);
    } catch (PRException e) {
        /*
         * This exeption is thrown from the native part of the Ductus
         * (only in case of a debug build) to indicate that some
         * segments of the path have very large coordinates.
         * See 4485298 for more info.
         */
        System.err.println("DuctusRenderingEngine.getAATileGenerator: "+e);
    }

    return r;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:82,代码来源:DuctusRenderingEngine.java


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