const unsigned short *src = cache_.constData() + offy*dia + offx; const unsigned int nextline = (image.width() - dia + offx) * 4; const unsigned int w = (pos.x()+dia)>image.width()?image.width()-pos.x():dia; const unsigned int h = (pos.y()+dia)>image.height()?image.height()-pos.y():dia; // Composite brush on image for(unsigned int y=offy;y<h;++y) { for(unsigned int x=offx;x<w;++x) { const int a = *(src++); #ifdef IS_BIG_ENDIAN ++dest; *dest = a*(red - *dest) / 256 + *dest; ++dest; *dest = a*(green - *dest) / 256 + *dest; ++dest; *dest = a*(blue - *dest) / 256 + *dest; ++dest; #else *dest = a*(blue - *dest) / 256 + *dest; ++dest; *dest = a*(green - *dest) / 256 + *dest; ++dest; *dest = a*(red - *dest) / 256 + *dest; ++dest; ++dest; #endif } dest += nextline + (dia-w)*4; src += offx + dia-w; }
原文链接: https://www.cnblogs.com/maijin/p/17091224.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/315964
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!