• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Glyph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.newdawn.slick.font.Glyph的典型用法代码示例。如果您正苦于以下问题:Java Glyph类的具体用法?Java Glyph怎么用?Java Glyph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getGlyph

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * Returns the glyph for the specified codePoint. If the glyph does not exist yet, 
 * it is created and queued to be loaded.
 * 
 * @param glyphCode The code of the glyph to locate
 * @param codePoint The code point associated with the glyph
 * @param bounds The bounds of the glyph on the page
 * @param vector The vector the glyph is part of  
 * @param index The index of the glyph within the vector
 * @return The glyph requested
 */
private Glyph getGlyph (int glyphCode, int codePoint, Rectangle bounds, GlyphVector vector, int index) {
	if (glyphCode < 0 || glyphCode >= MAX_GLYPH_CODE) {
		// GlyphVector#getGlyphCode sometimes returns negative numbers on OS X.
		return new Glyph(codePoint, bounds, vector, index, this) {
			public boolean isMissing () {
				return true;
			}
		};
	}
	int pageIndex = glyphCode / PAGE_SIZE;
	int glyphIndex = glyphCode & (PAGE_SIZE - 1);
	Glyph glyph = null;
	Glyph[] page = glyphs[pageIndex];
	if (page != null) {
		glyph = page[glyphIndex];
		if (glyph != null) return glyph;
	} else
		page = glyphs[pageIndex] = new Glyph[PAGE_SIZE];
	// Add glyph so size information is available and queue it so its image can be loaded later.
	glyph = page[glyphIndex] = new Glyph(codePoint, bounds, vector, index, this);
	queuedGlyphs.add(glyph);
	return glyph;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:35,代码来源:UnicodeFont.java


示例2: draw

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.font.effects.Effect#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)
 */
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);
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:28,代码来源:ShadowEffect.java


示例3: getGlyph

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * Returns the glyph for the specified codePoint. If the glyph does not exist yet,
 * it is created and queued to be loaded.
 *
 * @param glyphCode The code of the glyph to locate
 * @param codePoint The code point associated with the glyph
 * @param bounds The bounds of the glyph on the page
 * @param vector The vector the glyph is part of
 * @param index The index of the glyph within the vector
 * @return The glyph requested
 */
private Glyph getGlyph (int glyphCode, int codePoint, @Nonnull Rectangle bounds, @Nonnull GlyphVector vector, int index) {
    if (glyphCode < 0 || glyphCode >= MAX_GLYPH_CODE) {
        // GlyphVector#getGlyphCode sometimes returns negative numbers on OS X.
        return new Glyph(codePoint, bounds, vector, index, this) {
            public boolean isMissing () {
                return true;
            }
        };
    }
    int pageIndex = glyphCode / PAGE_SIZE;
    int glyphIndex = glyphCode & (PAGE_SIZE - 1);
    Glyph glyph;
    Glyph[] page = glyphs[pageIndex];
    if (page != null) {
        glyph = page[glyphIndex];
        if (glyph != null) return glyph;
    } else
        page = glyphs[pageIndex] = new Glyph[PAGE_SIZE];
    // Add glyph so size information is available and queue it so its image can be loaded later.
    glyph = page[glyphIndex] = new Glyph(codePoint, bounds, vector, index, this);
    queuedGlyphs.add(glyph);
    return glyph;
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:35,代码来源:UnicodeFont.java


示例4: getGlyph

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * Returns the glyph for the specified codePoint. If the glyph does not exist yet, 
 * it is created and queued to be loaded.
 * 
 * @param glyphCode The code of the glyph to locate
 * @param codePoint The code point associated with the glyph
 * @param bounds The bounds of the glyph on the page
 * @param vector The vector the glyph is part of  
 * @param index The index of the glyph within the vector
 * @param f The font to use
 * @return The glyph requested
 */
private Glyph getGlyph(int glyphCode, int codePoint, Rectangle bounds, GlyphVector vector, int index, UnicodeFont f) {
	if (glyphCode < 0 || glyphCode >= MAX_GLYPH_CODE) {
		// GlyphVector#getGlyphCode sometimes returns negative numbers on OS X.
		return new Glyph(codePoint, bounds, vector, index, this) {
			@Override
			public boolean isMissing () {
				return true;
			}
		};
	}
	int pageIndex = glyphCode / PAGE_SIZE;
	int glyphIndex = glyphCode & (PAGE_SIZE - 1);
	Glyph glyph = null;
	Glyph[] page = glyphs[pageIndex];
	if (page != null) {
		glyph = page[glyphIndex];
		if (glyph != null) return glyph;
	} else
		page = glyphs[pageIndex] = new Glyph[PAGE_SIZE];
	// Add glyph so size information is available and queue it so its image can be loaded later.
	glyph = page[glyphIndex] = new Glyph(codePoint, bounds, vector, index, f);
	queuedGlyphs.add(glyph);
	return glyph;
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:37,代码来源:UnicodeFont.java


示例5: draw

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.font.effects.Effect#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)
 */
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());
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:11,代码来源:GradientEffect.java


示例6: draw

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.font.effects.Effect#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)
 */
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();
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:14,代码来源:OutlineEffect.java


示例7: addBackupGlyphs

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * Queues the backup glyphs in the specified text to be loaded. Note that
 * the glyphs are not actually loaded until {@link #loadGlyphs()} is called.
 * 
 * @param text The text containing the glyphs to be added
 */
private void addBackupGlyphs(String text) {
	if (text == null) throw new IllegalArgumentException("text cannot be null.");
	if (backup == null)
		return;

	char[] chars = text.toCharArray();
	GlyphVector vector = backup.getFont().layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT);
	for (int i = 0, n = vector.getNumGlyphs(); i < n; i++) {
		int codePoint = text.codePointAt(vector.getGlyphCharIndex(i));
		Rectangle bounds = getGlyphBounds(vector, i, codePoint);
		Glyph glyph = getGlyph(vector.getGlyphCode(i), codePoint, bounds, vector, i, backup);
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:20,代码来源:UnicodeFont.java


示例8: compare

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
public int compare (Object o1, Object o2) {
	return ((Glyph)o1).getHeight() - ((Glyph)o2).getHeight();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:4,代码来源:UnicodeFont.java


示例9: draw

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.font.effects.Effect#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)
 */
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);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:9,代码来源:FilterEffect.java


示例10: draw

import org.newdawn.slick.font.Glyph; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.font.effects.Effect#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)
 */
public void draw(BufferedImage image, Graphics2D g, UnicodeFont unicodeFont, Glyph glyph) {
	g.setColor(color);
	g.fill(glyph.getShape());
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:8,代码来源:ColorEffect.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SignedData类代码示例发布时间:2022-05-22
下一篇:
Java GeneratorBase类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap