×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    85

    Post how to draw objects using gui

    I have a image i want to draw a rectangle inside this picture ..

    how to draw any object.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: how to draw objects using gui

    Hi,

    1/ To draw something over the imege is pretty easy (e.g. for double buffer purposes). The image is represented by CFbsBitmap class, then you need to create the bitmap device CFbsBitmapDevice and finally you must create the graphic context CFbsBitGc, which has set of methods to draw over the image. SDK will tell you more about those methods. There is shown how to initialize mentioned classes:

    Code:
    CFbsBitGc* gc = NULL;
    TSize bufferSize(100,100);
    CFbsBitmap *buffer = new(ELeave) CFbsBitmap();
    buffer->Create( bufferSize, EColor4K );
    CFbsBitmapDevice * device = CFbsBitmapDevice::NewL( buffer );
    device->CreateContext( gc );
    2/ Normally if you want to draw something over the screen you have to override the Draw() method of the CCoeControl control - check the wiki/forum or SDK examples for it.

    Regards,
    STeN

  3. #3
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    85

    Re: how to draw objects using gui

    how to initialize following TPoint pointer for drawing a polygon

    TPoint p1=TPoint(1,7);
    TPoint p2=TPoint(4,23);
    TPoint p3=TPoint(14,37);
    TPoint p4=TPoint(15,75);
    TPoint *point={p1,p2,p3,p4};

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: how to draw objects using gui


  5. #5
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    85

    Re: how to draw objects using gui

    i m able to draw polygon now...........

    but i m not able to set from where to draw a rectangle........

    i drawing a rectangle using gc.DrawRect(aRect);

    it is drawing rectangle from beginning how to set so that it draw rectangle at a particular c-ordinates.........

  6. #6
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: how to draw objects using gui

    Hello,
    as you can find in sdk
    Code:
    gc.DrawRect(aRect);
    as a parameter takes TRect
    in sdk you can read about TRect and you have got there:
    TRect()
    IMPORT_C TRect(TInt aAx, TInt aAy, TInt aBx, TInt aBy);
    Description
    Constructs the rectangle, initialising its top left and bottom right hand corners with four TInt values.

    Parameters
    TInt aAx The horizontal co-ordinate of the left hand side of the rectangle.

    TInt aAy The vertical co-ordinate of the top of the rectangle.

    TInt aBx The horizontal co-ordinate of the right hand side of the rectangle.

    TInt aBy The vertical co-ordinate of the bottom of the rectangle.
    good luck

Similar Threads

  1. Draw function
    By praveenp in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-10-17, 12:27
  2. why can i not draw line in Draw()?
    By isarc in forum Symbian
    Replies: 7
    Last Post: 2008-05-13, 10:51
  3. Replies: 0
    Last Post: 2008-04-15, 08:38
  4. GUI Libraries for Java ME
    By erik.hellman in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2008-04-11, 11:56
  5. Replies: 4
    Last Post: 2007-05-15, 15:03

Posting Permissions

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