News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
slicing images
Author Message
Juergen
Member
***


Posts: 81
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
RE: slicing images

mikshaw Wrote:
I'm assuming that's from the extra channel, but I don't want to say for sure. All I know is that is a result of forcing a color depth of 3 on images that would normally be 4. (i guess maybe those numbers would be bytes, so a depth of 4 would be an image with 32-bit color?). I'm hoping to find a way to avoid having to do this....maybe I'll just not allow any 32-bit images to be loaded.

I think that the PNG (and maybe also JPG) support needs some fixing. I haven't looked into the code but I guess the Fl_Shared_Image.get method returns (obviously) an RGBA image (when the loaded image contains an alpha channel). It might work better when you use Fl_PNG_Image() instead. It is supposed to "handle color- and alpha-based transparency". (Whatever that means)

The problem is that PNG has a few different color modes:
1) indexed with 1,2,4,8 bits per pixel
2) grey with 1,2,4,8,16 bit per pixel
3) grey with alpha: 16 or 32 bit per pixel (with 8 or 16 bit alpha channel)
4) RGB with 8 or 16 bits per channel this makes 24 or 48 bits per pixel
5) RGBA with 8 or 16 bits per channel this makes 32 or 64 bits per pixel

When this raw RGB(A) data is handled the pixel and channel size has to taken into account, when the memeroy is reserved and also (obviously) when the individual pixels accessed. I haven't looked into the sources, but I guess that gettiles() just assumes a pixel size of 3 bytes. Then you would get ecactly the effect that you can see. When gettiles scans the RGBA values you can see that alternating one of the RGB values is blanked out, because in memory it looks like RGB0RGB0RGB0RGB0.... which is then scanned as RGB,0RG,B0R,GB0,RGB,....

mikshaw Wrote:
Another potential segfault can be seen when increasing the size and number of tiles. This is another mystery to me.

If the C/C++ code makes wrong assumptions about the pixel size, most likely it tries to access a memory location which is not backed by physical memory, which will result in a segmentation fault. Even if the program accessed a wrong address it is not necessary that a segmentation fault occures. There are up to 4095 bytes after the last valid address it can access, before a segfault occures. It is even possible that valid addresses, used by other objects follow, so even if something goes wrong, it may go unnoticed under some conditions and under some others not.
(If you want, I can elaborate it a little more.)

Juergen

02-27-2008 04:42 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
slicing images - mikshaw - 01-26-2008, 06:28 AM
RE: slicing images - JohnMurga - 01-26-2008, 08:48 AM
RE: slicing images - mikshaw - 01-26-2008, 08:51 AM
RE: slicing images - JohnMurga - 01-27-2008, 06:38 AM
RE: slicing images - mikshaw - 01-27-2008, 07:26 AM
RE: slicing images - mikshaw - 02-25-2008, 05:49 AM
RE: slicing images - iGame3D - 02-25-2008, 08:08 AM
RE: slicing images - mikshaw - 02-25-2008, 12:22 PM
RE: slicing images - iGame3D - 02-25-2008, 07:15 PM
RE: slicing images - iGame3D - 02-25-2008, 07:31 PM
RE: slicing images - iGame3D - 02-25-2008, 08:15 PM
RE: slicing images - mikshaw - 02-25-2008, 10:26 PM
RE: slicing images - mikshaw - 02-26-2008, 04:47 AM
RE: slicing images - iGame3D - 02-26-2008, 06:22 AM
RE: slicing images - mikshaw - 02-26-2008, 10:41 PM
RE: slicing images - Juergen - 02-27-2008 04:42 AM
RE: slicing images - iGame3D - 02-27-2008, 05:53 AM
RE: slicing images - iGame3D - 02-27-2008, 06:30 AM
RE: slicing images - mikshaw - 02-27-2008, 07:08 AM
RE: slicing images - mikshaw - 02-27-2008, 07:18 AM
RE: slicing images - iGame3D - 02-27-2008, 07:52 AM
RE: slicing images - JohnMurga - 02-27-2008, 08:04 AM
RE: slicing images - JohnMurga - 02-27-2008, 08:28 AM
RE: slicing images - mikshaw - 02-27-2008, 08:31 AM
RE: slicing images - Juergen - 02-27-2008, 09:41 AM
RE: slicing images - mikshaw - 02-27-2008, 12:40 PM
RE: slicing images - iGame3D - 02-27-2008, 03:04 PM
RE: slicing images - mikshaw - 02-27-2008, 11:51 PM
RE: slicing images - Juergen - 02-28-2008, 03:50 AM
RE: slicing images - iGame3D - 02-28-2008, 04:22 AM
RE: slicing images - Juergen - 02-28-2008, 04:30 AM
RE: slicing images - mikshaw - 02-28-2008, 04:55 AM
RE: slicing images - iGame3D - 02-28-2008, 07:23 AM
RE: slicing images - mikshaw - 02-28-2008, 08:04 AM
RE: slicing images - JohnMurga - 02-28-2008, 08:43 AM
RE: slicing images - iGame3D - 02-28-2008, 03:41 PM
RE: slicing images - mikshaw - 02-28-2008, 07:29 PM
RE: slicing images - iGame3D - 02-29-2008, 05:29 AM
RE: slicing images - mikshaw - 02-29-2008, 05:42 AM
RE: slicing images - iGame3D - 02-29-2008, 04:16 PM
RE: slicing images - mikshaw - 02-29-2008, 11:36 PM
RE: slicing images - Juergen - 03-01-2008, 04:27 AM
RE: slicing images - mikshaw - 03-01-2008, 06:57 AM
RE: slicing images - mikshaw - 03-01-2008, 09:20 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: