Diffstat (limited to 'noncore/apps/opie-reader/Palm2QImage.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Palm2QImage.cpp | 64 |
1 files changed, 22 insertions, 42 deletions
diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp index b0d4e00..c1b7b7a 100644 --- a/noncore/apps/opie-reader/Palm2QImage.cpp +++ b/noncore/apps/opie-reader/Palm2QImage.cpp | |||
@@ -1,10 +1,3 @@ | |||
1 | /* -*- mode: c; indent-tabs-mode: nil; -*- */ | 1 | /* -*- mode: c; indent-tabs-mode: nil; -*- */ |
2 | 2 | #include "useqpe.h" | |
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | |||
6 | /* QT */ | ||
7 | #include <qimage.h> | ||
8 | |||
9 | /* STD */ | ||
10 | #include <stdio.h> | 3 | #include <stdio.h> |
@@ -19,2 +12,3 @@ | |||
19 | 12 | ||
13 | #include <qimage.h> | ||
20 | 14 | ||
@@ -150,5 +144,3 @@ QImage* Palm2QImage | |||
150 | #if 0 | 144 | #if 0 |
151 | // odebug << "Palm image is " << width << "x" << height | 145 | // qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); |
152 | // << ", " << bits_per_pixel << " bpp, version " << version | ||
153 | // << ", flags 0x" << flags << ", compression " << compression_type << oendl; | ||
154 | #endif | 146 | #endif |
@@ -156,3 +148,3 @@ QImage* Palm2QImage | |||
156 | if (compression_type == PALM_COMPRESSION_PACKBITS) { | 148 | if (compression_type == PALM_COMPRESSION_PACKBITS) { |
157 | // odebug << "Image uses packbits compression; not yet supported" << oendl; | 149 | // qDebug ("Image uses packbits compression; not yet supported"); |
158 | return NULL; | 150 | return NULL; |
@@ -161,3 +153,3 @@ QImage* Palm2QImage | |||
161 | (compression_type != PALM_COMPRESSION_SCANLINE)) { | 153 | (compression_type != PALM_COMPRESSION_SCANLINE)) { |
162 | // odebug << "Image uses unknown compression, code 0x" << compression_type << oendl; | 154 | // qDebug ("Image uses unknown compression, code 0x%x", compression_type); |
163 | return NULL; | 155 | return NULL; |
@@ -179,3 +171,3 @@ QImage* Palm2QImage | |||
179 | if (flags & PALM_HAS_COLORMAP_FLAG) { | 171 | if (flags & PALM_HAS_COLORMAP_FLAG) { |
180 | // odebug << "Palm images with custom colormaps are not currently supported." << oendl; | 172 | // qDebug("Palm images with custom colormaps are not currently supported.\n"); |
181 | return NULL; | 173 | return NULL; |
@@ -198,6 +190,5 @@ QImage* Palm2QImage | |||
198 | palm_blue_bits = palmimage[18]; | 190 | palm_blue_bits = palmimage[18]; |
199 | // odebug << "Bits:" << palm_red_bits << ", " << palm_green_bits << ", " << palm_blue_bits << oendl; | 191 | // qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); |
200 | if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { | 192 | if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { |
201 | // odebug << "Can't handle this format DirectColor image -- too wide in some color (" | 193 | // qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits); |
202 | // << palm_red_bits << ":" << palm_green_bits << ":" << palm_blue_bits << oendl; | ||
203 | return NULL; | 194 | return NULL; |
@@ -205,4 +196,3 @@ QImage* Palm2QImage | |||
205 | if (bits_per_pixel > (8 * sizeof(unsigned long))) { | 196 | if (bits_per_pixel > (8 * sizeof(unsigned long))) { |
206 | // odebug << "Can't handle this format DirectColor image -- too many bits per pixel (" | 197 | // qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); |
207 | // << bits_per_pixel << ")" << oendl; | ||
208 | return NULL; | 198 | return NULL; |
@@ -211,3 +201,3 @@ QImage* Palm2QImage | |||
211 | } else { | 201 | } else { |
212 | // odebug << "Unknown bits-per-pixel of " << bits_per_pixel << " encountered" << oendl; | 202 | // qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); |
213 | return NULL; | 203 | return NULL; |
@@ -226,4 +216,3 @@ QImage* Palm2QImage | |||
226 | for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { | 216 | for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { |
227 | // odebug << "inval:" << inval << " palm_ptr:" << palm_ptr << " x_ptr:" << x_ptr | 217 | // qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); |
228 | // << " bpr:" << bytes_per_row << oendl; | ||
229 | 218 | ||
@@ -257,8 +246,8 @@ QImage* Palm2QImage | |||
257 | else { | 246 | else { |
258 | odebug << "Case 4" << oendl; | 247 | qDebug("Case 4"); |
259 | odebug << "Is compressed:" << (((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true") << oendl; | 248 | qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); |
260 | odebug << "Has colourmap:" << (((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true") << oendl; | 249 | qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); |
261 | odebug << "Has transparency:" << (((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true") << oendl; | 250 | qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); |
262 | odebug << "Direct colour:" << (((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true") << oendl; | 251 | qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); |
263 | odebug << "four byte field:" << (((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true") << oendl; | 252 | qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); |
264 | memcpy (rowbuf, palm_ptr, bytes_per_row); | 253 | memcpy (rowbuf, palm_ptr, bytes_per_row); |
@@ -289,6 +278,7 @@ QImage* Palm2QImage | |||
289 | /* | 278 | /* |
290 | odebug << "pixel is " << j << "," << i << " (" | 279 | qDebug ("pixel is %d,%d (%d:%d:%d)", |
291 | << (((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits)) << ":" | 280 | j, i, |
292 | << (((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits)) << ":" | 281 | ((inval >> (bits_per_pixel - palm_red_bits)) & ((1 << palm_red_bits) - 1)) << (8-palm_red_bits), |
293 | << (((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)) << ")" << oendl; | 282 | ((inval >> palm_blue_bits) & ((1 << palm_green_bits) - 1)) << (8-palm_green_bits), |
283 | ((inval >> 0) & ((1 << palm_blue_bits) - 1)) << (8-palm_blue_bits)); | ||
294 | */ | 284 | */ |
@@ -309,11 +299 @@ QImage* Palm2QImage | |||
309 | } | } | |
310 | |||
311 | QImage* hRule(int w, int h, unsigned char r, unsigned char g, unsigned char b) | ||
312 | { | ||
313 | // odebug << "hrule [" << w << ", " << h << "]" << oendl; | ||
314 | QPixmap* qimage = new QPixmap(w, h); | ||
315 | qimage->fill(QColor(r,g,b)); | ||
316 | QImage* ret = new QImage(qimage->convertToImage()); | ||
317 | delete qimage; | ||
318 | return ret; | ||
319 | } | ||