diff options
| author | manuel <manuel@nc8430.lan> | 2009-05-01 20:33:33 +0200 |
|---|---|---|
| committer | manuel <manuel@nc8430.lan> | 2009-05-01 20:33:33 +0200 |
| commit | bca08c6de2b156cbec90944c809e5e7faecd231d (patch) | |
| tree | d544ced2a8eb082cf1f393eb524519884909ed6d | |
| parent | b9ce1555b2baf9be209775dbd4c8b217db5cd735 (diff) | |
| download | ooprog-bca08c6de2b156cbec90944c809e5e7faecd231d.tar.gz ooprog-bca08c6de2b156cbec90944c809e5e7faecd231d.tar.bz2 ooprog-bca08c6de2b156cbec90944c809e5e7faecd231d.zip | |
cwindowsbitmap: seek to bitmap data
cpixmap: use copy() instead of accessing array via indices
| -rw-r--r-- | ue2/imgsynth2/cbitmap.cpp | 1 | ||||
| -rw-r--r-- | ue2/imgsynth2/cpixelformat_indexed8.cpp | 2 | ||||
| -rw-r--r-- | ue2/imgsynth2/cpixelformat_indexed8.h | 6 | ||||
| -rw-r--r-- | ue2/imgsynth2/cpixmap.cpp | 9 | ||||
| -rw-r--r-- | ue2/imgsynth2/cwindowsbitmap.cpp | 1 |
5 files changed, 10 insertions, 9 deletions
diff --git a/ue2/imgsynth2/cbitmap.cpp b/ue2/imgsynth2/cbitmap.cpp index c2cd99a..2e135db 100644 --- a/ue2/imgsynth2/cbitmap.cpp +++ b/ue2/imgsynth2/cbitmap.cpp | |||
| @@ -105,6 +105,7 @@ void CBitmap::fillrect(std::list<std::string> params) | |||
| 105 | pixel.blue = pparams[6]; | 105 | pixel.blue = pparams[6]; |
| 106 | 106 | ||
| 107 | /* call setPixel for every pixel in the rectangel */ | 107 | /* call setPixel for every pixel in the rectangel */ |
| 108 | /* NOTE: maybe use fill() here? */ | ||
| 108 | for(uint32_t i = pparams[0]; i < pparams[2] + pparams[0]; i++) | 109 | for(uint32_t i = pparams[0]; i < pparams[2] + pparams[0]; i++) |
| 109 | { | 110 | { |
| 110 | for(uint32_t j = pparams[1]; j < pparams[3] + pparams[1]; j++) | 111 | for(uint32_t j = pparams[1]; j < pparams[3] + pparams[1]; j++) |
diff --git a/ue2/imgsynth2/cpixelformat_indexed8.cpp b/ue2/imgsynth2/cpixelformat_indexed8.cpp index 546daaf..6453fad 100644 --- a/ue2/imgsynth2/cpixelformat_indexed8.cpp +++ b/ue2/imgsynth2/cpixelformat_indexed8.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * @module CPixelFormat_Indexed8 | 2 | * @module CPixelFormat_Indexed8 |
| 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) | 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) |
| 4 | * @brief Implementation of CPixelFormat handling 24bit color Windows Bitmaps. | 4 | * @brief Implementation of CPixelFormat handling 24bit color Windows Bitmaps TODO. |
| 5 | * @date 18.04.2009 | 5 | * @date 18.04.2009 |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
diff --git a/ue2/imgsynth2/cpixelformat_indexed8.h b/ue2/imgsynth2/cpixelformat_indexed8.h index 3b29bf8..f1bb0f0 100644 --- a/ue2/imgsynth2/cpixelformat_indexed8.h +++ b/ue2/imgsynth2/cpixelformat_indexed8.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * @module cpixelformat_bgr24 | 2 | * @module cpixelformat_bgr24 |
| 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) | 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) |
| 4 | * @brief Implementation of CPixelFormat handling 24bit color Windows Bitmaps. | 4 | * @brief Implementation of CPixelFormat handling 24bit color Windows Bitmaps TODO. |
| 5 | * @date 18.04.2009 | 5 | * @date 18.04.2009 |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * @class CPixelFormat_Indexed8 | 16 | * @class CPixelFormat_Indexed8 |
| 17 | * @brief Implementation of CPixelFormat handling 24bit color Windows Bitmaps. | 17 | * @brief Implementation of CPixelFormat handling 24bit color Windows Bitmaps TODO. |
| 18 | * | 18 | * |
| 19 | * On error CPixelFormat::PixelFormatError is thrown. | 19 | * On error CPixelFormat::PixelFormatError is thrown. |
| 20 | */ | 20 | */ |
| @@ -24,7 +24,7 @@ class CPixelFormat_Indexed8 : public CPixelFormat | |||
| 24 | /** | 24 | /** |
| 25 | * @method CPixelFormat_Indexed8 | 25 | * @method CPixelFormat_Indexed8 |
| 26 | * @brief Default ctor | 26 | * @brief Default ctor |
| 27 | * @param bitmap pointer to CBitmap instance | 27 | * @param pixmap pointer to CPixmap instance |
| 28 | * @return - | 28 | * @return - |
| 29 | * @globalvars none | 29 | * @globalvars none |
| 30 | * @exception none | 30 | * @exception none |
diff --git a/ue2/imgsynth2/cpixmap.cpp b/ue2/imgsynth2/cpixmap.cpp index d3e10d8..9e03d86 100644 --- a/ue2/imgsynth2/cpixmap.cpp +++ b/ue2/imgsynth2/cpixmap.cpp | |||
| @@ -272,12 +272,11 @@ void CPixmap::write(std::ofstream& out) | |||
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | /* pixel data */ | 274 | /* pixel data */ |
| 275 | //TODO: better via copy? | ||
| 276 | for (uint32_t y = 0; y < getHeight(); y++) | 275 | for (uint32_t y = 0; y < getHeight(); y++) |
| 277 | { | 276 | { |
| 278 | out << "\""; | 277 | out << "\""; |
| 279 | for (uint32_t x = 0; x < getWidth(); x++) | 278 | uint32_t offset = y * getWidth(); |
| 280 | out << m_pixeldata[y * getWidth() + x]; | 279 | copy(m_pixeldata + offset, m_pixeldata + offset + getWidth(), ostream_iterator<uint8_t>(out)); |
| 281 | out << "\"," << endl; | 280 | out << "\"," << endl; |
| 282 | } | 281 | } |
| 283 | 282 | ||
| @@ -297,8 +296,8 @@ void CPixmap::dump(std::ostream& out) | |||
| 297 | cout << "[XPM Pixel Data]" << endl; | 296 | cout << "[XPM Pixel Data]" << endl; |
| 298 | for (uint32_t y = 0; y < getHeight(); y++) | 297 | for (uint32_t y = 0; y < getHeight(); y++) |
| 299 | { | 298 | { |
| 300 | for (uint32_t x = 0; x < getWidth(); x++) | 299 | uint32_t offset = y * getWidth(); |
| 301 | out << m_pixeldata[y * getWidth() + x]; | 300 | copy(m_pixeldata + offset, m_pixeldata + offset + getWidth(), ostream_iterator<uint8_t>(cout)); |
| 302 | out << endl; | 301 | out << endl; |
| 303 | } | 302 | } |
| 304 | out << endl; | 303 | out << endl; |
diff --git a/ue2/imgsynth2/cwindowsbitmap.cpp b/ue2/imgsynth2/cwindowsbitmap.cpp index ebbdd4c..ddacab9 100644 --- a/ue2/imgsynth2/cwindowsbitmap.cpp +++ b/ue2/imgsynth2/cwindowsbitmap.cpp | |||
| @@ -58,6 +58,7 @@ void CWindowsBitmap::read(std::ifstream& in) | |||
| 58 | if (m_pixeldata != NULL) | 58 | if (m_pixeldata != NULL) |
| 59 | delete[] m_pixeldata; | 59 | delete[] m_pixeldata; |
| 60 | m_pixeldata = new uint8_t[m_infoheader.biSizeImage]; | 60 | m_pixeldata = new uint8_t[m_infoheader.biSizeImage]; |
| 61 | in.seekg(m_fileheader.bfOffBits); | ||
| 61 | in.read(reinterpret_cast<char *>(m_pixeldata), m_infoheader.biSizeImage); | 62 | in.read(reinterpret_cast<char *>(m_pixeldata), m_infoheader.biSizeImage); |
| 62 | } | 63 | } |
| 63 | 64 | ||
