public Image FromDynamicImage( byte[] buffer, int width, int height, int depth, PixelFormat format, bool autoDelete, int numFaces, int numMipMaps )
{
this.width = width;
this.height = height;
this.depth = depth;
this.format = format;
this.numMipMaps = numMipMaps;
this.flags = 0;
if ( PixelUtil.IsCompressed( format ) )
this.flags |= ImageFlags.Compressed;
if ( depth != 1 )
this.flags |= ImageFlags.Volume;
if ( numFaces == 6 )
this.flags |= ImageFlags.CubeMap;
if ( numFaces != 6 && numFaces != 1 )
throw new Exception( "Number of faces currently must be 6 or 1." );
this.size = CalculateSize( numMipMaps, numFaces, width, height, depth, format );
SetBuffer( buffer );
return this;
}