×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Jaipur, India
    Posts
    52

    Transparency proble in drawing PNG file.

    Hello
    I am developing an application using S60 3rd Editon FP1.
    I am having problem in drawing of PNG image. I performed following two things:
    Conversion of PNG into MBM
    What I did is converted the PNG file in MBM file using the Image Converter Library. Using conversion library I created the MBM represantation and mask file of given PGN file. Both the MBM are created successfuly and correctly. I checked them by drawing them in the draw() function of the CCoeControl class using the DrawBitmap(). Both, the image and its mask are created properly.

    Drawing the converted Image
    Problem is that when I try to draw it using BitBltMasked() the image is not showing transparency. I did following in the Draw()function of CCoeControl:
    1. Set brush color to white
    2. draw a background image using BitBltMasked()function.
    3. draw the png image over this background image using BitBltMasked()function.

    Now the problem is that the transparent area of the image is showing me white color instead of the image drawn in the second step. What I am doing wrong. Please guide.

    Thanks

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: Transparency proble in drawing PNG file.

    The brush is the evil. BitBltMasked uses the brush for transparent regions, set ENullBrush prior to BitBltMasked, and your problem will probably be gone.

  3. #3
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Jaipur, India
    Posts
    52

    Re: Transparency proble in drawing PNG file.

    Thanks wizard_hu_ !!!!
    It worked and now images are drawing properly.
    Thanks for your quick response.

  4. #4
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: Transparency proble in drawing PNG file.

    Hi

    how did you convert the PNG to MBM?

  5. #5
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Transparency proble in drawing PNG file.

    Hi,
    You can use ICL to make MBM out of png file
    To know more about the ICL check this wiki link
    http://wiki.forum.nokia.com/index.ph...rary_%28ICL%29
    Maximus
    S60 Developer
    Impossible is nothing

  6. #6
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: Transparency proble in drawing PNG file.

    Quote Originally Posted by yogpan View Post
    Hi,
    You can use ICL to make MBM out of png file
    To know more about the ICL check this wiki link
    http://wiki.forum.nokia.com/index.ph...rary_%28ICL%29
    i copy pasted the Image_Reader.cpp and Image_Reader.h to my project.. it isn't working. there are build errors.

    unidentified identifier aResult

  7. #7
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Transparency proble in drawing PNG file.

    The image reader example in the wiki doesn't contain "aResult" so it's probably somewhere else in your code.

    EDIT: Sorry, yes it does. Looks like a mistake in the wiki code:
    Code:
    if(FileDataType.iConfidence > aResult.iConfidence)
        {
        aFileType.Copy(FileDataType.iDataType.Des8());
        }
    You could just take the check out but it might be better to find a confidence level to compare against.

    Sorcery
    Last edited by Sorcery-ltd; 2008-10-15 at 09:57.

  8. #8
    Registered User
    Join Date
    Nov 2007
    Posts
    444

    Re: Transparency proble in drawing PNG file.

    I think commenting aResult.iConfidence will not make any problem in conversion.

    Means..
    Code:
    if(FileDataType.iConfidence)// > aResult.iConfidence)
        {
        aFileType.Copy(FileDataType.iDataType.Des8());
        }
    will be enough.

    Regards,
    Kavit.

  9. #9
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: Transparency proble in drawing PNG file.

    I see. I will try this again. I'm new to Symbian c++. its very confusing.... haha

  10. #10
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Transparency proble in drawing PNG file.

    Yes, like I said, you can take the check out. It might be better to compare it to one of the pre-defined constants though. I added a comment to the wiki article.

    Sorcery

  11. #11
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Philippines, Manila
    Posts
    320

    Re: Transparency proble in drawing PNG file.

    i fixed the build error. my problem is how do i use this? do i nid to place CImage_Reader a;
    then

    a.ConstructL(_L("sample.png"));???

    -- edit --

    sorry. i didn't include the Image_Reader in my .mmp, when i included the Image_Reader 100 errors occurred...
    Last edited by coolblues5000; 2008-10-20 at 06:47.

Similar Threads

  1. Can't include png file into jar file when create MIDlet suite
    By hi_sailom in forum Mobile Java Tools & SDKs
    Replies: 7
    Last Post: 2008-08-01, 04:07
  2. How to save a drawing in png or jpg format ?
    By sandeep.dixit07@gmail.com in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2008-06-27, 06:25
  3. Replies: 1
    Last Post: 2005-05-26, 14:22
  4. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

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