|
@@ -0,0 +1,66 @@
|
|
1
|
+/*================================================================
|
|
2
|
+ *
|
|
3
|
+ * Project : Freyja
|
|
4
|
+ * Author : Mongoose
|
|
5
|
+ * Website : http://www.westga.edu/~stu7440/
|
|
6
|
+ * Email : stu7440@westga.edu
|
|
7
|
+ * Object :
|
|
8
|
+ * License : GPL See file COPYING, also (C) 2000 Mongoose
|
|
9
|
+ * Comments: TGA plug-in
|
|
10
|
+ *
|
|
11
|
+ * TODO: type should pass more info
|
|
12
|
+ * 2 bits for RGBA | RGB | GREY
|
|
13
|
+ * val for depth
|
|
14
|
+ *
|
|
15
|
+ * This file was generated using Mongoose's C++
|
|
16
|
+ * template generator script. <stu7440@westga.edu>
|
|
17
|
+ *
|
|
18
|
+ *-- History ------------------------------------------------
|
|
19
|
+ *
|
|
20
|
+ * 2001-10-25:
|
|
21
|
+ * Mongoose - support for screen origin bit
|
|
22
|
+ *
|
|
23
|
+ * 2000-10-15:
|
|
24
|
+ * Mongoose - Created
|
|
25
|
+ ================================================================*/
|
|
26
|
+
|
|
27
|
+#include <string.h>
|
|
28
|
+#include <stdarg.h>
|
|
29
|
+
|
|
30
|
+#include <mtk_tga.h>
|
|
31
|
+
|
|
32
|
+int main(int argc, char *argv[])
|
|
33
|
+{
|
|
34
|
+ FILE *f;
|
|
35
|
+ unsigned char *image;
|
|
36
|
+ unsigned int width;
|
|
37
|
+ unsigned int height;
|
|
38
|
+ char type;
|
|
39
|
+
|
|
40
|
+ if (argc > 1)
|
|
41
|
+ {
|
|
42
|
+ f = fopen(argv[1], "r");
|
|
43
|
+
|
|
44
|
+ if (!f)
|
|
45
|
+ {
|
|
46
|
+ perror("Failed to open file> ");
|
|
47
|
+ return -1;
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+ if (!mtk_image__tga_check(f))
|
|
51
|
+ {
|
|
52
|
+ if (!mtk_image__tga_load(f, &image, &width, &height, &type))
|
|
53
|
+ {
|
|
54
|
+ printf("Loaded %s successfully!\n", argv[1]);
|
|
55
|
+ delete [] image;
|
|
56
|
+ }
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ fclose(f);
|
|
60
|
+ } else {
|
|
61
|
+ printf("Usage: %s testfile.tga\n", argv[0]);
|
|
62
|
+ }
|
|
63
|
+
|
|
64
|
+ return 0;
|
|
65
|
+}
|
|
66
|
+
|