Re: How to deal with fully transparent ARGB pixels?



Frank,

Thanks a lot.
I will have a look.

Carles.

"Frank Hileman" <frankhil@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> escribió en el
mensaje news:eTIv5Vu7GHA.4804@xxxxxxxxxxxxxxxxxxxxxxx
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






.



Relevant Pages

  • Re: How to deal with fully transparent ARGB pixels?
    ... GDI+ solves this by using pre-multiplied alpha images. ... resulting in final partialy red pixels. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Unknown transparency mask color -- how to?
    ... You said anything that GDI touches gives an Alpha of 100, ... pixels GDI left untouched, and thus should be transparent, now have an alpha value of 0x0, and any pixels GDI drew will ...
    (microsoft.public.vb.winapi.graphics)
  • Re: GdipCreateHBITMAPFromBitmap + PixelFormat32bppARGB
    ... The Windows bitmap specification was drawn up for Windows 3.1 ... Alpha blended bitmaps were not supported. ... The documentation for AlphaBlend function implies that Windows GDI ... an alpha channel. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Wierd problem when alpha blitting image with text in it
    ... When the shadow is faded out, ... constant alpha is applied to the whole window. ... windows can have per-pixel but cannot have any child windows. ... So this leaves me with the image pixels being however opaque they ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Near-opaque Alpha Values Fail to Retain Color on Copy
    ... The value *is* changing after you draw the copied bitmap to the graphics but ... If you run your messagebox on the bmpCopy you'll see that the copy was ... Answer those GDI+ questions with the GDI+ FAQ ... > I posted earlier about a problem with combining alpha values, ...
    (microsoft.public.dotnet.framework.drawing)