本文整理汇总了C#中Texture.SetLinearFilter方法的典型用法代码示例。如果您正苦于以下问题:C# Texture.SetLinearFilter方法的具体用法?C# Texture.SetLinearFilter怎么用?C# Texture.SetLinearFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture.SetLinearFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseFontFile
private static void ParseFontFile(string directory, string path)
{
try
{
using(StreamReader reader = new StreamReader(new FileStream(path, FileMode.Open)))
{
string textureFileName = reader.ReadLine().Substring("textures: ".Length);
Texture fontTexture = new Texture(new Bitmap(directory + textureFileName));
string str = reader.ReadLine();
while(true)
{
FontInfo fontInfo;
if(str == null)
{
break;
}
string[] line = str.Split(' ');
ParseBasicFontInfo(line, out fontInfo);
if(fontInfo.Pt == DistanceFieldPt)
{
fontTexture.SetLinearFilter();
}
//string showing = "";
Fonts.Add(new MyFont(fontInfo, fontTexture));
bool flag = true;
while(true)
{
str = reader.ReadLine();
if(str == "kerning pairs:")
{
break;
}
if(string.IsNullOrWhiteSpace(str)
|| str.IndexOf("\t", StringComparison.Ordinal) == -1)
{
flag = false;
break;
}
line = str.Split('\t');
if(Fonts[Fonts.Count - 1].FontInfo.Height == 0)
{
Fonts[Fonts.Count - 1].FontInfo.Height = Int32.Parse(line[8]);
}
//showing += Char.ConvertFromUtf32(Int32.Parse(line[0]));
Fonts[Fonts.Count - 1].AddSymbol(Char.ConvertFromUtf32(Int32.Parse(line[0]))[0],
new GlyphData
{
TextureXPos = Single.Parse(line[1]) / fontTexture.Width,
TextureYPos = Single.Parse(line[2]) / fontTexture.Height,
TextureWidth = (Single.Parse(line[1]) + Single.Parse(line[3])) / fontTexture.Width,
TextureHeight = (Single.Parse(line[2]) + Single.Parse(line[4])) / fontTexture.Height,
Width = Int32.Parse(line[3]),
Height = Int32.Parse(line[4]),
XOffset = Int32.Parse(line[5]),
YOffset = Int32.Parse(line[6]),
OrigW = Int32.Parse(line[7]),
OrigH = Int32.Parse(line[8])
});
}
while(flag)
{
str = reader.ReadLine();
if(string.IsNullOrWhiteSpace(str))
{
return;
}
line = str.Split('\t');
int check;
if(!Int32.TryParse(line[0], out check))
{
break;
}
Fonts[Fonts.Count - 1].AddKerningPair(Char.ConvertFromUtf32(Int32.Parse(line[0]))[0],
Char.ConvertFromUtf32(Int32.Parse(line[1]))[0],
Single.Parse(line[2].Replace('.', ',')));
}
}
}
}
catch(IOException exc)
{
LogManager.GetCurrentClassLogger().Error(String.Format("IOexception: {0}", exc.Message));
}
catch(Exception exc)
{
LogManager.GetCurrentClassLogger().Error(String.Format("Unexpected exception, InnerException: {0}",
exc.InnerException));
LogManager.GetCurrentClassLogger().Error(String.Format("\tUnexpected exception, message: {0}", exc.Message));
}
}