GlyphStitcher.java
net.minecraft.client.gui.font.GlyphStitcher
信息
- 全限定名:net.minecraft.client.gui.font.GlyphStitcher
- 类型:public class
- 包:net.minecraft.client.gui.font
- 源码路径:src/main/java/net/minecraft/client/gui/font/GlyphStitcher.java
- 起始行号:L15
- 实现:AutoCloseable
- 职责:
TODO
字段/常量
-
textureManager- 类型:
TextureManager - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
texturePrefix- 类型:
Identifier - 修饰符:
private final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
textures- 类型:
List<FontTexture> - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public GlyphStitcher(TextureManager textureManager, Identifier texturePrefix) @ L20
- 构造器名:GlyphStitcher
- 源码定位:L20
- 修饰符:public
参数:
- textureManager: TextureManager
- texturePrefix: Identifier
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void reset() @ L25
- 方法名:reset
- 源码定位:L25
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void close() @ L34
- 方法名:close
- 源码定位:L34
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public BakedSheetGlyph stitch(GlyphInfo info, GlyphBitmap glyphBitmap) @ L39
- 方法名:stitch
- 源码定位:L39
- 返回类型:BakedSheetGlyph
- 修饰符:public
参数:
- info: GlyphInfo
- glyphBitmap: GlyphBitmap
说明:
TODO
private Identifier textureName(int index) @ L57
- 方法名:textureName
- 源码定位:L57
- 返回类型:Identifier
- 修饰符:private
参数:
- index: int
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class GlyphStitcher implements AutoCloseable {
private final TextureManager textureManager;
private final Identifier texturePrefix;
private final List<FontTexture> textures = new ArrayList<>();
public GlyphStitcher(TextureManager textureManager, Identifier texturePrefix) {
this.textureManager = textureManager;
this.texturePrefix = texturePrefix;
}
public void reset() {
int textureCount = this.textures.size();
this.textures.clear();
for (int i = 0; i < textureCount; i++) {
this.textureManager.release(this.textureName(i));
}
}
@Override
public void close() {
this.reset();
}
public @Nullable BakedSheetGlyph stitch(GlyphInfo info, GlyphBitmap glyphBitmap) {
for (FontTexture texture : this.textures) {
BakedSheetGlyph glyph = texture.add(info, glyphBitmap);
if (glyph != null) {
return glyph;
}
}
int nextIndex = this.textures.size();
Identifier name = this.textureName(nextIndex);
boolean isColored = glyphBitmap.isColored();
GlyphRenderTypes renderTypes = isColored ? GlyphRenderTypes.createForColorTexture(name) : GlyphRenderTypes.createForIntensityTexture(name);
FontTexture texturex = new FontTexture(name::toString, renderTypes, isColored);
this.textures.add(texturex);
this.textureManager.register(name, texturex);
return texturex.add(info, glyphBitmap);
}
private Identifier textureName(int index) {
return this.texturePrefix.withSuffix("/" + index);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
FontTexture()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
GlyphRenderTypes.createForColorTexture(), GlyphRenderTypes.createForIntensityTexture()
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置: