Open Source Tomb Raider Engine
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

mtk_tga.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
  2. /*================================================================
  3. *
  4. * Project : Freyja
  5. * Author : Mongoose
  6. * Website : http://www.westga.edu/~stu7440/
  7. * Email : stu7440@westga.edu
  8. * Object :
  9. * License : GPL See file COPYING, also (C) 2000 Mongoose
  10. * Comments: TGA plug-in
  11. *
  12. *
  13. * This file was generated using Mongoose's C++
  14. * template generator script. <stu7440@westga.edu>
  15. *
  16. *-- History ------------------------------------------------
  17. *
  18. * 2000-10-15:
  19. * Mongoose - Created
  20. ================================================================*/
  21. #ifndef _MTK_TGA_H
  22. #define _MTK_TGA_H
  23. #include <stdio.h>
  24. typedef enum
  25. {
  26. TGA_TYPE__NO_DATA = 0,
  27. TGA_TYPE__MAPPED = 1,
  28. TGA_TYPE__COLOR = 2,
  29. TGA_TYPE__GREYSCALE = 3,
  30. TGA_TYPE__MAPPED_RLE = 9,
  31. TGA_TYPE__COLOR_RLE = 10
  32. // TGA_TYPE__GREYSCALE_COMPRESSED = 11,
  33. // TGA_TYPE__COLOR_HUFFMAN_DELTA_RLE = 32,
  34. // TGA_TYPE__COLOR_HUFFMAN_DELTA_RLE_4PASS = 33
  35. } tga_type_t;
  36. typedef struct mtk_image_tga_s
  37. {
  38. unsigned char comment_lenght; /* Number of bytes in comment */
  39. unsigned char colormap_type; /* 0 No colormap; 1 Has colormap */
  40. unsigned char image_type; /* 1 Colormapped, 2 Unmapped;
  41. 9 Colormapped RLE; 10 Unmapped RLE */
  42. unsigned short colormap_index; /* Index of first color map entry */
  43. unsigned short colormap_lenght; /* Number of color map entries */
  44. unsigned char colormap_bbp; /* 16, 24, or 32 bits per pixel format */
  45. unsigned short origin_x; /* X coor of lower-left corner */
  46. unsigned short origin_y; /* Y coor of lower-left corner */
  47. unsigned short width; /* Width in pixels */
  48. unsigned short height; /* Height in pixels */
  49. unsigned char bpp; /* Number of bits in a pixel index */
  50. unsigned char desc_flags; /* Various magic bits */
  51. } mtk_image_tga_t;
  52. int mtk_image__tga_check(FILE *f);
  53. /*------------------------------------------------------
  54. * Pre : Filename is to be checked
  55. * Post : Returns 0 if valid, else error condition
  56. *
  57. *-- History ------------------------------------------
  58. *
  59. * 2001.04.01:
  60. * Mongoose - Created
  61. ------------------------------------------------------*/
  62. int mtk_image__tga_load(FILE *f, unsigned char **image,
  63. unsigned int *width, unsigned int *height, char *type);
  64. /*------------------------------------------------------
  65. * Pre : Filename is a valid image file
  66. * Post : Image is either a valid pixmap or NULL
  67. *
  68. *-- History ------------------------------------------
  69. *
  70. * 2001.04.01:
  71. * Mongoose - Created
  72. ------------------------------------------------------*/
  73. int mtk_image__tga_save(FILE *f, unsigned char *image,
  74. unsigned int width, unsigned int height, char type);
  75. /*------------------------------------------------------
  76. * Pre :
  77. * Post : Image is saved to diskfile if valid and can
  78. *
  79. *-- History ------------------------------------------
  80. *
  81. * 2001.04.01:
  82. * Mongoose - Created
  83. ------------------------------------------------------*/
  84. int mtk_image__tga_save_filename(unsigned char *image,
  85. unsigned int width, unsigned int height,
  86. char type,
  87. char *s, ...);
  88. /*------------------------------------------------------
  89. * Pre :
  90. * Post : Image is saved to diskfile if valid and can
  91. *
  92. *-- History ------------------------------------------
  93. *
  94. * 2003.07.11:
  95. * Mongoose - Created
  96. ------------------------------------------------------*/
  97. #endif