On Sun, Nov 29, 2009 at 11:34, Tgr <gtisza(a)gmail.com> wrote:
Aryeh Gregor <Simetrical+wikilist <at>
gmail.com> writes:
As far as I know, the only thing actually
blocking us from doing this
was something like IE5 on Mac printing transparent images with black
backgrounds. That's probably not relevant anymore. We're still stuck
with the fact that IE6 doesn't support alpha channels, though -- we
could make the fully-transparent parts of the background transparent,
but I don't see how we could avoid aliasing effects on sane browsers
without making things look extremely ugly on IE6.
You could use PNG8 with a color palette where every color is black, with a
variable level of transparency. That would be equivalent to full PNG32 alpha
transparency in modern browsers (as long as the only color used in the formulas
is black), while IE5.5/6 would have binary transparency without any aliasing -
ugly but probably not horrible. (See
http://www.v-methods.com/ji/palette_alpha.html for a demonstration.)
Hey, that is something!
I thought of this possibility for using tRNS chunk with 8-bit black
PNG. But I discarded the idea because I didn't see a way for this to
work with black background in custom styles.
Now it appeared to me that by a simple change to any style featuring
black background we can overcome this last problem. Just put this
line in the style and it'll work like before:
img.tex { background-color: white; }
So, to sum it up:
1. Make PNGs for TeX formulas be of 8-bit indexed colors format with
tRNS chunk added.
The palette should contain all black pixels, except for single
reserved color which should be white (see below), i.e:
| Index | Color | tRNS |
| 0 | FF FF FF | 0 |
| 1 | 00 00 00 | 1 |
| 2 | 00 00 00 | 2 |
...
| 255 | 00 00 00 | 255 |
2. Add bKGD chunk containing the index of white color in palette (0).
This should make the image sensible for viewers other than browsers.
3. Modify currently used custom black style(s) to underlay white
background for TeX-only images as described above.
4. Document the change, make people prepared for it. :)
This seems to me like a comprehensible change which should make sense
to every browser (needs to be tested, though).
If everyone agrees on implementing this change you can count on me to
hack the low-level PNG-related stuff. :) We can try to hack dvipng to
add a new option for this or post-process the dvipng output, etc.
I'd really like to see this happen. Who is with me?
Or you could just send different images to IE6, for
example by using empty divs
with background images instead of img tags, and changing the image URL for IE6
with the star-html CSS hack. (Not very accessible, but maybe the text of the
formula could be written into the div with overflow:hidden?)
This option looks error-prone and adds too much difficulty, IMHO.
--
Cheers!
Alex