Axiom.Media.Image.FromDynamicImage C# (CSharp) Method

FromDynamicImage() public method

Loads raw image data from a byte array.
public FromDynamicImage ( byte buffer, int width, int height, int depth, PixelFormat format ) : Image
buffer byte Raw image buffer.
width int Width of this image data (in pixels).
height int Height of this image data (in pixels).
depth int
format PixelFormat Pixel format used in this texture.
return Image
	    public Image FromDynamicImage( byte[] buffer, int width, int height, int depth, PixelFormat format )
		{
			return FromDynamicImage( buffer, width, height, depth, format, true, 1, 0 );
		}

Same methods

Image::FromDynamicImage ( byte buffer, int width, int height, PixelFormat format ) : Image
Image::FromDynamicImage ( byte buffer, int width, int height, int depth, PixelFormat format, bool autoDelete, int numFaces, int numMipMaps ) : Image

Usage Example

Example #1
0
        private void SaveToDisk( Texture tp, string filename )
        {
          // Declare buffer
            int buffSize = tp.Width * tp.Height * tp.Depth * 4;
            byte[] data = new byte[buffSize];
          

          // Setup Image with correct settings
          Image i = new Image();
          i.FromDynamicImage(data, tp.Width, tp.Height, tp.Depth,tp.Format);
          
          // Copy Texture buffer contents to image buffer
          HardwarePixelBuffer buf = tp.GetBuffer();      
          PixelBox destBox = i.GetPixelBox(0,0);
          buf.BlitToMemory(destBox);
          
          // Save to disk!
          i.Save( @"C:\" + filename );
        }
All Usage Examples Of Axiom.Media.Image::FromDynamicImage