Beispiel #1
0
 public static int CalculateImageSize(DdsPixelFormat pixelFormat, int width, int height)
 {
     if (pixelFormat.RgbBitCount > 0)
         return (width*height*pixelFormat.RgbBitCount)/8;
     if (pixelFormat.Equals(DdsPfDxt1()))
         return ((width*height*32)/8)/8;
     if (pixelFormat.Equals(DdsPfDxt3()))
         return ((width*height*32)/4)/8;
     if (pixelFormat.Equals(DdsPfDxt5()))
         return ((width*height*32)/4)/8;
     throw new NotImplementedException("Could not calculate the image size of the current pixel format.");
 }
Beispiel #2
0
 public static int GetMinimumImageSize(DdsPixelFormat pixelFormat)
 {
     if (pixelFormat.Equals(DdsPfDxt1()))
     {
         return(8);
     }
     if (pixelFormat.Equals(DdsPfDxt3()))
     {
         return(16);
     }
     if (pixelFormat.Equals(DdsPfDxt5()))
     {
         return(16);
     }
     return(4);
 }
Beispiel #3
0
 public static int CalculateImageSize(DdsPixelFormat pixelFormat, int width, int height, int depth)
 {
     if (pixelFormat.RgbBitCount > 0)
     {
         return((int)((long)width * height * depth * pixelFormat.RgbBitCount / 8));
     }
     if (pixelFormat.Equals(DdsPfDxt1()))
     {
         return((int)((long)width * height * depth) / 2); // ((width*height*32)/8)/8;
     }
     if (pixelFormat.Equals(DdsPfDxt3()))
     {
         return(width * height * depth);  // ((width*height*32)/4)/8;
     }
     if (pixelFormat.Equals(DdsPfDxt5()))
     {
         return(width * height * depth);  // ((width*height*32)/4)/8;
     }
     throw new ArgumentException("Could not calculate the image size of the current pixel format.");
 }
Beispiel #4
0
 public static int GetMinimumImageSize(DdsPixelFormat pixelFormat)
 {
     if (pixelFormat.Equals(DdsPfDxt1()))
         return 8;
     if (pixelFormat.Equals(DdsPfDxt3()))
         return 16;
     if (pixelFormat.Equals(DdsPfDxt5()))
         return 16;
     return 4;
 }