📄 gamefontmanager.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
package com.golden.gamedev.object;
import com.golden.gamedev.object.font.AdvanceBitmapFont;
import com.golden.gamedev.object.font.BitmapFont;
import com.golden.gamedev.object.font.SystemFont;
import com.golden.gamedev.util.ImageUtil;
import com.golden.gamedev.util.Utility;
import java.awt.Color;
import java.awt.Font;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
// Referenced classes of package com.golden.gamedev.object:
// GameFont
public class GameFontManager
{
private final Map a = new HashMap(5);
public GameFontManager()
{
}
public void clear()
{
a.clear();
}
public Object removeFont(Object obj)
{
return a.remove(obj);
}
public GameFont getFont(String s)
{
return (GameFont)a.get(s);
}
public GameFont putFont(String s, GameFont gamefont)
{
return (GameFont)a.put(s, gamefont);
}
public GameFont getFont(BufferedImage bufferedimage)
{
Object obj;
if((obj = (GameFont)a.get(bufferedimage)) == null)
{
obj = new AdvanceBitmapFont(h(bufferedimage));
a.put(bufferedimage, obj);
}
return ((GameFont) (obj));
}
public GameFont getFont(BufferedImage bufferedimage, String s)
{
Object obj;
if((obj = (GameFont)a.get(bufferedimage)) == null)
{
obj = new AdvanceBitmapFont(h(bufferedimage), s);
a.put(bufferedimage, obj);
}
return ((GameFont) (obj));
}
private BufferedImage[] h(BufferedImage bufferedimage)
{
int i = bufferedimage.getRGB(0, 0);
int ai[] = new int[100];
int j = 0;
int k = 0;
for(int l = 1; l < bufferedimage.getWidth(); l++)
if(bufferedimage.getRGB(l, 0) == i)
{
ai[j++] = l - k;
k = l;
if(j >= ai.length)
ai = (int[])Utility.expand(ai, 50);
}
BufferedImage abufferedimage[] = new BufferedImage[j];
Color color = new Color(bufferedimage.getRGB(1, 0));
int i1 = bufferedimage.getHeight() - 1;
int j1 = 0;
for(int k1 = 0; k1 < abufferedimage.length; k1++)
{
abufferedimage[k1] = ImageUtil.applyMask(bufferedimage.getSubimage(j1, 1, ai[k1], i1), color);
j1 += ai[k1];
}
return abufferedimage;
}
public GameFont getFont(BufferedImage abufferedimage[])
{
Object obj;
if((obj = (GameFont)a.get(abufferedimage)) == null)
{
obj = new BitmapFont(abufferedimage);
a.put(abufferedimage, obj);
}
return ((GameFont) (obj));
}
public GameFont getFont(BufferedImage abufferedimage[], String s)
{
Object obj;
if((obj = (GameFont)a.get(abufferedimage)) == null)
{
obj = new BitmapFont(abufferedimage, s);
a.put(abufferedimage, obj);
}
return ((GameFont) (obj));
}
public GameFont getFont(Font font)
{
return getFont(font, ((Color) (null)));
}
public GameFont getFont(Font font, Color color)
{
Object obj;
if((obj = (GameFont)a.get(font)) == null)
{
obj = color != null ? ((Object) (new SystemFont(font, color))) : ((Object) (new SystemFont(font)));
a.put(font, obj);
}
return ((GameFont) (obj));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -