DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2353 Version: 2.0-feature I'm not sure I'm not just talking into an echo chamber here, but here goes. This is in fl_png.cxx.. --------> if (datas) { if (png_sig_cmp((uchar*)datas, (png_size_t)0, 8)) goto error; } else { uchar buf[8]; if (fread(buf, 1, 8, fp) != 8 || png_sig_cmp(buf, (png_size_t)0, 8)) goto error; png_init_io(png_ptr, fp); png_set_sig_bytes(png_ptr, 8); } <--------- Know what it means? It means that we should be able to read directly from embedded png image data in memory without having to open a file same as we do with pixmaps. Don't believe me. Let's go fishing for more proof. This is in fetch. png_set_read_fn(png_ptr, cur_datas, read_data_fn); That sets the 'read_data_fn' up so that it can uncompressed png file data that is stored in (unfortunately) a variable with the same name: "datas" that we use for storing pixels. So how hard would it be to fix? EZ. For starters we need to create a method symetrical with the xpmImage syntax for loading from memory, then we set a variable that has is properly named (or properly private, like in a parameter list) and test for that instead of having it an optional argument to "get" which can never be used because when name is null, it immediately returns... and no problem there! We'd be better of duplicating the xpmImage syntax because it would be easier to remember anyway. THIS IS SCARY STUFF!! Because if I do that, and I forget that I've done it, my system will be non-standard and if I accidentally share files with you or anyone else, they may work here -- or there, if the other person makes the same mods, but if our code gets folded into the official releases, everything will get all tangled up into a wonderful mystery... "What's it all mean?" ."""-. / \ | _..--'-. >.`__.-"";"` / /( ^\ '-`) =|-. /`--.'--' \ .-. .'`-._ `.\ | J / jgs / `--.| \__/ ;-) So many times, I've started out to write what I thought were missing features only to find they already exist, and are better than what I had planned, or in this case, a bad variable name killed pngImage loading from memory. I found this while trying to figure out why SharedImage is misreporting the size of an image I was trying to load into my main window icon. I WILL FIX MINE. And I'll pass you the code when it's done but what's done with it at your end is up to you. I have no control over that, nor do I want any. Still with me? Version 2 rocks. It's so tightly integrated that problems in one area often affect others in unexpected ways. Small problems. Like a duplicate name. And as a result the Widget class size (for example) is about half the size of an Fl_Widget and can do lots more. TIP OF THE DAY: Cast a Symbol to an rgbImage some day. :-) Like this. rgbImage* im = (rgbImage*) w->image(); w->image() returns a Symbol. Very confusing, no? If you don't cast w->image() to an image it will leave you with the odd and mysterious error: "Hey! Whatcha doin' bwah! You can't assign a Symbol to an rgbImage." But... oh, yes you can. Symbol is the base class for both labels and images. (Think about THAT for a moment!) So if you are used to casting an Fl_Image to an Fl_RGB_Image, for example, in V 2, you now do that with symbols. I suppose that's probably in 'TFM' somewhere but I never 'R' that stuff. The End. :-) [PS. The new 'datas' variable will have to be set AND cleared like a flag, even if there are errors. That's probably where things got fouled up in the first place. Didn't clear the variable. Just a guess... but the fix is on the way. Probably tomorrow some time. Just imported the mods from last week into my FLTK2, but I'll pick up "current version" sometime in the relatively short future.] Link: http://www.fltk.org/str.php?L2353 Version: 2.0-feature _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
