nanogui: Images not drawn (FLTK+nxlib app with nano-X)


Previous by date: 9 Feb 2006 18:40:04 +0000 Re: Images not drawn (FLTK+nxlib app with nano-X), Martin Kajdas
Next by date: 9 Feb 2006 18:40:04 +0000 displaying texts/fonts, Robbie
Previous in thread: 9 Feb 2006 18:40:04 +0000 Re: Images not drawn (FLTK+nxlib app with nano-X), Martin Kajdas
Next in thread: 9 Feb 2006 18:40:04 +0000 Re: Images not drawn (FLTK+nxlib app with nano-X), Greg Haerr

Subject: RE: [nanogui] Images not drawn (FLTK+nxlib app with nano-X)
From: "Martin Kajdas" ####@####.####
Date: 9 Feb 2006 18:40:04 +0000
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC22914CE@mkmail.MKPROD.COM>

Here is my fix:

--- nxutil.c.org	2006-01-06 13:38:08.000000000 +0000
+++ nxutil.c	2006-02-09 10:37:44.977689992 +0000
@@ -176,8 +176,15 @@
 		inbuf += (bits_width + 7) / 8 - (width + 7) / 8;
/* FIXME */
 
 		/* pad to 16 bits */
-		if (xb & 1)
-			*p++ = 0;
+		if (xb & 1) {
+			unsigned char c = *(p-1);
+			if (bswap) {
+				*(p-1) = 0;
+				*p++ = c;
+			} else {
+				*p++ = 0;
+			}
+		}
 	}
 	return buf;
 }


It works for my 24x24 image but I am not sure if it will work for every
case (i.e. 23x23, 25x25, 1x1, 9x9, ...)
Testing (or better understanding of the algorithm) is required.

Martin

-----Original Message-----

I think I found it.

In the function nxutil.c::GrNewBitmapFromData(), there is a 'bswap'
variable that forces byte swap.
For any even number of bytes, the byte swap occurs, but if there is any
left over byte, the byte swap does not occur.
Then, when the GrNewRegionFromPixmap is called, the last byte (not being
swapped) is 0 (wrong byte) and therefore clipped.

I did not figure out how to fix this yet, but maybe you can help.
Martin

Previous by date: 9 Feb 2006 18:40:04 +0000 Re: Images not drawn (FLTK+nxlib app with nano-X), Martin Kajdas
Next by date: 9 Feb 2006 18:40:04 +0000 displaying texts/fonts, Robbie
Previous in thread: 9 Feb 2006 18:40:04 +0000 Re: Images not drawn (FLTK+nxlib app with nano-X), Martin Kajdas
Next in thread: 9 Feb 2006 18:40:04 +0000 Re: Images not drawn (FLTK+nxlib app with nano-X), Greg Haerr


Powered by ezmlm-browse 0.20.