Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 29

Thread: draw over image

  1. #1
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    Hi

    when I draw line using gc.drawline it is drawn behind my container's background image
    I want to know how to draw line using (gc.drawline ) in front of any images putted into my container ??
    thanks in advance

  2. #2
    Registered User nuker85's Avatar
    Join Date
    May 2007
    Location
    Poland
    Posts
    606
    Hello,
    how do you draw your background image?

    Remember that if you do it in Draw function your gc.drawline must be under lines of your background code.

    You could also at the end of your constructL function call DrawNow()

    good luck

  3. #3
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    I've put my background image using drag image item from control menu and edit that image to add an image from project gfx folder , so all code of it is generated code
    ...

  4. #4
    Registered User nuker85's Avatar
    Join Date
    May 2007
    Location
    Poland
    Posts
    606
    generated code looks something like that:

    Code:
    	iImage1 = new ( ELeave ) CEikImage;
    		{
    		CFbsBitmap *bitmap, *mask;
    		AknIconUtils::CreateIconL( bitmap, mask,
    				KTestAppFile, EMbmTestappList_icon, EMbmTestappList_icon_mask );
    		AknIconUtils::SetSize( bitmap, TSize( 103, 82 ), EAspectRatioPreserved );
    		AknIconUtils::SetSize( mask, TSize( 103, 82 ), EAspectRatioPreserved );
    		iImage1->SetPicture( bitmap, mask );
    		}
    	iImage1->SetAlignment( EHCenterVBottom );
    you can do something like that:

    put in .h file this:
    Code:
    CFbsBitmap *iBitmap, *iMask;//don t forget to delete them in destructor
    in constructor or somewhere else call:
    Code:
    		AknIconUtils::CreateIconL( bitmap, mask,
    				KTestAppFile, EMbmTestappList_icon, EMbmTestappList_icon_mask );
    		AknIconUtils::SetSize( iBitmap, TSize( 103, 82 ), EAspectRatioPreserved );
    		AknIconUtils::SetSize( iMask, TSize( 103, 82 ), EAspectRatioPreserved );
    and in your Draw function:
    Code:
    	gc.BitBltMasked(TPoint, iBitmap, TRect, iMask, EFalse);
    and it will work you will be able to draw on it without any problem

  5. #5
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    many thanks nuker
    the problem is solved ,
    really I appreciate it , thank you again

  6. #6
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    ok now I need to change the position of the image
    I changed TPoint in
    Code:
    gc.BitBltMasked(TPoint, iBitmap, TRect, iMask, EFalse);
    but it remained in the position that set when it created, it changed only when I moved it in container ..

    sorry if this question is repeated :$

  7. #7
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    done , thanks to All who help in this forum

  8. #8
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    HI All
    I've Succeeded to draw line over bitmap image using nuker code but how to do that using gif image
    ??
    is it impossible to do that using symbian c++? if yes , how ?
    thanks in advance
    Regards

  9. #9
    You can use CMdaImageFileToBitmapUtility to convert gif into Bitmap.

  10. #10
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    Quote Originally Posted by summeli View Post
    You can use CMdaImageFileToBitmapUtility to convert gif into Bitmap.
    then can i use the same code of betmap to draw over it ?
    another question is
    when I'm drawing the line over the image it seems as transparent so when it becomes over dark part of image it disappeare , so how to use drawline method without line being transparent ??
    Last edited by Nourayn; 2009-03-31 at 12:32.

  11. #11
    Yes, after conversion you can use the already working code to draw it

  12. #12
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    thanks

    when I'm drawing the line over the image it seems as transparent so when it becomes over dark part of image it disappeare , so how to use drawline method without line being transparent ??
    can any one Know how ?? :$

  13. #13
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,747
    Are you complaining about that you are drawing a black line on a black image and you can not see it, or what? You may want to experiment with SetDrawMode then.

  14. #14
    Regular Contributor Nourayn's Avatar
    Join Date
    Nov 2008
    Posts
    113
    Hi, it may be so late :$
    but I converted the jpg image to bitmap using Image_Reader
    using this code :
    in constructor :
    Code:
      TBuf<50> name1;
      name1.Append(_L("C:\\Data\\Others\\pics\\n.jpg"));
      dec = CImage_Reader::NewL( name1,*this);
    and calling function
    Code:
    void CNorth::ImageReadyL(const TInt& aError , CFbsBitmap* bitmap1)
    	{
    	
    	if(aError == KErrNone)
    		{		
    		bitmap = bitmap1;
    		 AknIconUtils::SetSize( bitmap, Size(), EAspectRatioPreserved );
    		iImage1->SetPicture(bitmap ,NULL);
    		iImage1->SetExtentToWholeScreen();		
    		DrawNow();
    		}
    so it converted to bitmap, and when I'm trying to draw over it
    in draw function
    Code:
    gc.BitBlt(TPoint(0,0),bitmap);
    	gc.DrawEllipse(aRect);
    but the drawing done behind the image ??
    can you help me plzzzz ??

  15. #15
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,747
    Actually you can experiment with aRect if you are interested in what it is, but if you just want to see your eclipse, try using Rect() instead.

Page 1 of 2 12 LastLast

Similar Threads

  1. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  2. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  3. draw image, on to an image?
    By jamiefuller in forum Mobile Java General
    Replies: 1
    Last Post: 2006-04-04, 10:15
  4. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31
  5. Series 40 - draw only a part of the image
    By ionutianasi in forum Mobile Java Media (Graphics & Sounds)
    Replies: 11
    Last Post: 2003-09-08, 04:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved