Hi, I'm having some trouble understanding the blending rules for the cases of DSBLIT_SRC_PREMULTIPLY, DSBLIT_SRC_PREMULTCOLOR, etc.
Looking at wm/default/default.c function draw_window, it says something like as follows: if (DFB_PIXELFORMAT_HAS_ALPHA( state->destination->format )) { /* * Always use compliant Porter/Duff SRC_OVER, * if the destination has an alpha channel. * * Cd = destination color (non-premultiplied) * Ad = destination alpha * * Cs = source color (non-premultiplied) * As = source alpha * * Ac = color alpha * * cd = Cd * Ad (premultiply destination) * cs = Cs * As (premultiply source) * * The full equation to calculate resulting color and alpha (premultiplied): * * cx = cd * (1-As*Ac) + cs * Ac * ax = Ad * (1-As*Ac) + As * Ac */ dfb_state_set_src_blend( state, DSBF_ONE ); /* Need to premultiply source with As*Ac or only with Ac? */ if (! (window->surface->caps & DSCAPS_PREMULTIPLIED)) flags |= DSBLIT_SRC_PREMULTIPLY; else if (flags & DSBLIT_BLEND_COLORALPHA) flags |= DSBLIT_SRC_PREMULTCOLOR; } Is the equation mentioned above to calculate the resulting color and alpha values i.e. cx = cd * (1-As*Ac) + cs * Ac ax = Ad * (1-As*Ac) + As * Ac Can somebody let me know what is Ac i.e. where do we get its value from? I've some more basic questions: 1. Do 'As' and 'Ad' correspond to individual pixel alpha values in source and destination surface pixels? 2. What if the source surface pixel format doesnt have alpha component at all? In such case, what would 'As' map to? -- --------------- Thanks Amarinder
_______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users