Beispiel #1
0
        public LTexture(string resName,
                        Format format, bool multipyAlpha)
        {
            LTextureData data = GLLoader.GetTextureData(resName);

            data.SetMultipyAlpha(multipyAlpha);
            this.Init(data, format);
        }
Beispiel #2
0
 public LTexture Pack(Loon.Core.Graphics.Opengl.LTexture.Format format)
 {
     if (texture != null && !packing)
     {
         return(texture);
     }
     if (fileName != null)
     {
         texture       = new LTexture(GLLoader.GetTextureData(fileName), format);
         texture.isExt = true;
     }
     else
     {
         LImage image = PackImage();
         if (image == null)
         {
             return(null);
         }
         if (texture != null)
         {
             texture.Destroy();
             texture = null;
         }
         if (colorMask != null)
         {
             Color[] pixels = image.GetPixels();
             int     size   = pixels.Length;
             uint    color  = colorMask.GetRGB();
             for (int i = 0; i < size; i++)
             {
                 if (pixels[i].PackedValue == color)
                 {
                     pixels[i].PackedValue = LSystem.TRANSPARENT;
                 }
             }
             image.SetPixels(pixels, image.GetWidth(), image.GetHeight());
         }
         texture       = new LTexture(GLLoader.GetTextureData(image), format);
         texture.isExt = true;
         if (image != null)
         {
             image.Dispose();
             image = null;
         }
     }
     return(texture);
 }
Beispiel #3
0
 public LTexture(LImage pix, Format format)
     : this(GLLoader.GetTextureData(pix), format)
 {
 }
Beispiel #4
0
 public LTexture(string res, Format format)
     : this(GLLoader.GetTextureData(res), format)
 {
 }