summaryrefslogtreecommitdiffstats
path: root/ue2/imgsynth2/cpixmap.h
diff options
context:
space:
mode:
authorGünther Neuwirth <e0626638@student.tuwien.ac.at>2009-05-01 14:58:58 +0200
committerGünther Neuwirth <e0626638@student.tuwien.ac.at>2009-05-01 14:58:58 +0200
commitb0442de485dcb6328366d9b05a62af345e5fa39f (patch)
tree594628ba235e526ed54554cf72794b71624f4591 /ue2/imgsynth2/cpixmap.h
parent6b89034cd15a2ca270591aec89b8b13c868b86fc (diff)
downloadooprog-b0442de485dcb6328366d9b05a62af345e5fa39f.tar.gz
ooprog-b0442de485dcb6328366d9b05a62af345e5fa39f.tar.bz2
ooprog-b0442de485dcb6328366d9b05a62af345e5fa39f.zip
Adding cpixelformat_indexd8.h and .cpp. Adding virtual methode getColorMode to CPixelFormat. Adding color table to CBitmap. Adding implementation of CPixmap
Diffstat (limited to 'ue2/imgsynth2/cpixmap.h')
-rw-r--r--ue2/imgsynth2/cpixmap.h62
1 files changed, 29 insertions, 33 deletions
diff --git a/ue2/imgsynth2/cpixmap.h b/ue2/imgsynth2/cpixmap.h
index c7537cd..863cbd4 100644
--- a/ue2/imgsynth2/cpixmap.h
+++ b/ue2/imgsynth2/cpixmap.h
@@ -1,33 +1,32 @@
1/** 1/**
2 * @module CPixMap 2 * @module CPixmap
3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) 3 * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348)
4 * @brief Implementation of CFile CBitmap handling XPM. 4 * @brief Implementation of CFile CBitmap handling XPM.
5 * @date 27.04.2009 5 * @date 27.04.2009
6 */ 6 */
7 7
8#ifndef CPixMap_H 8#ifndef CPixmap_H
9#define CPixMap_H 9#define CPixmap_H
10 10
11#include <stdint.h> 11#include <stdint.h>
12#include <map>
13#include "cbitmap.h" 12#include "cbitmap.h"
14 13
15 14
16/** 15/**
17 * @class CBitmap 16 * @class CPixmap
18 * @brief Implementation of CFile handling Windows Bitmaps. 17 * @brief Implementation of CFile handling Pixmap file format.
19 * 18 *
20 * In order to support operations on bitmaps with different color bitcounts 19 * In order to support operations on pixmaps in color mode an
21 * different implementations of CPixelFormat are used. These classes are 20 * implementations of CPixelFormat is used. These classe are
22 * allowed to modify the bitmap headers and pixelbuffer directly. 21 * allowed to modify the pixmap header, pixelbuffer and color table directly.
23 * 22 *
24 * On error CFile::FileError is thrown. 23 * On error CFile::FileError is thrown.
25 */ 24 */
26class CPixMap : public CBitmap 25class CPixmap : public CBitmap
27{ 26{
28 public: 27 public:
29 /** 28 /**
30 * @method CPixMap 29 * @method CPixmap
31 * @brief Default ctor 30 * @brief Default ctor
32 * @param - 31 * @param -
33 * @return - 32 * @return -
@@ -35,10 +34,10 @@ class CPixMap : public CBitmap
35 * @exception none 34 * @exception none
36 * @conditions none 35 * @conditions none
37 */ 36 */
38 CPixMap(); 37 CPixmap();
39 38
40 /** 39 /**
41 * @method ~CPixMap 40 * @method ~CPixmap
42 * @brief Default dtor 41 * @brief Default dtor
43 * @param - 42 * @param -
44 * @return - 43 * @return -
@@ -46,12 +45,12 @@ class CPixMap : public CBitmap
46 * @exception none 45 * @exception none
47 * @conditions none 46 * @conditions none
48 */ 47 */
49 ~CPixMap() 48 ~CPixmap()
50 {} 49 {}
51 50
52 /** 51 /**
53 * @method read 52 * @method read
54 * @brief Reads Windows Bitmap from filestream. 53 * @brief Reads Pixmap from filestream.
55 * On error an exception is thrown. 54 * On error an exception is thrown.
56 * @param in filestream to read data from 55 * @param in filestream to read data from
57 * @return - 56 * @return -
@@ -64,7 +63,7 @@ class CPixMap : public CBitmap
64 63
65 /** 64 /**
66 * @method write 65 * @method write
67 * @brief Writes Windows Bitmap to filestream. 66 * @brief Writes Pixmap to filestream.
68 * @param out filestream to read data from 67 * @param out filestream to read data from
69 * @return - 68 * @return -
70 * @globalvars none 69 * @globalvars none
@@ -73,11 +72,11 @@ class CPixMap : public CBitmap
73 * @conditions none 72 * @conditions none
74 */ 73 */
75 74
76 void write(std::ofstream& out); 75 void write(std::ofstream& out, std::string& filename);
77#ifdef DEBUG 76#ifdef DEBUG
78 /** 77 /**
79 * @method dump 78 * @method dump
80 * @brief Dumps the Windows Bitmap file headers to ostream 79 * @brief Dumps the Pixmap file header and pixel data to ostream
81 * @param out output stream 80 * @param out output stream
82 * @return - 81 * @return -
83 * @globalvars 82 * @globalvars
@@ -90,7 +89,7 @@ class CPixMap : public CBitmap
90 89
91 90
92 /** 91 /**
93 * @brief Windows Bitmap Info Header structure 92 * @brief Pixmap Header structure
94 */ 93 */
95#pragma pack(push,1) 94#pragma pack(push,1)
96 typedef struct 95 typedef struct
@@ -101,25 +100,23 @@ class CPixMap : public CBitmap
101 uint32_t xpmHeight; 100 uint32_t xpmHeight;
102 /** the number of colors (signed integer) */ 101 /** the number of colors (signed integer) */
103 uint32_t nColor; 102 uint32_t nColor;
104
105 /** the number of characters per pixel (signed integer) */ 103 /** the number of characters per pixel (signed integer) */
106 uint32_t nChar; 104 uint32_t nChar;
107
108 /** X-Position Hotspots */ 105 /** X-Position Hotspots */
109 uint32_t xHotspot; 106 uint32_t xHotspot;
110
111 /** Y-Position Hotspots */ 107 /** Y-Position Hotspots */
112 uint32_t yHotspot; 108 uint32_t yHotspot;
113 109 /* is hotspot set */
114 /* color tables*/ 110 bool _HOTSPOT;
115 // std::map<std::string, std::map< std::string, std::string > > xpmColors; 111 /* XPMEXT extension tag found*/
116 // std::map<std::string, uint32_t[3]> xpmColors; 112 bool _XPMEXT;
117 113 /* unchanged extension */
118 114 std::string extension;
119 } PIXMAP_FILEHEADER; 115
116 } PIXMAP_FILEHEADER;
120#pragma pack(pop) 117#pragma pack(pop)
121 118
122 /* TODO */ 119
123 const uint32_t getPixelDataSize() 120 const uint32_t getPixelDataSize()
124 { 121 {
125 return m_fileheader.xpmWidth * 122 return m_fileheader.xpmWidth *
@@ -127,21 +124,20 @@ class CPixMap : public CBitmap
127 m_fileheader.nChar; 124 m_fileheader.nChar;
128 } 125 }
129 126
130 /* TODO */ 127
131 const uint32_t getHeight() 128 const uint32_t getHeight()
132 { 129 {
133 /* width and height can be negativ */ 130 /* width and height can be negativ */
134 return m_fileheader.xpmHeight; 131 return m_fileheader.xpmHeight;
135 } 132 }
136 133
137 /* TODO */
138 const uint32_t getWidth() 134 const uint32_t getWidth()
139 { 135 {
140 /* width and height can be negativ */ 136 /* width and height can be negativ */
141 return m_fileheader.xpmWidth; 137 return m_fileheader.xpmWidth;
142 } 138 }
143 139
144 /* TODO */ 140
145 const bool isMirrored() 141 const bool isMirrored()
146 { 142 {
147 /* pixmap is never mirrored */ 143 /* pixmap is never mirrored */