Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Pixelblending mit Alphawert (https://www.delphipraxis.net/145515-pixelblending-mit-alphawert.html)

turboPASCAL 3. Jan 2010 14:28


Pixelblending mit Alphawert
 
Hi,

ich habe ein klitze kleines Problem. Wie berechne ich ein Pixelblending mit Alphawert ?

jakobwenzel 3. Jan 2010 14:46

Re: Pixelblending mit Alphawert
 
pZusammen = p1 * alpha + p2 * (1-alpha)

p1 ist der Pixel mit Alphawert, p2 der Hintergrund

turboPASCAL 3. Jan 2010 14:57

Re: Pixelblending mit Alphawert
 
Ja, genau danke.

SirThornberry 3. Jan 2010 15:23

Re: Pixelblending mit Alphawert
 
das von jakobwenzel funktioniert übrigens nur wenn der Alphawert einen Wert <= 1 hat.
Bei TBitmap wo der Alphakanal aus 8 Bit besteht wäre anstelle von 1 also 255 zu verwenden.

himitsu 3. Jan 2010 15:52

Re: Pixelblending mit Alphawert
 
die 1 (für 100%) stimmt in diesem Falle schon

0.0 >= alpha > 1.0
pZusammen = p1 * alpha + p2 * (1 - alpha)

0 >= alpha > 255
pZusammen = (p1 * alpha div 255) + (p2 * (255 - alpha) div 255)


PS: Berechnung für jeden Farbkanal der Pixel einzeln ... das sollte wohl bekannt sein?


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:07 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz