W3C home > Mailing lists > Public > www-style@w3.org > May 2006

Re: proposal: background-image-alpha

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Sun, 07 May 2006 23:09:52 -0700
To: "www-style.w3.org" <www-style@w3.org>, Emrah BASKAYA <emrahbaskaya@hesido.com>
Message-id: <00bc01c67266$0500d890$3401a8c0@TERRA>

Hi, Emrah,

----- Original Message ----- 
From: "Emrah BASKAYA" <emrahbaskaya@hesido.com>
To: "www-style.w3.org" <www-style@w3.org>

First of all PNG supports 16 bit per channel, so there is also PNG64
Also it supports for example 16 bit grayscale + 16 bit alpha-channel 
configuration

>
> Sorry if this was mentioned, but I hereby propose the following property:
> background-image-alpha: <alpha-image> || <image-alpha-type> || <opacity>
>
> Proposed Idea:
> This will allow designers to use a seperate grayscale image / opacity 
> value for alpha used as means of defining opacity of the image / color 
> defined in background. Color images would be converted to grayscale with a 
> standardized algorithm.
>
> The obvious advantage from PNG32 would be abstraction:
> *Ability to use different kinds of formats for defining alpha (e.g. jpg 
> for background image, gif for alpha)

Lets limit ourselves for the second by JPEG, GIF and PNG only.
The only useful combination here: PNG on background and PNG as alpha.
Reasons: 1) GIF does not support grayscale (needed to serve alpha mask 
purpose)
2) JPEG is not suitable for alpha mask purpose because of its lossy 
encoding -
being combined with another image will create artifacts.

So the only option is PNG/PNG. Why not use single PNG16/32/64 then?

> *Using different bit depths for image and alpha (e.g. 5bit foreground 
> image, 3bit alpha)

3bit alpha is rather theoretical than practical I think.

GIF has 1bit alpha and PNG supports 8/16bit alpha - for practical cases
this is enough I believe.

> *Alpha on a color background instead of an image, hence the ability use 
> different colors with same alpha.

grayscale PNG image with alpha channel can serve this purpose pretty well I 
think.

> *Using the same alpha for different images.
> *Using the same images for different alpha.
>
> Instead of an image or together with an image, one can use a constant 
> opacity value, with the obvious advantage of:
> *Not effecting foreground text opacity, without using extra elements.
> *And some of the previous abstraction advantages mentioned previously.
>
> Proposed syntax:
> background-image-alpha: <alpha-image> || <image-alpha-type> || <opacity>
>
> 'alpha-image'
>   value: <uri> | none | inherit
>   initial: none
>
> 'image-alpha-type'
>   value: no-pre-mutiply | pre-multiply-black | pre-multiply-white
>   inital: no-pre-multiply
>   description: This value can be used to apply transparency for 
> pre-multiplied images without color shifting when the image used for 
> background is on a black or white background.
>
> 'opacity'
>   value: <alphavalue> | inherit
>   initial: 1
>

Another idea: to introduce foreground-* attributes similar to
background-* attributes. So element could have two images
if needed. This will also solve your case but will give significantly more.
foreground-* will be drawn on the same layer as 'outline' currently.

Andrew Fedoniouk.
http://terrainformatica.com
Received on Monday, 8 May 2006 07:09:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:45 GMT