Re: How to deal with fully transparent ARGB pixels?
- From: "Frank Hileman" <frankhil@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 13 Oct 2006 09:34:36 -0700
Hello Carles,
GDI+ solves this by using pre-multiplied alpha images. The value 0x00FF0000
is impossible in pre-multiplied alpha; because of the multiplication, the
red component, or any other color channel, can never have a value greater
than the alpha component. This means if alpha is 0, all the other components
are also 0: 0x00000000. If the alpha was nearly 50% (0x7F), the red
component could not be larger: 0x7F7F0000.
You can use a non-premultiplied image as long as you take care of alpha
multiplication during your image transformation and interpolation. But the
end result to the layered window API must be pre-multiplied.
System.Drawing and GDI+ work fine on W2K with the .net framework 1.1.
http://en.wikipedia.org/wiki/Alpha_compositing
http://en.wikipedia.org/wiki/Alpha_blending
Mathematical details, in first memo on this page, "Image Compositing
Fundamentals":
http://www.alvyray.com/Memos/
Regards,
Frank Hileman
check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor
"Carles" <carles.pv@xxxxxxxxx> wrote in message
news:ucijR6r7GHA.1012@xxxxxxxxxxxxxxxxxxxxxxx
Hello,
Supposed a 3x3 ARGB (not-premultiplied RGB) bitmap where:
- Center pixel is defined as hFFFFFFFF (pure white and full opaque)
- Eight surrounding pixels are defined as h00FF0000 (pure red and full
transparent)
Now supposed we resize image to a 5x5 bitmap. A simple interpolation
method would equaly treat RGB (color) components and transparency (alpha)
component, resulting in final partialy red pixels. Considering those
surrounding pixels as red is not trascendental, as treated as black will
end up with darkened 'white' pixels.
But GDI+ seems to solve this *issue* (really does it). GDI+ gives us a
nice enlarged *white pixel*. So transparent ARGB pixels are treated in a
particular way, or secondary considerations are taken into account at time
to 'blend' image pixels.
I'm developing a little application that makes use of 'layered-winidow'
features. I start with a png image. Then I need to rotate it and stretch
it slightly. At this point, those undesired edge-pixels appear. I have the
GDI+ version, but need to get this working for W2000 too.
Well, in a few works: could someone tell me how GDI+ treats (formulas, or
give a paper link) all this?
Thanks in advance,
Carles
.
- Follow-Ups:
- Re: How to deal with fully transparent ARGB pixels?
- From: Carles
- Re: How to deal with fully transparent ARGB pixels?
- References:
- How to deal with fully transparent ARGB pixels?
- From: Carles
- How to deal with fully transparent ARGB pixels?
- Prev by Date: Re: How do I draw non-antialiased, pixel-perfect rounded rectangles?
- Next by Date: Re: How to deal with fully transparent ARGB pixels?
- Previous by thread: How to deal with fully transparent ARGB pixels?
- Next by thread: Re: How to deal with fully transparent ARGB pixels?
- Index(es):
Relevant Pages
|