On Wed, Jul 28, 2010 at 12:41 PM, Brian Wang <brian.wang.0...@gmail.com> wrote:
> On Wed, Jul 28, 2010 at 11:54 AM, Carsten Haitzler <ras...@rasterman.com>
> wrote:
>> On Wed, 28 Jul 2010 11:49:06 +0800 Brian Wang <brian.wang.0...@gmail.com>
>> said:
>>
>>> On Wed, Jul 28, 2010 at 7:55 AM, Carsten Haitzler <ras...@rasterman.com>
>>> wrote:
>>> > On Wed, 14 Jul 2010 18:22:24 +0800 Brian Wang <brian.wang.0...@gmail.com>
>>> > said:
>>> >
>>> > unfortunately this breaks loading of images from a bmp test suite i have.
>>> > (as such evas's loader loads more files correctly than gqview can). images
>>> > that break are attached.
>>>
>>> I have tested the broken image. I guess you mean they're "invisible"
>>> with my patch?
>>> GIMP can load them correctly. I briefly browsed GIMP's bmp plug-in
>>> code but could not find how it determines the correct alpha mask for
>>> 32-bit BMP. I could not find relevant specification about ARGB 32-bit
>>> BMP in BMP v3 specification. Without proper reference, I can only
>>> come up with a workaround... Any BMP wizards here?
>>>
>>> However, I think the attached patch does the trick. It first sets
>>> hasa flag and if all pixels are transparent (I guess it's an
>>> uninteresting/useless image if the user can't see any pixel of it), it
>>> set the Image_Entry's alpha flag to zero.
>>>
>>> g32def.bmp, g32bf.bmp and the attached Icon.bmp can all be loaded
>>> properly. Any more interesting BMPs? :-)
>>>
>>> Thanks for looking into this.
>>
>> well i wrote the bmp loader based off specifications (and reading the old
>> bmp loader in imlib2)... i literally spent a while reading them... so...
>> you'll
>> have to figure out what i got wrong in handling the spec... or... what is
>> missing from the spec that gimp uses :) but your modified patch smells of
>> being
>> pretty hacky to me as a fully alpha image is valid - how many
>> blank/transparent
>> gifs are there around the internet for doing filling/spacing? :)
>
> Definitely hacky as it's a workaround instead of a proper fix. :-)
> I haven't thought about using fully alpha images as spacers and yes,
> it's a valid one.
>
> I'll just keep the patch private for now since I'm working on a tight
> schedule for my EFL-based device. :-)
> Hopefully, I can find bits of time here and there to properly fix the issue.
>
> A side note: I've tested your images with SDL_Image-1.2.5. g32def.bmp
> fails to show up as well.
> Only GIMP properly shows both of your images and Icon.bmp.
Quoted from the bug report of GIMP:
"Implements solution to use the alpha channel if and only if a bitmap contains
at least one non-zero value as suggested by Raphaël Quinet."
Here's some interesting reads:
http://www.gimpusers.com/forums/gimp-developer/5786-32bit-BMP-appear-blank.html
https://bugzilla.gnome.org/show_bug.cgi?id=352262
(See Comment #24 way down below)
The same code still exists in the current GIMP git:
http://git.gnome.org/browse/gimp/tree/plug-ins/file-bmp/bmp-read.c?h=gimp-2-6
(See Line 694-727)
So, hacky but valid fix? :-)
I've attached another patch to handle the other 32-bit case.
brian
>
> Cheers,
>
>
> brian
>
>
>>
>>> brian
>>>
>>> >
>>> >> Hello all,
>>> >>
>>> >> GIMP (2.6.8) seems to save 32-bit BMP in the "Windows 3.0 + (v3)"
>>> >> format mentioned in evas_image_load_bmp.c.
>>> >> I'm not sure if the patch breaks anything (or images created by other
>>> >> tools). Please correct it if you see fit.
>>> >> This patch should enable support for ARGB BMP files for evas. It's
>>> >> tested on my x86 box.
>>> >>
>>> >> Cheers,
>>> >>
>>> >>
>>> >> brian
>>> >>
>>> >> --
>>> >> brian
>>> >> ------------------
>>> >>
>>> >> Cool-Karaoke - The smallest recording studio, in your palm, open-sourced
>>> >> http://cool-idea.com.tw/
>>> >>
>>> >> iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe
>>> >
>>> >
>>> > --
>>> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
>>> > The Rasterman (Carsten Haitzler) ras...@rasterman.com
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> brian
>>> ------------------
>>>
>>> Cool-Karaoke - The smallest recording studio, in your palm, open-sourced
>>> http://cool-idea.com.tw/
>>>
>>> iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe
>>
>>
>> --
>> ------------- Codito, ergo sum - "I code, therefore I am" --------------
>> The Rasterman (Carsten Haitzler) ras...@rasterman.com
>>
>>
>
>
>
> --
> brian
> ------------------
>
> Cool-Karaoke - The smallest recording studio, in your palm, open-sourced
> http://cool-idea.com.tw/
>
> iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe
>
--
brian
------------------
Cool-Karaoke - The smallest recording studio, in your palm, open-sourced
http://cool-idea.com.tw/
iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe
Index: evas/src/modules/loaders/bmp/evas_image_load_bmp.c
===================================================================
--- evas/src/modules/loaders/bmp/evas_image_load_bmp.c (revision 50528)
+++ evas/src/modules/loaders/bmp/evas_image_load_bmp.c (working copy)
@@ -148,6 +148,7 @@
if (!read_int(f, &tmp2)) goto close_file;
important_colors = tmp2; // number of important colors - 0 if all
if (image_size == 0) image_size = fsize - offset;
+ if (bit_count == 32) hasa = 1;
}
else if (head_size == 108) // Windows 95/NT4 + (v4)
{
@@ -943,7 +944,7 @@
g = p[1];
r = p[2];
a = p[3];
- if (!hasa) a = 0xff;
+ if (a) hasa = 1;
*pix = ARGB_JOIN(a, r, g, b);
p += 4;
if (p >= buffer_end) break;
@@ -953,6 +954,7 @@
if (fix > 0) p += 4 - fix; // align row read
if (p >= buffer_end) break;
}
+ ie->flags.alpha = hasa;
}
else
goto close_file;
@@ -1039,7 +1041,7 @@
g = p[1];
r = p[2];
a = p[3];
- if (!hasa) a = 0xff;
+ if (a) hasa = 1;
*pix = ARGB_JOIN(a, r, g, b);
p += 4;
if (p >= buffer_end) break;
@@ -1049,6 +1051,7 @@
if (fix > 0) p += 4 - fix; // align row read
if (p >= buffer_end) break;
}
+ ie->flags.alpha = hasa;
}
else
goto close_file;
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel