×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    13

    GetPixel() - Red, Green, Blue

    Hi,

    I'm really stuck with that:
    I need the real RGB values of pixel - 0-255.
    Any method that I tried, I get only weird values. even if I try it on blank pic - so the value suppose to be around 255 - it's not even 100.
    I tried CFbsBitmap::GetPixel, and DataAddress().
    I tried TBitmapUtil::GetPixel(), and it also didn't work.

    Any ideas?...

    thanks,
    Yair.

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: GetPixel() - Red, Green, Blue

    Below code works for me

    Code:
    TUint32 pixel = BitmapObj->GetPixel();
    TRgb rgb = TRgb(pixel);
    TInt redColor=rgb.Red();
    TInt greenColor=rgb.Green();
    TInt blueColor=rgb.Blue();

  3. #3
    Registered User
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    305

    Re: GetPixel() - Red, Green, Blue

    const CFbsBitmap * aPicture;

    TInt TextureSize = aPicture->SizeInPixels().iWidth * aPicture->SizeInPixels().iHeight;

    #ifdef __S60_50__
    aPicture->BeginDataAccess();
    #else
    aPicture->LockHeap(EFalse);
    #endif
    TUint8 * TextureData = (TUint8 *) aPicture->DataAddress();

    TUint8 * PictureDataWithoutAlpha = new (ELeave) TUint8[TextureSize * 3];
    // generate without alpha
    // change to BGR format
    for (TInt i = 0; i < TextureSize; i++)
    {
    PictureDataWithoutAlpha[i * 3] = TextureData[i * BytePerPixel + 2];
    PictureDataWithoutAlpha[i * 3 + 1] = TextureData[i * BytePerPixel + 1];
    PictureDataWithoutAlpha[i * 3 + 2] = TextureData[i * BytePerPixel];
    }

    aTextureFormat = GL_RGB;
    #ifdef __S60_50__
    aPicture->EndDataAccess(ETrue);
    #else
    aPicture->UnlockHeap(EFalse);
    #endif


    And if you want example:
    \Nokia_N97_SDK_v1.0\S60CppExamples\OpenGLEx\openGL\Utils\Textureutils.cpp
    Last edited by xlazom00; 2011-04-27 at 07:55.

Similar Threads

  1. how to get alpha,red,green,blue values of an image
    By vineetbillorey in forum Mobile Java General
    Replies: 2
    Last Post: 2009-03-27, 11:07
  2. Permission Denied capturing Green/Red keys
    By jas76 in forum Symbian
    Replies: 2
    Last Post: 2008-09-24, 14:39
  3. how to get red() green() and blue() values from TRgb
    By pengox in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-03-01, 22:12
  4. blinking red/green
    By Check in forum Nokia M2M
    Replies: 1
    Last Post: 2003-05-30, 06:52

Posting Permissions

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