Esempio n. 1
0
        public static LImage CreateImage(InputStream ins)
        {
            LImage image = null;

            try
            {
                image        = new LImage();
                image.m_data = Texture2D.FromStream(GL.device, ins);
                image.width  = image.m_data.Width;
                image.height = image.m_data.Height;
                image.isExt  = true;
                image.CheckAlpha();
            }
            catch (Exception ex)
            {
                Loon.Utils.Debugging.Log.Exception(ex);
            }
            finally
            {
                if (ins != null)
                {
                    try
                    {
                        ins.Close();
                        ins = null;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            return(image);
        }
Esempio n. 2
0
        public static LImage CreateImage(int width, int height, SurfaceFormat format)
        {
            LImage image = new LImage();

            image.m_data = new RenderTarget2D(GL.device, width, height, false, format, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
            image.width  = image.m_data.Width;
            image.height = image.m_data.Height;
            image.CheckAlpha();
            return(image);
        }
Esempio n. 3
0
        public static LImage CreateImage(LImage image, int x, int y, int width, int height, int transform)
        {
            LImage result = new LImage();

            if (transform < 4)
            {
                result.m_data = new Texture2D(GL.device, width, height, false, SurfaceFormat.Color);
            }
            else
            {
                result.m_data = new Texture2D(GL.device, height, width, true, SurfaceFormat.Color);
            }
            result.width  = image.m_data.Width;
            result.height = image.m_data.Height;
            result.CheckAlpha();
            return(result);
        }
Esempio n. 4
0
        internal static LImage NewImage(Texture2D tex2d)
        {
            int size = tex2d.Width * tex2d.Height;

            Color[] pixels = new Color[size];
            tex2d.GetData <Color>(pixels);

            LImage    image    = new LImage();
            Texture2D newTex2d = new Texture2D(GL.device, tex2d.Width, tex2d.Height);

            newTex2d.SetData <Color>(pixels);
            image.m_data = newTex2d;
            image.width  = image.m_data.Width;
            image.height = image.m_data.Height;
            image.CheckAlpha();

            return(image);
        }
Esempio n. 5
0
        internal static LImage NewImage(Texture2D tex2d)
        {
            int size = tex2d.Width * tex2d.Height;
            Color[] pixels = new Color[size];
            tex2d.GetData<Color>(pixels);

            LImage image = new LImage();
            Texture2D newTex2d = new Texture2D(GL.device, tex2d.Width, tex2d.Height);
            newTex2d.SetData<Color>(pixels);
            image.m_data = newTex2d;
            image.width = image.m_data.Width;
            image.height = image.m_data.Height;
            image.CheckAlpha();

            return image;
        }
Esempio n. 6
0
 public static LImage CreateImage(InputStream ins)
 {
     LImage image = null;
     try
     {
         image = new LImage();
         image.m_data = Texture2D.FromStream(GL.device, ins);
         image.width = image.m_data.Width;
         image.height = image.m_data.Height;
         image.isExt = true;
         image.CheckAlpha();
     }
     catch (Exception ex)
     {
         Loon.Utils.Debug.Log.Exception(ex);
     }
     finally
     {
         if (ins != null)
         {
             try
             {
                 ins.Close();
                 ins = null;
             }
             catch (Exception)
             {
             }
         }
     }
     return image;
 }
Esempio n. 7
0
 public static LImage CreateImage(LImage image, int x, int y, int width, int height, int transform)
 {
     LImage result = new LImage();
     if (transform < 4)
     {
         result.m_data = new Texture2D(GL.device, width, height, false, SurfaceFormat.Color);
     }
     else
     {
         result.m_data = new Texture2D(GL.device, height, width, true, SurfaceFormat.Color);
     }
     result.width = image.m_data.Width;
     result.height = image.m_data.Height;
     result.CheckAlpha();
     return result;
 }
Esempio n. 8
0
 public static LImage CreateImage(int width, int height, SurfaceFormat format)
 {
     LImage image = new LImage();
     image.m_data = new RenderTarget2D(GL.device, width, height, false, format, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
     image.width = image.m_data.Width;
     image.height = image.m_data.Height;
     image.CheckAlpha();
     return image;
 }