×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    37

    TBitmapUtil vs TDisplayMode

    Hi!

    I am working on some image processing functions. I have written a filtering function. It is working correctly when I process image which has 24bpp (EColor16M), yet it is not working for other display modes. I am using TBitmapUtil as it is much faster than CFbsBitGc. Documentation says that TBitmapUtil is working for all display modes.

    I found out that TBitmapUtil is working using binary masks, when it sets pixel. For example EGray2 (only two possible colors - black and white) uses only 1 bit to represent color. In this way, TBitmapUtil::GetPixel() gets TRgb, which has wrong values in channels (Red is 0 or 1, Blue and Green always 0). CFbsBitmap would work correctly as CFbsBitmap::GetPixel will return TRgb which has proper values in channels (0 or 255). Similarly EColor16 uses 4 bits (Red 0 - 16, Blue and Green always 0), etc.

    Does somebody know if it is a bug...?

    The best way to omit this problem is to convert input image to EColor16M, process it and then convert back to previous TDisplayMode.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: TBitmapUtil vs TDisplayMode

    Although documentation of TBitmapUtil mentions TRgb (as something that it does not construct for performance reasons), it does not claim that the value you get would be RGB. As you have already checked, it operates on bits/bytes level and it provides access to the actual set of bits representing a pixel, without taking care of what the internal structure of that value is.

    Or did you use TRgb::Gray2/4/16/256?

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    37

    Re: TBitmapUtil vs TDisplayMode

    Thanks for your reply!

    I have found that in order to get real TRgb (with true channel values) I should use TRgb::Gray2(value), TRgb::Color256(value), etc., where value is obtained from TBitmapUtil::GetPixel(). Proper function is based on DisplayMode() of CFbsBitmap.

    So it is not a bug but my poor knowledge .

Similar Threads

  1. Using two TBitmapUtil instances at the same time
    By Tobias_80 in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2006-09-13, 14:28
  2. Problem with TBitmapUtil
    By chrishawaii in forum Symbian
    Replies: 4
    Last Post: 2006-05-20, 11:32
  3. GetPixel()-method of TBitmapUtil
    By chrishawaii in forum Symbian
    Replies: 4
    Last Post: 2006-05-18, 11:46
  4. Error with heap locking when using TBitmapUtil
    By richard_scothern in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-12-11, 07:35
  5. TBitmapUtil and CDesC8Array Problem
    By lkjfdsa in forum Symbian
    Replies: 1
    Last Post: 2002-08-16, 09:11

Posting Permissions

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