Am 07.06.11 21:11 schrieb(en) Oliver Eichler:
Am 07.06.2011 20:55, schrieb Albrecht Dreß:
There is only one little problem - in my big endian boxes, gdal_translate 
downloads proper images e.g. for the Bavarian server, but when I open the xml with 
file->open, the colours are shifted. Probably an endianess issue - before 
digging through the sources: Oliver, where is the input processed, so I can try to 
fix this?

Imho this is less an endian problem more a version problem between GDAL 1.6.x. 
and 1.7.x The have changed the enumeration for colors. But have a look on your 
own:

It actually *is* an endianess problem - I saw the issue on OS X Intel (works) 
vs. PPC (doesn't, same on Linux/PPC), and all use the same gdal version (1.8.0).

I think your code basically assumes that the 4-byte RGBA value (uint32_t) has a 
certain byte order when the four uint8_t band values are written directly to 
the memory region (the offsets aren't documented by Qt, btw.).  Apparently, the 
underlying Qt code interprets them as uint32_t, though, which explains the 
observation.

The attached trivial fix solves the WMS issue for me, no idea if it has other 
harmful effects.  The *really* clean (but *really* slow) way is probably to 
read all four bands and to construct qrgba() pixels.

Best,
Albrecht.
Index: src/CMapGeoTiff.cpp
===================================================================
--- src/CMapGeoTiff.cpp	(Revision 2818)
+++ src/CMapGeoTiff.cpp	(Arbeitskopie)
@@ -332,6 +332,9 @@ void CMapGeoTiff::draw()
 
                         if(offset >= 0 && offset <= 3)
                         {
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+                            offset = 3 - offset;
+#endif
                             quint8 * pTar   = img.bits() + offset;
                             quint8 * pSrc   = buffer.data();
                             const int size  = buffer.size();

Attachment: pgpEKRrw0KArf.pgp
Description: PGP signature

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Qlandkartegt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users

Reply via email to