[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alpha blit question



On Tue, 14 Apr 1998, Sam Lantinga wrote:

> > You may also want to think about whether you need to
> > do anything special to "support" premultiplied alpha *and* non-
> > premultiplied alpha.
> 
> I thought that the alpha component had to be multiplied by both
> the source and destination pixels.  ??

Well, yes, and no.  If the alpha mask is going to be constant, and the
dest is going to be constant, then you can prescale the dest and save
yourself a multiply per pixel.

btw:  I've seen three people all publish

	d = a*d + (1-a)*s

for their alpha blenders, but simple algebra gives:

	d = a*(d - s) + s

but you knew that...

njh