View a printable version of the current page.
  Wiki > Symbian Developer Network Public Wiki > ... > Example source code > Change bitmap color
  Change bitmap color
Added by alie, last edited by Rodney De Gale on Feb 15, 2008  (view change)
Labels: 
(None)

Use this function if you want change specific bitmaps color.

void CMyClass::ChangeBitmapColor(CFbsBitmap*& aBitmap, TRgb aColor)
    {
    TSize bmpSizeInPixels = aBitmap->SizeInPixels();
    TUint width = bmpSizeInPixels.iWidth;
    TUint height = bmpSizeInPixels.iHeight;
    TBitmapUtil* bitmapU = new(ELeave) TBitmapUtil(aBitmap);
    bitmapU->Begin(TPoint(0, 0));
    for(TInt j = 0; j < height; j++)
        {
        for(TInt i = 0; i < width; i++)
            {
            bitmapU->SetPos(TPoint(i, j));
            TUint32 pix = bitmapU->GetPixel();
            if(pix == 0)
            bitmapU->SetPixel(aColor.Value());
            }
        }
    bitmapU->End();
    if(bitmapU) { delete bitmapU; bitmapU = NULL; }
    }
Interactive Services Terms & Conditions of use | Terms of use | Privacy policy | Media Center | Contact us | © 2008 Symbian