[gimp-dds] / trunk / dds.h Repository:
ViewVC logotype

View of /trunk/dds.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 121 - (download) (as text) (annotate)
Wed Dec 10 19:22:32 2008 UTC (11 months, 1 week ago) by cocidius
File size: 4370 byte(s)
Added routines to decode YCoCg and alpha exponent encoded images.  They can
be found in the Filters/Colors menu.
    1 /*
    2    DDS GIMP plugin
    3 
    4    Copyright (C) 2004-2008 Shawn Kirst <skirst@insightbb.com>,
    5    with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified.
    6 
    7    This program is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU General Public
    9    License as published by the Free Software Foundation; either
   10    version 2 of the License, or (at your option) any later version.
   11 
   12    This program is distributed in the hope that it will be useful,
   13    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15    General Public License for more details.
   16 
   17    You should have received a copy of the GNU General Public License
   18    along with this program; see the file COPYING.  If not, write to
   19    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   20    Boston, MA 02111-1307, USA.
   21 */
   22 
   23 #ifndef DDS_H
   24 #define DDS_H
   25 
   26 #define FOURCC(a, b, c, d) \
   27          ((unsigned int)((unsigned int)(a)      ) | \
   28                         ((unsigned int)(b) <<  8) | \
   29                         ((unsigned int)(c) << 16) | \
   30                         ((unsigned int)(d) << 24))
   31 
   32 typedef enum
   33 {
   34    DDS_COMPRESS_NONE = 0,
   35    DDS_COMPRESS_BC1,        /* DXT1  */
   36    DDS_COMPRESS_BC2,        /* DXT3  */
   37    DDS_COMPRESS_BC3,        /* DXT5  */
   38    DDS_COMPRESS_BC3N,       /* DXT5n */
   39    DDS_COMPRESS_BC4,        /* ATI1  */
   40    DDS_COMPRESS_BC5,        /* ATI2  */
   41    DDS_COMPRESS_AEXP,       /* DXT5  */
   42    DDS_COMPRESS_YCOCG,      /* DXT5  */
   43    DDS_COMPRESS_YCOCGS,     /* DXT5  */
   44    DDS_COMPRESS_MAX
   45 } DDS_COMPRESSION_TYPE;
   46 
   47 typedef enum
   48 {
   49    DDS_SAVE_SELECTED_LAYER = 0,
   50    DDS_SAVE_CUBEMAP,
   51    DDS_SAVE_VOLUMEMAP,
   52    DDS_SAVE_MAX
   53 } DDS_SAVE_TYPE;
   54 
   55 typedef enum
   56 {
   57    DDS_FORMAT_DEFAULT = 0,
   58    DDS_FORMAT_RGB8,
   59    DDS_FORMAT_RGBA8,
   60    DDS_FORMAT_BGR8,
   61    DDS_FORMAT_ABGR8,
   62    DDS_FORMAT_R5G6B5,
   63    DDS_FORMAT_RGBA4,
   64    DDS_FORMAT_RGB5A1,
   65    DDS_FORMAT_RGB10A2,
   66    DDS_FORMAT_R3G3B2,
   67    DDS_FORMAT_A8,
   68    DDS_FORMAT_L8,
   69    DDS_FORMAT_L8A8,
   70    DDS_FORMAT_AEXP,
   71    DDS_FORMAT_YCOCG,
   72    DDS_FORMAT_MAX
   73 } DDS_FORMAT_TYPE;
   74 
   75 typedef enum
   76 {
   77    DDS_COLOR_DEFAULT = 0,
   78    DDS_COLOR_DISTANCE,
   79    DDS_COLOR_LUMINANCE,
   80    DDS_COLOR_INSET_BBOX,
   81    DDS_COLOR_MAX
   82 } DDS_COLOR_TYPE;
   83 
   84 typedef enum
   85 {
   86    DDS_MIPMAP_DEFAULT = 0,
   87    DDS_MIPMAP_NEAREST,
   88    DDS_MIPMAP_BOX,
   89    DDS_MIPMAP_BILINEAR,
   90    DDS_MIPMAP_BICUBIC,
   91    DDS_MIPMAP_LANCZOS,
   92    DDS_MIPMAP_MAX
   93 } DDS_MIPMAP_TYPE;
   94 
   95 #define DDS_HEADERSIZE             128
   96 
   97 #define DDSD_CAPS                  0x00000001
   98 #define DDSD_HEIGHT                0x00000002
   99 #define DDSD_WIDTH                 0x00000004
  100 #define DDSD_PITCH                 0x00000008
  101 #define DDSD_PIXELFORMAT           0x00001000
  102 #define DDSD_MIPMAPCOUNT           0x00020000
  103 #define DDSD_LINEARSIZE            0x00080000
  104 #define DDSD_DEPTH                 0x00800000
  105 
  106 #define DDPF_ALPHAPIXELS           0x00000001
  107 #define DDPF_ALPHA                 0x00000002
  108 #define DDPF_FOURCC                0x00000004
  109 #define DDPF_PALETTEINDEXED8       0x00000020
  110 #define DDPF_RGB                   0x00000040
  111 #define DDPF_LUMINANCE             0x00020000
  112 
  113 #define DDSCAPS_COMPLEX            0x00000008
  114 #define DDSCAPS_TEXTURE            0x00001000
  115 #define DDSCAPS_MIPMAP             0x00400000
  116 
  117 #define DDSCAPS2_CUBEMAP           0x00000200
  118 #define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
  119 #define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
  120 #define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
  121 #define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
  122 #define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
  123 #define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
  124 #define DDSCAPS2_VOLUME            0x00200000
  125 
  126 typedef struct __attribute__((packed))
  127 {
  128    unsigned int size;
  129    unsigned int flags;
  130    char fourcc[4];
  131    unsigned int bpp;
  132    unsigned int rmask;
  133    unsigned int gmask;
  134    unsigned int bmask;
  135    unsigned int amask;
  136 } dds_pixel_format_t;
  137 
  138 typedef struct __attribute__((packed))
  139 {
  140    unsigned int caps1;
  141    unsigned int caps2;
  142    unsigned int reserved[2];
  143 } dds_caps_t;
  144 
  145 typedef struct __attribute__((packed))
  146 {
  147    char magic[4];
  148    unsigned int size;
  149    unsigned int flags;
  150    unsigned int height;
  151    unsigned int width;
  152    unsigned int pitch_or_linsize;
  153    unsigned int depth;
  154    unsigned int num_mipmaps;
  155    unsigned char reserved[4 * 11];
  156    dds_pixel_format_t pixelfmt;
  157    dds_caps_t caps;
  158    unsigned int reserved2;
  159 } dds_header_t;
  160 
  161 #endif

ViewVC Help
Powered by ViewVC 1.0.4