상속: ITextureRef
예제 #1
0
        public static TexBitmap ImageFetchWithDevice(Stream stream, AbstractTextureRef texRef)
        {
            var tex  = ImageLoader.FromStream(FetchDevice, stream);
            var data = new byte[tex.Width * tex.Height * 4];

            tex.GetData(data);
            for (int i = 0; i < data.Length; i += 4)
            {
                //output expects bgra.
                var temp = data[i + 2];
                data[i + 2] = data[i];
                data[i]     = temp;
            }
            tex.Dispose();

            return(new TexBitmap
            {
                Data = data,
                Width = tex.Width,
                Height = tex.Height,
                PixelSize = 4
            });
        }