×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    May 2008
    Location
    Beijing, China
    Posts
    180

    How to change the gray scale of mask?

    The filtering layer of my mask is irregular shape, it generate from one .bmp file, I want to change its gray scale dynamically in code, and then I can implement transition effects, in a general way, how to do it? Thanks in advance! :-)

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: How to change the gray scale of mask?

    AFAIK bmp's can only have monocrome masks.

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to change the gray scale of mask?

    you might want to play with the raw image bits before drawing to get transition effects.

  4. #4
    Regular Contributor
    Join Date
    May 2008
    Location
    Beijing, China
    Posts
    180

    Re: How to change the gray scale of mask?

    Maybe the codes what I want as follows, but I don't know how about its efficiency in my application.

    Code:
    void SetTransparency( CFbsBitmap* aMask, TInt aTransparency )
        {
        TBitmapUtil bmpUtil(aMask );
    
        bmpUtil.Begin(TPoint(0, 0));
        TSize theSize( aMask->SizeInPixels() );
    
        for ( TInt i = 0; i < theSize.iHeight; i++ )
            {
            bmpUtil.SetPos( TPoint( 0, i ) );
    
            for ( TInt j = 0; j < theSize.iWidth; j++ )
                {
                TRgb oldColor( bmpUtil.GetPixel() );
                if ( oldColor != KRgbWhite )
                    {
                    TRgb newColor( aTransparency, aTransparency, aTransparency );
                    bmpUtil.SetPixel( newColor );
                    }
                 bmpUtil.IncXPos();
                 }
            }
    
        bmpUtil.End();
        }

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: How to change the gray scale of mask?

    all depends on what you want to show and what effect you want. test it with your application then optimize

  6. #6
    Regular Contributor
    Join Date
    May 2008
    Location
    Beijing, China
    Posts
    180

    Re: How to change the gray scale of mask?

    Quote Originally Posted by skumar_rao View Post
    all depends on what you want to show and what effect you want. test it with your application then optimize
    Yes, thanks, hopefully it can work as my expect! :-)

Similar Threads

  1. Replies: 10
    Last Post: 2010-10-29, 08:02
  2. Is it possible to change theme programmatically on S60 3rd addition?
    By jain_0882 in forum Symbian Media (Closed)
    Replies: 6
    Last Post: 2009-03-10, 16:16
  3. Accelero: ±2g and ±6g user selectable full scale
    By mikedeklerk in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2008-03-27, 18:10
  4. Replies: 0
    Last Post: 2008-01-10, 13:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×