Around 22 o'clock on May 30, Olivier Chapuis wrote:
> the program draw 11 times "Hello World" with the fg color and with
> an alpha of 0xffff * (100 - i*10) / 100
Render uses premultiplied alpha; you're program is getting the "correct"
results, but it's not what you expected.
For normal compositing, you'll want to have your RGB values between 0 and
alpha, in the sample you sent, do:
XftColor fg;
fg.color.red = xft_fg->color.red * (100 - i*10) / 100;
fg.color.green = xft_fg->color.green * (100 - i*10) / 100;
fg.color.blue = xft_fg->color.blue * (100 - i*10) / 100;
fg.color.alpha = xft_fg->color.alpha * (100 - i*10) / 100;
fprintf(stderr,"ALPHA: 0x%x\n", fg.color.alpha);
#if 1
XftDrawString8(xftdraw, &fg, xftfont,
Now all of the components are scaled correctly and the result works as you
expected.
Premultiplied alpha is a bit confusing, but it's "the one true way",
providing a simpler underlying definition of the functions and avoiding
some undefined operation results.
Keith Packard XFree86 Core Team HP Cambridge Research Lab
_______________________________________________
Render mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/render