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


Java GlyphList.getMetrics方法代码示例

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


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

示例1: DrawGlyphList

import sun.font.GlyphList; //导入方法依赖的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

示例2: DrawGlyphListAA

import sun.font.GlyphList; //导入方法依赖的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

示例3: DrawGlyphList

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

    Region clip = sg2d.getCompClip();
    int cx1 = clip.getLoX();
    int cy1 = clip.getLoY();
    int cx2 = clip.getHiX();
    int cy2 = clip.getHiY();
    for (int i = fromGlyph; i < toGlyph; 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:JetBrains,项目名称:jdk8u_jdk,代码行数:36,代码来源:DrawGlyphList.java

示例4: DrawGlyphListAA

import sun.font.GlyphList; //导入方法依赖的package包/类
public void DrawGlyphListAA(SunGraphics2D sg2d, SurfaceData dest,
                            GlyphList gl, int fromGlyph, int toGlyph)
{
    Region clip = sg2d.getCompClip();
    int cx1 = clip.getLoX();
    int cy1 = clip.getLoY();
    int cx2 = clip.getHiX();
    int cy2 = clip.getHiY();
    for (int i = fromGlyph; i < toGlyph; 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:JetBrains,项目名称:jdk8u_jdk,代码行数:36,代码来源:DrawGlyphListAA.java

示例5: DrawGlyphListColor

import sun.font.GlyphList; //导入方法依赖的package包/类
public void DrawGlyphListColor(SunGraphics2D sg2d, SurfaceData dest,
                          GlyphList gl, int fromGlyph, int toGlyph) {

    Region clip = sg2d.getCompClip();
    int cx1 = clip.getLoX();
    int cy1 = clip.getLoY();
    int cx2 = clip.getHiX();
    int cy2 = clip.getHiY();
    for (int i = fromGlyph; i < toGlyph; i++) {
        gl.setGlyphIndex(i);
        int metrics[] = gl.getMetrics();
        int x = metrics[0];
        int y = metrics[1];
        int w = metrics[2];
        int h = metrics[3];
        int gx1 = x;
        int gy1 = y;
        int gx2 = x + w;
        int gy2 = y + h;
        if (gx1 < cx1) gx1 = cx1;
        if (gy1 < cy1) gy1 = cy1;
        if (gx2 > cx2) gx2 = cx2;
        if (gy2 > cy2) gy2 = cy2;
        if (gx2 > gx1 && gy2 > gy1) {
            blit.Blit(gl.getColorGlyphData(), dest, AlphaComposite.SrcOver, clip,
                    gx1 - x, gy1 - y, gx1, gy1, gx2 - gx1, gy2 - gy1);
        }
    }
}
 
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:30,代码来源:DrawGlyphListColor.java

示例6: doDrawGlyphList

import sun.font.GlyphList; //导入方法依赖的package包/类
static void doDrawGlyphList(SurfaceData sData, PixelWriter pw,
                            GlyphList gl, Region clip)
{
    int[] bounds = gl.getBounds();
    clip.clipBoxToBounds(bounds);
    int cx1 = bounds[0];
    int cy1 = bounds[1];
    int cx2 = bounds[2];
    int cy2 = bounds[3];

    WritableRaster dstRast =
        (WritableRaster) sData.getRaster(cx1, cy1, cx2 - cx1, cy2 - cy1);
    pw.setRaster(dstRast);

    int num = gl.getNumGlyphs();
    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();
            w -= (gx2 - gx1);
            for (int y = gy1; y < gy2; y++) {
                for (int x = gx1; x < gx2; x++) {
                    if (alpha[off++] < 0) {
                        pw.writePixel(x, y);
                    }
                }
                off += w;
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:GeneralRenderer.java

示例7: drawGlyphList

import sun.font.GlyphList; //导入方法依赖的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:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:TextRenderer.java

示例8: doDrawGlyphList

import sun.font.GlyphList; //导入方法依赖的package包/类
static void doDrawGlyphList(SurfaceData sData, PixelWriter pw,
                            GlyphList gl, int fromGlyph, int toGlyph, Region clip)
{
    int[] bounds = gl.getBounds();
    clip.clipBoxToBounds(bounds);
    int cx1 = bounds[0];
    int cy1 = bounds[1];
    int cx2 = bounds[2];
    int cy2 = bounds[3];

    WritableRaster dstRast =
        (WritableRaster) sData.getRaster(cx1, cy1, cx2 - cx1, cy2 - cy1);
    pw.setRaster(dstRast);

    gl.startGlyphIteration();
    for (int i = fromGlyph; i < toGlyph; 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();
            w -= (gx2 - gx1);
            for (int y = gy1; y < gy2; y++) {
                for (int x = gx1; x < gx2; x++) {
                    if (alpha[off++] < 0) {
                        pw.writePixel(x, y);
                    }
                }
                off += w;
            }
        }
    }
}
 
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:49,代码来源:GeneralRenderer.java

示例9: drawGlyphList

import sun.font.GlyphList; //导入方法依赖的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);
        gl.startGlyphIteration();
        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 && !gl.isColorGlyph(i) &&
                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:JetBrains,项目名称:jdk8u_jdk,代码行数:52,代码来源:TextRenderer.java


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