# E:/DevIL/src-IL/include/il_dds.h File Reference

`#include "il_internal.h"`

Go to the source code of this file.

## Data Structures

struct | DDSHEAD
struct | Color8888
struct | Color888
struct | Color565
struct | DXTColBlock
struct | DXTAlphaBlockExplicit
struct | DXTAlphaBlock3BitLinear

## Defines

#define | DDS_CAPS 0x00000001L
#define | DDS_HEIGHT 0x00000002L
#define | DDS_WIDTH 0x00000004L
#define | DDS_RGB 0x00000040L
#define | DDS_PIXELFORMAT 0x00001000L
#define | DDS_LUMINANCE 0x00020000L
#define | DDS_ALPHAPIXELS 0x00000001L
#define | DDS_ALPHA 0x00000002L
#define | DDS_FOURCC 0x00000004L
#define | DDS_PITCH 0x00000008L
#define | DDS_COMPLEX 0x00000008L
#define | DDS_TEXTURE 0x00001000L
#define | DDS_MIPMAPCOUNT 0x00020000L
#define | DDS_LINEARSIZE 0x00080000L
#define | DDS_VOLUME 0x00200000L
#define | DDS_MIPMAP 0x00400000L
#define | DDS_DEPTH 0x00800000L
#define | DDS_CUBEMAP 0x00000200L
#define | DDS_CUBEMAP_POSITIVEX 0x00000400L
#define | DDS_CUBEMAP_NEGATIVEX 0x00000800L
#define | DDS_CUBEMAP_POSITIVEY 0x00001000L
#define | DDS_CUBEMAP_NEGATIVEY 0x00002000L
#define | DDS_CUBEMAP_POSITIVEZ 0x00004000L
#define | DDS_CUBEMAP_NEGATIVEZ 0x00008000L
#define | IL_MAKEFOURCC(ch0, ch1, ch2, ch3)
#define | CUBEMAP_SIDES 6

## Enumerations

enum | PixFormat { PF_ARGB, PF_RGB, PF_DXT1, PF_DXT2, PF_DXT3, PF_DXT4, PF_DXT5, PF_3DC, PF_ATI1N, PF_LUMINANCE, PF_LUMINANCE_ALPHA, PF_RXGB, PF_A16B16G16R16, PF_R16F, PF_G16R16F, PF_A16B16G16R16F,
PF_R32F, PF_G32R32F, PF_A32B32G32R32F, PF_UNKNOWN = 0xFF
}

## Functions

ILboolean | iLoadDdsInternal (void)
ILboolean | iIsValidDds (void)
ILboolean | iCheckDds (DDSHEAD *Head)
void | AdjustVolumeTexture (DDSHEAD *Head)
ILboolean | ReadData ()
ILboolean | AllocImage ()
ILboolean | Decompress ()
ILboolean | ReadMipmaps ()
ILuint | DecodePixelFormat ()
void | DxtcReadColor (ILushort Data, Color8888 *Out)
void | DxtcReadColors (const ILubyte *Data, Color8888 *Out)
ILboolean | DecompressARGB ()
ILboolean | DecompressDXT1 (ILimage *lImage, ILubyte *lCompData)
ILboolean | DecompressDXT2 (ILimage *lImage, ILubyte *lCompData)
ILboolean | DecompressDXT3 (ILimage *lImage, ILubyte *lCompData)
ILboolean | DecompressDXT4 (ILimage *lImage, ILubyte *lCompData)
ILboolean | DecompressDXT5 (ILimage *lImage, ILubyte *lCompData)
ILboolean | Decompress3Dc ()
ILboolean | DecompressAti1n ()
ILboolean | DecompressRXGB ()
ILboolean | iConvFloat16ToFloat32 (ILuint *dest, ILushort *src, ILuint size)
ILboolean | DecompressFloat (ILuint lCompFormat)
void | CorrectPreMult ()
void | GetBitsFromMask (ILuint Mask, ILuint *ShiftLeft, ILuint *ShiftRight)
ILboolean | iSaveDdsInternal (void)
ILboolean | WriteHeader (ILimage *Image, ILenum DXTCFormat, ILuint CubeFlags)
ILushort * | CompressTo565 (ILimage *Image)
ILubyte * | CompressTo88 (ILimage *Image)
ILuint | Compress (ILimage *Image, ILenum DXTCFormat)
ILboolean | GetBlock (ILushort *Block, ILushort *Data, ILimage *Image, ILuint XPos, ILuint YPos)
ILboolean | GetAlphaBlock (ILubyte *Block, ILubyte *Data, ILimage *Image, ILuint XPos, ILuint YPos)
ILboolean | Get3DcBlock (ILubyte *Block, ILubyte *Data, ILimage *Image, ILuint XPos, ILuint YPos, int channel)
void | ShortToColor565 (ILushort Pixel, Color565 *Colour)
void | ShortToColor888 (ILushort Pixel, Color888 *Colour)
ILushort | Color565ToShort (Color565 *Colour)
ILushort | Color888ToShort (Color888 *Colour)
ILuint | GenBitMask (ILushort ex0, ILushort ex1, ILuint NumCols, ILushort *In, ILubyte *Alpha, Color888 *OutCol)
void | GenAlphaBitMask (ILubyte a0, ILubyte a1, ILubyte *In, ILubyte *Mask, ILubyte *Out)
ILuint | RMSAlpha (ILubyte *Orig, ILubyte *Test)
ILuint | Distance (Color888 *c1, Color888 *c2)
void | ChooseEndpoints (ILushort *Block, ILushort *ex0, ILushort *ex1)
void | ChooseAlphaEndpoints (ILubyte *Block, ILubyte *a0, ILubyte *a1)
void | CorrectEndDXT1 (ILushort *ex0, ILushort *ex1, ILboolean HasAlpha)
void | PreMult (ILushort *Data, ILubyte *Alpha)

## Variables

ILuint | CubemapDirections [CUBEMAP_SIDES]

## Define Documentation

#define CUBEMAP_SIDES 6

Referenced by iLoadDdsCubemapInternal().

#define DDS_ALPHA 0x00000002L

#define DDS_ALPHAPIXELS 0x00000001L

Referenced by DecodePixelFormat().

#define DDS_CAPS 0x00000001L

Referenced by WriteHeader().

#define DDS_COMPLEX 0x00000008L

Referenced by iLoadDdsInternal(), and WriteHeader().

#define DDS_CUBEMAP 0x00000200L

Referenced by GetCubemapInfo(), and iLoadDdsInternal().

#define DDS_CUBEMAP_NEGATIVEX 0x00000800L

Referenced by GetCubemapInfo().

#define DDS_CUBEMAP_NEGATIVEY 0x00002000L

Referenced by GetCubemapInfo().

#define DDS_CUBEMAP_NEGATIVEZ 0x00008000L

Referenced by GetCubemapInfo().

#define DDS_CUBEMAP_POSITIVEX 0x00000400L

Referenced by GetCubemapInfo().

#define DDS_CUBEMAP_POSITIVEY 0x00001000L

Referenced by GetCubemapInfo().

#define DDS_CUBEMAP_POSITIVEZ 0x00004000L

Referenced by GetCubemapInfo().

#define DDS_DEPTH 0x00800000L

Referenced by WriteHeader().

#define DDS_FOURCC 0x00000004L

Referenced by DecodePixelFormat(), and WriteHeader().

#define DDS_HEIGHT 0x00000002L

Referenced by WriteHeader().

#define DDS_LINEARSIZE 0x00080000L

Referenced by AdjustVolumeTexture(), iLoadDdsInternal(), ReadData(), ReadMipmaps(), and WriteHeader().

#define DDS_LUMINANCE 0x00020000L

Referenced by DecodePixelFormat().

#define DDS_MIPMAP 0x00400000L

Referenced by WriteHeader().

#define DDS_MIPMAPCOUNT 0x00020000L

Referenced by ReadMipmaps(), and WriteHeader().

#define DDS_PITCH 0x00000008L

Referenced by iLoadDdsInternal().

#define DDS_PIXELFORMAT 0x00001000L

Referenced by WriteHeader().

#define DDS_RGB 0x00000040L

#define DDS_TEXTURE 0x00001000L

Referenced by WriteHeader().

#define DDS_VOLUME 0x00200000L

Referenced by AdjustVolumeTexture(), and WriteHeader().

#define DDS_WIDTH 0x00000004L

Referenced by WriteHeader().

#define IL_MAKEFOURCC | ( | ch0,
|  | ch1,
|  | ch2,
|  | ch3 |  | ) |

Value:

    ((ILint)(ILbyte)(ch0) | ((ILint)(ILbyte)(ch1) << 8) |   \
                            ((ILint)(ILbyte)(ch2) << 16) | ((ILint)(ILbyte)(ch3) << 24 ))

Referenced by DecodePixelFormat(), iCheckDds(), and WriteHeader().

## Enumeration Type Documentation

enum PixFormat

Enumerator:

  PF_ARGB |
  PF_RGB |
  PF_DXT1 |
  PF_DXT2 |
  PF_DXT3 |
  PF_DXT4 |
  PF_DXT5 |
  PF_3DC |
  PF_ATI1N |
  PF_LUMINANCE |
  PF_LUMINANCE_ALPHA |
  PF_RXGB |
  PF_A16B16G16R16 |
  PF_R16F |
  PF_G16R16F |
  PF_A16B16G16R16F |
  PF_R32F |
  PF_G32R32F |
  PF_A32B32G32R32F |
  PF_UNKNOWN |

## Function Documentation

void AdjustVolumeTexture | ( | DDSHEAD * | Head | ) |

(Head->ddsCaps1 & DDS_COMPLEX) ||

Referenced by iLoadDdsInternal().

ILboolean AllocImage | ( |  | ) |

Referenced by iLoadDdsCubemapInternal(), and iLoadDdsInternal().

void ChooseAlphaEndpoints | ( | ILubyte * | Block,
|  | ILubyte * | a0,
|  | ILubyte * | a1 |
| ) |  |  |

Referenced by Compress().

void ChooseEndpoints | ( | ILushort * | Block,
|  | ILushort * | ex0,
|  | ILushort * | ex1 |
| ) |  |  |

Referenced by Compress().

ILushort Color565ToShort | ( | Color565 * | Colour | ) |

ILushort Color888ToShort | ( | Color888 * | Colour | ) |

Referenced by PreMult().

ILuint Compress | ( | ILimage * | Image,
|  | ILenum | DXTCFormat |
| ) |  |  |

Referenced by ilGetDXTCData(), iSaveDdsInternal(), iSaveSgiInternal(), and iSaveTargaInternal().

ILushort* CompressTo565 | ( | ILimage * | Image | ) |

Referenced by Compress().

ILubyte* CompressTo88 | ( | ILimage * | Image | ) |

Referenced by Compress().

void CorrectEndDXT1 | ( | ILushort * | ex0,
|  | ILushort * | ex1,
|  | ILboolean | HasAlpha |
| ) |  |  |

Referenced by Compress().

void CorrectPreMult | ( |  | ) |

Referenced by DecompressDXT2(), and DecompressDXT4().

ILuint DecodePixelFormat | ( |  | ) |

Referenced by iLoadDdsInternal().

ILboolean Decompress | ( |  | ) |

Referenced by ilDxtcDataToSurface(), iLoadDdsCubemapInternal(), iLoadDdsInternal(), and ReadMipmaps().

ILboolean Decompress3Dc | ( |  | ) |

Referenced by Decompress().

ILboolean DecompressARGB | ( |  | ) |

Referenced by Decompress().

ILboolean DecompressAti1n | ( |  | ) |

Referenced by Decompress().

ILboolean DecompressDXT1 | ( | ILimage * | lImage,
|  | ILubyte * | lCompData |
| ) |  |  |

Referenced by Decompress(), and iLoadVtfInternal().

ILboolean DecompressDXT2 | ( | ILimage * | lImage,
|  | ILubyte * | lCompData |
| ) |  |  |

Referenced by Decompress().

ILboolean DecompressDXT3 | ( | ILimage * | lImage,
|  | ILubyte * | lCompData |
| ) |  |  |

Referenced by Decompress(), DecompressDXT2(), and iLoadVtfInternal().

ILboolean DecompressDXT4 | ( | ILimage * | lImage,
|  | ILubyte * | lCompData |
| ) |  |  |

Referenced by Decompress().

ILboolean DecompressDXT5 | ( | ILimage * | lImage,
|  | ILubyte * | lCompData |
| ) |  |  |

Referenced by Decompress(), DecompressDXT4(), and iLoadVtfInternal().

ILboolean DecompressFloat | ( | ILuint | lCompFormat | ) |

Referenced by Decompress().

ILboolean DecompressRXGB | ( |  | ) |

Referenced by Decompress().

ILuint Distance | ( | Color888 * | c1,
|  | Color888 * | c2 |
| ) |  |  |

Referenced by GenBitMask(), and iluReplaceColour().

void DxtcReadColor | ( | ILushort | Data,
|  | Color8888 * | Out |
| ) |  |  |

Referenced by DecompressDXT1(), and iLoadTplInternal().

void DxtcReadColors | ( | const ILubyte * | Data,
|  | Color8888 * | Out |
| ) |  |  |

Referenced by DecompressDXT3(), and DecompressDXT5().

void GenAlphaBitMask | ( | ILubyte | a0,
|  | ILubyte | a1,
|  | ILubyte * | In,
|  | ILubyte * | Mask,
|  | ILubyte * | Out |
| ) |  |  |

Referenced by Compress().

ILuint GenBitMask | ( | ILushort | ex0,
|  | ILushort | ex1,
|  | ILuint | NumCols,
|  | ILushort * | In,
|  | ILubyte * | Alpha,
|  | Color888 * | OutCol |
| ) |  |  |

Referenced by Compress().

ILboolean Get3DcBlock | ( | ILubyte * | Block,
|  | ILubyte * | Data,
|  | ILimage * | Image,
|  | ILuint | XPos,
|  | ILuint | YPos,
|  | int | channel |
| ) |  |  |

Referenced by Compress().

ILboolean GetAlphaBlock | ( | ILubyte * | Block,
|  | ILubyte * | Data,
|  | ILimage * | Image,
|  | ILuint | XPos,
|  | ILuint | YPos |
| ) |  |  |

Referenced by Compress().

void GetBitsFromMask | ( | ILuint | Mask,
|  | ILuint * | ShiftLeft,
|  | ILuint * | ShiftRight |
| ) |  |  |

Referenced by DecompressARGB().

ILboolean GetBlock | ( | ILushort * | Block,
|  | ILushort * | Data,
|  | ILimage * | Image,
|  | ILuint | XPos,
|  | ILuint | YPos |
| ) |  |  |

Referenced by Compress().

ILboolean iCheckDds | ( | DDSHEAD * | Head | ) |

Referenced by iIsValidDds(), and iLoadDdsInternal().

ILboolean iConvFloat16ToFloat32 | ( | ILuint * | dest,
|  | ILushort * | src,
|  | ILuint | size |
| ) |  |  |

Referenced by DecompressFloat(), and iLoadVtfInternal().

ILboolean iIsValidDds | ( | void |  | ) |

Referenced by ilIsValidDdsF(), and ilIsValidDdsL().

ILboolean iLoadDdsInternal | ( | void |  | ) |

Referenced by ilLoadDdsF(), and ilLoadDdsL().

ILboolean iSaveDdsInternal | ( | void |  | ) |

Referenced by ilSaveDdsF(), and ilSaveDdsL().

void PreMult | ( | ILushort * | Data,
|  | ILubyte * | Alpha |
| ) |  |  |

ILboolean ReadData | ( |  | ) |

Referenced by iLoadDdsCubemapInternal(), iLoadDdsInternal(), and ReadMipmaps().

ILboolean ReadMipmaps | ( |  | ) |

Referenced by iLoadDdsCubemapInternal(), and iLoadDdsInternal().

ILuint RMSAlpha | ( | ILubyte * | Orig,
|  | ILubyte * | Test |
| ) |  |  |

void ShortToColor565 | ( | ILushort | Pixel,
|  | Color565 * | Colour |
| ) |  |  |

void ShortToColor888 | ( | ILushort | Pixel,
|  | Color888 * | Colour |
| ) |  |  |

Referenced by ChooseEndpoints(), GenBitMask(), and PreMult().

ILboolean WriteHeader | ( | ILimage * | Image,
|  | ILenum | DXTCFormat,
|  | ILuint | CubeFlags |
| ) |  |  |

Referenced by iSaveDdsInternal().

## Variable Documentation

ILuint CubemapDirections[CUBEMAP_SIDES]

Referenced by iLoadDdsCubemapInternal().