VTFLib
A C and C++ API that, with a few simple functions, can open and save .vtf and .vmt files.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
VTFDXTn.h
1 /*
2  * VTFLib
3  * Copyright (C) 2005-2010 Neil Jedrzejewski & Ryan Gregg
4 
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later
9  * version.
10  */
11 
12 #ifndef VTFLIB_VTFDXTN_H
13 #define VTFLIB_VTFDXTN_H
14 
15 #include "stdafx.h"
16 
17 //-----------------------------------------------------------------------------
18 //
19 // VTFDXTn.h - contains structures and definitions used in dealing with DXTn
20 // compressed image data.
21 //
22 // Much of this code is based on examples on Microsofts website and from the
23 // Developers Image Library (http://www.imagelib.org) (c) Denton Woods.
24 //
25 //-----------------------------------------------------------------------------
26 
27 // RGBA Pixel type
28 typedef struct Colour8888
29 {
30  vlByte r; // change the order of names to change the
31  vlByte g; // order of the output ARGB or BGRA, etc...
32  vlByte b; // Last one is MSB, 1st is LSB.
33  vlByte a;
34 } Colour8888;
35 
36 // RGB Pixel type
37 typedef struct Colour888
38 {
39  vlByte r; // change the order of names to change the
40  vlByte g; // order of the output ARGB or BGRA, etc...
41  vlByte b; // Last one is MSB, 1st is LSB.
42 } Colour888;
43 
44 // BGR565 Pixel type
45 typedef struct Colour565
46 {
47  vlUInt nBlue : 5; // order of names changes
48  vlUInt nGreen : 6; // byte order of output to 32 bit
49  vlUInt nRed : 5;
50 } Colour565;
51 
52 // DXTn Colour block type
53 typedef struct DXTColBlock
54 {
55  vlShort col0;
56  vlShort col1;
57  vlChar row[4]; // no bit fields - use bytes
58 } DXTColBlock;
59 
60 // DXTn Alpha block types
61 typedef struct DXTAlphaBlockExplicit
62 {
63  vlShort row[4];
64 } DXTAlphaBlockExplicit;
65 
66 typedef struct DXTAlphaBlock3BitLinear
67 {
68  vlChar alpha0;
69  vlChar alpha1;
70  vlChar stuff[6];
71 } DXTAlphaBlock3BitLinear;
72 
73 #endif // VTFDXTN_H
unsigned char vlByte
Single unsigned byte.
Definition: stdafx.h:52
char vlChar
Single signed character.
Definition: stdafx.h:51
unsigned int vlUInt
Unsigned integer value.
Definition: stdafx.h:56
signed short vlShort
Signed short floating point value.
Definition: stdafx.h:53
Application framework header plus VTFLib custom data types.