Java 类com.badlogic.gdx.tools.hiero.unicodefont.Glyph 实例源码

项目:libgdxcn    文件:DistanceFieldEffect.java   
@Override
public void draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    BufferedImage input = new BufferedImage(
        scale * glyph.getWidth(),
        scale * glyph.getHeight(),
        BufferedImage.TYPE_BYTE_BINARY);
    drawGlyph(input, glyph);

    DistanceFieldGenerator generator = new DistanceFieldGenerator();
    generator.setColor(color);
    generator.setDownscale(scale);
    // We multiply spread by the scale, so that changing scale will only affect accuracy
    // and not spread in the output image.
    generator.setSpread(scale * spread);
    BufferedImage distanceField = generator.generateDistanceField(input);

    g.drawImage(distanceField, new AffineTransform(), null);
}
项目:libgdxcn    文件:ShadowEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g = (Graphics2D)g.create();
    g.translate(xDistance, yDistance);
    g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), Math.round(opacity * 255)));
    g.fill(glyph.getShape());

    // Also shadow the outline, if one exists.
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();) {
        Effect effect = (Effect)iter.next();
        if (effect instanceof OutlineEffect) {
            Composite composite = g.getComposite();
            g.setComposite(AlphaComposite.Src); // Prevent shadow and outline shadow alpha from combining.

            g.setStroke(((OutlineEffect)effect).getStroke());
            g.draw(glyph.getShape());

            g.setComposite(composite);
            break;
        }
    }

    g.dispose();
    if (blurKernelSize > 1 && blurKernelSize < NUM_KERNELS && blurPasses > 0) blur(image);
}
项目:GdxStudio    文件:DistanceFieldEffect.java   
@Override
public void draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    BufferedImage input = new BufferedImage(
        scale * glyph.getWidth(),
        scale * glyph.getHeight(),
        BufferedImage.TYPE_BYTE_BINARY);
    drawGlyph(input, glyph);

    DistanceFieldGenerator generator = new DistanceFieldGenerator();
    generator.setColor(color);
    generator.setDownscale(scale);
    // We multiply spread by the scale, so that changing scale will only affect accuracy
    // and not spread in the output image.
    generator.setSpread(scale * spread);
    BufferedImage distanceField = generator.generateDistanceField(input);

    g.drawImage(distanceField, new AffineTransform(), null);
}
项目:GdxStudio    文件:ShadowEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g = (Graphics2D)g.create();
    g.translate(xDistance, yDistance);
    g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), Math.round(opacity * 255)));
    g.fill(glyph.getShape());

    // Also shadow the outline, if one exists.
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();) {
        Effect effect = (Effect)iter.next();
        if (effect instanceof OutlineEffect) {
            Composite composite = g.getComposite();
            g.setComposite(AlphaComposite.Src); // Prevent shadow and outline shadow alpha from combining.

            g.setStroke(((OutlineEffect)effect).getStroke());
            g.draw(glyph.getShape());

            g.setComposite(composite);
            break;
        }
    }

    g.dispose();
    if (blurKernelSize > 1 && blurKernelSize < NUM_KERNELS && blurPasses > 0) blur(image);
}
项目:touhou-java    文件:DistanceFieldEffect.java   
@Override
public void draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    BufferedImage input = new BufferedImage(
        scale * glyph.getWidth(),
        scale * glyph.getHeight(),
        BufferedImage.TYPE_BYTE_BINARY);
    drawGlyph(input, glyph);

    DistanceFieldGenerator generator = new DistanceFieldGenerator();
    generator.setColor(color);
    generator.setDownscale(scale);
    // We multiply spread by the scale, so that changing scale will only affect accuracy
    // and not spread in the output image.
    generator.setSpread(scale * spread);
    BufferedImage distanceField = generator.generateDistanceField(input);

    g.drawImage(distanceField, new AffineTransform(), null);
}
项目:touhou-java    文件:ShadowEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g = (Graphics2D)g.create();
    g.translate(xDistance, yDistance);
    g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), Math.round(opacity * 255)));
    g.fill(glyph.getShape());

    // Also shadow the outline, if one exists.
    for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();) {
        Effect effect = (Effect)iter.next();
        if (effect instanceof OutlineEffect) {
            Composite composite = g.getComposite();
            g.setComposite(AlphaComposite.Src); // Prevent shadow and outline shadow alpha from combining.

            g.setStroke(((OutlineEffect)effect).getStroke());
            g.draw(glyph.getShape());

            g.setComposite(composite);
            break;
        }
    }

    g.dispose();
    if (blurKernelSize > 1 && blurKernelSize < NUM_KERNELS && blurPasses > 0) blur(image);
}
项目:libgdxcn    文件:DistanceFieldEffect.java   
/**
 * Draws the glyph to the given image, upscaled by a factor of {@link #scale}.
 * 
 * @param image the image to draw to
 * @param glyph the glyph to draw
 */
private void drawGlyph(BufferedImage image, Glyph glyph) {
    Graphics2D inputG = (Graphics2D) image.getGraphics();
    inputG.setTransform(AffineTransform.getScaleInstance(scale, scale));
    // We don't really want anti-aliasing (we'll discard it anyway),
    // but accurate positioning might improve the result slightly
    inputG.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    inputG.setColor(Color.WHITE);
    inputG.fill(glyph.getShape());
}
项目:libgdxcn    文件:OutlineEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g = (Graphics2D)g.create();
    if (stroke != null)
        g.setStroke(stroke);
    else
        g.setStroke(getStroke());
    g.setColor(color);
    g.draw(glyph.getShape());
    g.dispose();
}
项目:libgdxcn    文件:GradientEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    int ascent = unicodeFont.getAscent();
    float height = (ascent) * scale;
    float top = -glyph.getYOffset() + unicodeFont.getDescent() + offset + ascent / 2 - height / 2;
    g.setPaint(new GradientPaint(0, top, topColor, 0, top + height, bottomColor, cyclic));
    g.fill(glyph.getShape());
}
项目:GdxStudio    文件:DistanceFieldEffect.java   
/**
 * Draws the glyph to the given image, upscaled by a factor of {@link #scale}.
 * 
 * @param image the image to draw to
 * @param glyph the glyph to draw
 */
private void drawGlyph(BufferedImage image, Glyph glyph) {
    Graphics2D inputG = (Graphics2D) image.getGraphics();
    inputG.setTransform(AffineTransform.getScaleInstance(scale, scale));
    // We don't really want anti-aliasing (we'll discard it anyway),
    // but accurate positioning might improve the result slightly
    inputG.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    inputG.setColor(Color.WHITE);
    inputG.fill(glyph.getShape());
}
项目:GdxStudio    文件:OutlineEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g = (Graphics2D)g.create();
    if (stroke != null)
        g.setStroke(stroke);
    else
        g.setStroke(getStroke());
    g.setColor(color);
    g.draw(glyph.getShape());
    g.dispose();
}
项目:GdxStudio    文件:GradientEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    int ascent = unicodeFont.getAscent();
    float height = (ascent) * scale;
    float top = -glyph.getYOffset() + unicodeFont.getDescent() + offset + ascent / 2 - height / 2;
    g.setPaint(new GradientPaint(0, top, topColor, 0, top + height, bottomColor, cyclic));
    g.fill(glyph.getShape());
}
项目:touhou-java    文件:DistanceFieldEffect.java   
/**
 * Draws the glyph to the given image, upscaled by a factor of {@link #scale}.
 * 
 * @param image the image to draw to
 * @param glyph the glyph to draw
 */
private void drawGlyph(BufferedImage image, Glyph glyph) {
    Graphics2D inputG = (Graphics2D) image.getGraphics();
    inputG.setTransform(AffineTransform.getScaleInstance(scale, scale));
    // We don't really want anti-aliasing (we'll discard it anyway),
    // but accurate positioning might improve the result slightly
    inputG.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    inputG.setColor(Color.WHITE);
    inputG.fill(glyph.getShape());
}
项目:touhou-java    文件:OutlineEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g = (Graphics2D)g.create();
    if (stroke != null)
        g.setStroke(stroke);
    else
        g.setStroke(getStroke());
    g.setColor(color);
    g.draw(glyph.getShape());
    g.dispose();
}
项目:touhou-java    文件:GradientEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    int ascent = unicodeFont.getAscent();
    float height = (ascent) * scale;
    float top = -glyph.getYOffset() + unicodeFont.getDescent() + offset + ascent / 2 - height / 2;
    g.setPaint(new GradientPaint(0, top, topColor, 0, top + height, bottomColor, cyclic));
    g.fill(glyph.getShape());
}
项目:libgdxcn    文件:Effect.java   
/** Called to draw the effect. */
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph);
项目:libgdxcn    文件:FilterEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    BufferedImage scratchImage = EffectUtil.getScratchImage();
    filter.filter(image, scratchImage);
    image.getGraphics().drawImage(scratchImage, 0, 0, null);
}
项目:libgdxcn    文件:ColorEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g.setColor(color);
    g.fill(glyph.getShape());
}
项目:GdxStudio    文件:Effect.java   
/** Called to draw the effect. */
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph);
项目:GdxStudio    文件:FilterEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    BufferedImage scratchImage = EffectUtil.getScratchImage();
    filter.filter(image, scratchImage);
    image.getGraphics().drawImage(scratchImage, 0, 0, null);
}
项目:GdxStudio    文件:ColorEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g.setColor(color);
    g.fill(glyph.getShape());
}
项目:touhou-java    文件:Effect.java   
/** Called to draw the effect. */
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph);
项目:touhou-java    文件:FilterEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    BufferedImage scratchImage = EffectUtil.getScratchImage();
    filter.filter(image, scratchImage);
    image.getGraphics().drawImage(scratchImage, 0, 0, null);
}
项目:touhou-java    文件:ColorEffect.java   
public void draw (BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
    g.setColor(color);
    g.fill(glyph.getShape());
}