|
[Woop I might have accidentally sent this without the file. Sorry, if
you get two of these emails.] Still getting up to speed, but I think my system is diverging from the norm about now. The changes I can remember are listed at the bottom. Got this... ![]() This is with one brown gradient drawn by fltk mixed on a black background with alpha = 255 to 0 (linear) with a SVG exported alpha drawing 'add'ed on top. The white borders of the windows are alpha=255 and the turquoise filled area is from the SVG image with transparency gradient. It looks right or that color of background(s). Still testing, but here's how we do it... // This is in currently in my fl_draw_image.cxx and will be rewritten in ASM when // it's fully tested. --> // H void visit_fl_draw_image(){} // for little-endian typedef union { struct{ uchar red; uchar green; uchar blue; uchar alpha; }byte; uint rgba; void* cref; }Rs_ABGR; // C++ static void xrgb_converter(const uchar *from, uchar *to, int w, int delta) { // intel 386 -rs // INNARDS32((from[0]<<16)+(from[1]<<8)+(from[2])); Rs_ABGR* psrc = (Rs_ABGR*)from; Rs_ABGR* pdest = (Rs_ABGR*)to; Rs_ABGR src_pixel; Rs_ABGR dest_pixel; Rs_ABGR s; Rs_ABGR d; Rs_ABGR acc; uint alpha; uint beta; //# define INNARDS32(f) \ // U32 *t = (U32*)to; for (; w--; from += delta) *t++ = f delta = delta >> 2; // 4 bytes at a time for(; w--; psrc += delta) { // multiply by alpha + 1 to shift result into next higher byte // and mask off the low byte of the results for both r+b (one // calculation) and g (another calculation). // Then shift the result back down and set new alpha (255) for // the result. src_pixel.rgba = (psrc->rgba &0xFF00FF00) + psrc->byte.blue + (psrc->byte.red << 16); alpha = src_pixel.byte.alpha + 1; // shifts bits into next higher byte beta = 256 - alpha; // used to add background image, no XOR/NAND.. yet dest_pixel.rgba = pdest->rgba; s.rgba = (src_pixel.rgba & 0x00ff00ff) * alpha; d.rgba = (dest_pixel.rgba & 0x00ff00ff) * beta; acc.rgba = ((s.rgba + d.rgba) & 0xff00ff00) >> 8; s.rgba = (src_pixel.rgba & 0x0000ff00) * alpha; d.rgba = (dest_pixel.rgba & 0x0000ff00) * beta; acc.rgba += ((s.rgba + d.rgba) & 0x00ff0000) >> 8; acc.rgba = 0xff000000 + acc.rgba; //(acc.rgba >> 8); *pdest++ = acc; } } <-- // other stuff I can remember... Turned colormap off in config.h. Not sure if this made any difference thought. changed alpha drawing in demo because this alpha is additive with colors behind. It was showing to dark. Set for 32-bit little-endian INNARDS. |
fl_draw_image.cxx.tar.gz
Description: GNU Zip compressed data
_______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs

