本文整理汇总了C#中Loon.Core.Graphics.LColor.GetRGB方法的典型用法代码示例。如果您正苦于以下问题:C# LColor.GetRGB方法的具体用法?C# LColor.GetRGB怎么用?C# LColor.GetRGB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loon.Core.Graphics.LColor
的用法示例。
在下文中一共展示了LColor.GetRGB方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FilterColor
public static LTexture FilterColor(string res, LColor height, Loon.Core.Graphics.Opengl.LTexture.Format format)
{
uint color = height.GetRGB();
LImage tmp = LImage.CreateImage(res);
LImage image = LImage.CreateImage(tmp.GetWidth(), tmp.GetHeight(), true);
LGraphics g = image.GetLGraphics();
g.DrawImage(tmp, 0, 0);
g.Dispose();
if (tmp != null)
{
tmp.Dispose();
tmp = null;
}
Color[] pixels = image.GetPixels();
int size = pixels.Length;
for (int i = 0; i < size; i++)
{
if (pixels[i].PackedValue == color)
{
pixels[i].PackedValue = LSystem.TRANSPARENT;
}
}
image.SetFormat(format);
image.SetPixels(pixels, image.GetWidth(), image.GetHeight());
LTexture texture = image.GetTexture();
if (image != null)
{
image.Dispose();
image = null;
}
return texture;
}
示例2: GetInstance
public static LGradation GetInstance(LColor s, LColor e, int w, int h,
int alpha) {
if (gradations == null) {
gradations = new Dictionary<string, LGradation>(10);
}
int hashCode = 1;
hashCode = LSystem.Unite(hashCode, s.GetRGB());
hashCode = LSystem.Unite(hashCode, e.GetRGB());
hashCode = LSystem.Unite(hashCode, w);
hashCode = LSystem.Unite(hashCode, h);
hashCode = LSystem.Unite(hashCode, alpha);
string key = Convert.ToString(hashCode);
LGradation o = (LGradation) CollectionUtils.Get(gradations,key);
if (o == null) {
CollectionUtils.Put(gradations,key, o = new LGradation(s, e, w, h, alpha));
}
return o;
}
示例3: LoadBarColor
public LTexture LoadBarColor(LColor c1, LColor c2, LColor c3)
{
if (colors.Count > 10)
{
lock (colors)
{
foreach (LTexture tex2d in colors.Values)
{
if (tex2d != null)
{
tex2d.Destroy();
}
}
colors.Clear();
}
}
int hash = 1;
hash = LSystem.Unite(hash, c1.GetRGB());
hash = LSystem.Unite(hash, c2.GetRGB());
hash = LSystem.Unite(hash, c3.GetRGB());
LTexture texture = null;
lock (colors)
{
texture = (LTexture)CollectionUtils.Get(colors, hash);
}
if (texture == null)
{
LImage image = LImage.CreateImage(8, 8, false);
LGraphics g = image.GetLGraphics();
g.SetColor(c1);
g.FillRect(0, 0, 4, 4);
g.SetColor(c2);
g.FillRect(4, 0, 4, 4);
g.SetColor(c3);
g.FillRect(0, 4, 4, 4);
g.Dispose();
texture = image.GetTexture();
CollectionUtils.Put(colors, hash, texture);
}
return (this.texture = texture);
}