• Skip to site navigation
  • Skip to content
  • Skip to sidebar
  • Skip to footer
  • Go to archive page
Shadowmaster’s Lair
A light in the darkness, where everything is possible...
  • Home
  • Projects
  • About
  • Contact
  • Blog [ frontpage ]
« Previous | Index | Next »

libpng's complexity

Wednesday, December 2, 2009

libpng is a the reference implementation of the PNG file format, which has become quite popular during the last decade thanks to the benefits of lossless compression coupled with multiple storage formats — including indexed pixmaps, RGB pixmaps with optional alpha channel, or 256 grayscale colors, adding Adam7 interlacing as an option to allow displaying incomplete drafts of images before reading all the pixmap data in the stream. It also allows for some metadata such as text comments and internal timestamps, or even unknown chunks of (meta)data, allowing it to become a container format of sorts, most infamously abused by Mozilla Firefox to implement animated PNGs through a slightly modified version of the library — because lossless RGB pixmaps with alpha transparency are so cool compared to indexed pixmaps with binary opacity...

As cool as this sounds, libpng by itself is a trap for the unexperienced and/or impatient programmer, of which I fall into the latter category.

The API allows for many different applications, resulting in a convoluted interface and some poor or missing documentation for it. Reading the manual and examples included with it does not help a lot; when skimming through the header one can find some undocumented interfaces. It's a hell of flexibility that makes me feel lost in middle of a big forest without a map.

I foolishly wrote Wesnoth-TC without knowing any of this beforehand, and ended up creating a monster known as version 1.0, which is a mess of quickly crafted ugly code that breaks under big-endian platforms and leaves huge memory leaks when running on anything. I could have used a different library but I didn't have more documentation than libpng's at the time. Now that I'm preparing to release Wesnoth-TC 1.5.0 and have learned to keep away from this library, I'm turning my attention to wrapper libraries that should be hopefully much easier to work with if I just want to read and write ARGB streams from/to PNG files.

But Wesnoth-TC 1.5.0 will still use libpng, although I'll rewrite the code that uses it. Why? Because this time, It's Personal.

Posted in Software, Wesnoth at 00:35 UTC | No comments »
Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as (Linear | Threaded)
No comments
Add Comment
Standard emoticons like :-) and ;-) are converted to images.
 
 
 
« September '10 »
Mo Tu We Th Fr Sa Su
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
  • Recent posts
  • Archives
Twitter
  • @Grickit Ajax? http://is.gd/f3j4A1 hour ago
  • It's a sad thing that fontconfig's existence isn't helping me with keeping consistent font rendering rules here.21 hours ago
  • Apparently, the connectivity issues with my website have been solved...1 day ago
  • To #Wesnoth users who are looking at the Mainline Campaign Feedback forum right now: no, you aren't hallucinating.1 day ago
  • Connections to my website are still not working correctly here, even from the university's network. I guess some routing problem...1 day ago
  • My website, and nearlyfreespeech.net's blog, are still taking forever to load here. I guess I'll have my 1:30 minutes of sleep.1 day ago

Follow me

Categories
  • Frogatto
  • Hardware
  • Miscellaneous
  • Personal
  • Site updates
  • Software
  • Web browsers
  • Web design
  • phpBB
  • Wesnoth
  • Wesnoth-UMC-Dev
  • freenode
All categories
Syndication
  • XML RSS 1.0 feed
  • XML RSS 2.0 feed
  • ATOM/XML ATOM 1.0 feed
  • XML RSS 2.0 comments
Projects
  • Frogatto levels
  • Wesnoth add-ons
  • Wesnoth Team Colorizer
  • Wesnoth-UMC-Dev Registry Model
  • Shikadibot 0314
  • Miscellaneous
    • Irssi scripts
    • phpBB 3.0.x hacks
Links
  • Frogatto & Friends
  • Battle for Wesnoth
  • Wesnoth-UMC-Dev
  • Grickit’s blog
  • Turuk’s blog
  • The Monochrome
Frogatto & Friends
Serendipity PHP Weblog
Valid XHTML 1.0 Transitional
Copyright © 2006-2010 by Ignacio R. Morelle. All rights reserved. Powered by Poison Ivy/Dorset3 r5 and Serendipity.
Hosting by rewound.net and NearlyFreeSpeech.NET.
The opinions expressed herein do not represent those of any of the projects and organizations the author might be affiliated with, unless otherwise stated. The author is not responsible for the content hosted by external websites linked from this site. All software, documentation or instructions of any fashion are provided as is, and under its own license terms. Use/read/eat/drink at your own risk.