SFML.Graphics.Texture.Texture C# (CSharp) Method

Texture() public method

Construct the texture from a file in memory
public Texture ( byte bytes ) : System
bytes byte Byte array containing the file contents
return System
        public Texture(byte[] bytes) :
            base(IntPtr.Zero)
        {
            GCHandle pin = GCHandle.Alloc(bytes, GCHandleType.Pinned);
            try
            {
                IntRect rect = new IntRect(0, 0, 0, 0);
                CPointer = sfTexture_createFromMemory(pin.AddrOfPinnedObject(), Convert.ToUInt64(bytes.Length), ref rect);
            }
            finally
            {
                pin.Free();
            }
            if (CPointer == IntPtr.Zero)
                throw new LoadingFailedException("texture");
        }

Same methods

Texture::Texture ( Image image ) : System
Texture::Texture ( Image image, IntRect area ) : System
Texture::Texture ( IntPtr cPointer ) : System
Texture::Texture ( Stream stream ) : System
Texture::Texture ( Stream stream, IntRect area ) : System
Texture::Texture ( Texture copy ) : System
Texture::Texture ( string filename ) : System
Texture::Texture ( string filename, IntRect area ) : System
Texture::Texture ( uint width, uint height ) : System