void CIconWnd::modulateIcon(NLMISC::CBitmap &dst, const NLMISC::CRGBA &col) { // modulate an icon by a color CObjectVector<uint8> &data = dst.getPixels(); for (uint y=0 ; y<dst.getHeight() ; y++) { for (uint x=0 ; x<dst.getWidth() ; x++) { CRGBA c; c.modulateFromColor(col, dst.getPixelColor(x, y)); data[(x+y*dst.getWidth())*4] = c.R; data[(x+y*dst.getWidth())*4+1] = c.G; data[(x+y*dst.getWidth())*4+2] = c.B; data[(x+y*dst.getWidth())*4+3] = dst.getPixelColor(x, y).A; } } }
void CIconWnd::blendIcons(NLMISC::CBitmap &dst, const NLMISC::CBitmap &src) { // blend between two icons nlassert(dst.getWidth() == src.getWidth()); nlassert(dst.getHeight() == src.getHeight()); CObjectVector<uint8> &data = dst.getPixels(); for (uint y=0 ; y<dst.getHeight() ; y++) { for (uint x=0 ; x<dst.getWidth() ; x++) { CRGBA c; c.blendFromui(dst.getPixelColor(x, y), src.getPixelColor(x, y), src.getPixelColor(x, y).A); data[(x+y*dst.getWidth())*4] = c.R; data[(x+y*dst.getWidth())*4+1] = c.G; data[(x+y*dst.getWidth())*4+2] = c.B; data[(x+y*dst.getWidth())*4+3] = c.A; } } }