×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    13

    How to draw text/line on DirectScreenAccess?

    I get the screen address through DirectScreen Bitmap and render a picture on it, after that, I need to put some text& line on the picture be using DirectScreenAccess::Gc()->DrawXXX(), but the text and line are drawn on a new blank backgroud canvas and replace part of the original one. What should I do to implement a so-called transparent draw mode like DirectDraw on Microsoft platform?

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

    Re: How to draw text/line on DirectScreenAccess?

    Generally the transparency is not working with S60, anyway, you could try searching this forum for tranparent windows to see whether you could find any help from the older threads on the topic.

    Anyway, if you can update the background, you could try working with brush patters, for example setting the brush style to null style, would mean that the original is used.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    13

    Re: How to draw text/line on DirectScreenAccess?

    Quote Originally Posted by symbianyucca View Post

    Anyway, if you can update the background, you could try working with brush patters, for example setting the brush style to null style, would mean that the original is used.
    I've try the null style brush, no effect
    I'm a brand new developer on S60 platform, do I need to abandon the DSA tech. for the functionality?

  4. #4
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: How to draw text/line on DirectScreenAccess?

    In hellowworldplus example, the text is directly draw on the screen by CWindowGC object. find DrawText() method there in the example.

  5. #5
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142

    Re: How to draw text/line on DirectScreenAccess?

    ok, is the backround something you draw yourself ?
    or is it something else ?

    Do you call Clear etc. in your direct drawing code ?

    Basically don't call Clear, and if it is not your own drawn background, then it is the transparent window issue, for which you should search this forum. Basically impossible to be done.

  6. #6
    Registered User
    Join Date
    Oct 2008
    Posts
    13

    Re: How to draw text/line on DirectScreenAccess?

    Quote Originally Posted by symbianyucca View Post
    ok, is the backround something you draw yourself ?
    or is it something else ?

    Do you call Clear etc. in your direct drawing code ?

    Basically don't call Clear, and if it is not your own drawn background, then it is the transparent window issue, for which you should search this forum. Basically impossible to be done.
    .
    I draw the backgroud by myself. What I want is put the line and text on the backgroud while leaving the finished backgroud untouched except the pixels occupied by line/text. But the result is looks like the line/text is first drawn on a blank canvas and the whole region is blit to original backgroud

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    13

    Re: How to draw text/line on DirectScreenAccess?

    Quote Originally Posted by kkrish View Post
    In hellowworldplus example, the text is directly draw on the screen by CWindowGC object. find DrawText() method there in the example.
    I'll check it, thanks.

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    48

    Re: How to draw text/line on DirectScreenAccess?

    Hi,

    You can't draw text with direct screen access, but you can draw text into that bitmap you are going to render with direct screen access.

    I have used this kind of code to display FPS
    Code:
    CFbsBitmapDevice* bitDevice = CFbsBitmapDevice::NewL(iBitmap);
    CleanupStack::PushL( bitDevice );
    CFbsBitGc* bitGc;
    User::LeaveIfError(bitDevice->CreateContext(bitGc));
    		
    _LIT(KFps,"FPS: %d");
    TBuf<10> fpsBuf;
    fpsBuf.Format( KFps, iFPS);
    bitGc->SetPenColor(KRgbRed);
    bitGc->UseFont(CEikonEnv::Static()->DenseFont() );
    bitGc->SetPenStyle(CGraphicsContext::ESolidPen);
    bitGc->DrawText(fpsBuf, TPoint(10, 10));
    CleanupStack::Pop(bitDevice);
    Regards,
    summeli

  9. #9
    Registered User
    Join Date
    Oct 2008
    Posts
    13

    Re: How to draw text/line on DirectScreenAccess?

    Quote Originally Posted by summeli View Post
    Hi,

    You can't draw text with direct screen access, but you can draw text into that bitmap you are going to render with direct screen access.

    I have used this kind of code to display FPS
    Code:
    CFbsBitmapDevice* bitDevice = CFbsBitmapDevice::NewL(iBitmap);
    CleanupStack::PushL( bitDevice );
    CFbsBitGc* bitGc;
    User::LeaveIfError(bitDevice->CreateContext(bitGc));
    		
    _LIT(KFps,"FPS: %d");
    TBuf<10> fpsBuf;
    fpsBuf.Format( KFps, iFPS);
    bitGc->SetPenColor(KRgbRed);
    bitGc->UseFont(CEikonEnv::Static()->DenseFont() );
    bitGc->SetPenStyle(CGraphicsContext::ESolidPen);
    bitGc->DrawText(fpsBuf, TPoint(10, 10));
    CleanupStack::Pop(bitDevice);

    Regards,
    summeli
    Thanks for your reply. Did you blit the bitmap to DSA's GC or DirectScreenBitmap?

  10. #10
    Registered User
    Join Date
    Jun 2005
    Posts
    48

    Re: How to draw text/line on DirectScreenAccess?

    I used the CDirectScreenAccess for rendering.
    Code:
    iGc->BitBlt(TPoint(0, 0), iBitmap);
    iDSA->ScreenDevice()->Update();
    I had some strange issues with DirectScreenBitmap on newer devices than S60 3.0. I didn't investigate that any further, so my problems were most likely just on my own code. The DSA worked instantly, so I decided to use it.

Similar Threads

  1. View server panic with 11 on draw
    By raj_rr7 in forum Symbian User Interface
    Replies: 7
    Last Post: 2009-05-18, 11:36
  2. Draw function
    By praveenp in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-10-17, 12:27
  3. why can i not draw line in Draw()?
    By isarc in forum Symbian C++
    Replies: 7
    Last Post: 2008-05-13, 10:51
  4. Getting WServ 1 while trying draw on root session
    By gigglie in forum Symbian C++
    Replies: 0
    Last Post: 2008-04-15, 08:38
  5. Thread and Draw Command
    By vitormcruz in forum Symbian C++
    Replies: 3
    Last Post: 2007-11-01, 20:50

Posting Permissions

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