Re: Question on gdk-pixbuf



Loban Rahman <loban@enigma.caltech.edu> writes:
> I've got a quick question. What's a good way of compositing a pixbuf A
> onto a pixbuf B using pixbuf C as an alpha mask, resulting with a pixbuf
> D? A and C are color pixbuf's with alpha channels. C is a greyscale pixbuf.
> 
> I've been reading the gdk_pixbuf documentation, but I'm a bit muddled.
> 

Well, it's not like this is going to be documented, since it's a
pretty weird thing to do. ;-)

One thing: does gdk-pixbuf support grayscale? Or do you just mean all
your RGB pixels have R == G == B?

Basically you want to make a copy of pixbuf A, then iterate over the
pixels of C and modify the alpha of the copy of A according to the
intensity of the pixels in C, then composite the modified-alpha
version of A onto B. If you want a separate pixbuf D, then copy B
first to create D, then composite A onto D instead of onto B.

Havoc




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