×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257

    Question how to draw several shape (circle, line, rec, etc.) with more control?

    I know there is a nice class Graphics with basic api like drawLine, drawRect. But I need more control to set pixel size, wide, thick, thin, lines in my shape. My intention to draw a dynamic shape (similar to attached image) depending on different criteria.
    Attachment 1356
    I'm new in J2ME. Any other suggestion to achieve my goal is nice.
    Do it now! Today will be yesterday tomorrow - MadSum

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: how to draw several shape (circle, line, rec, etc.) with more control?

    FYI, I cannot see your attachment.

    You need to work with the available MIDP LCDUI graphics and implement some new drawing functions/methods with those.
    On some devices you could use SVG API as well.
    One topic to check as well are the various UI toolkits / libraries there are for Java ME. I am not too familiar with them so I do not know if they contain any improvements for the graphics primitives..

    Hartti

  3. #3
    Registered User
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257

    Re: how to draw several shape (circle, line, rec, etc.) with more control?

    Thanks for the suggestion. I cannot think of a logic to make my draw line wide like 2-3 pix in each dot.
    Here is the link for the attachment again:
    https://docs.google.com/open?id=0B08...liOTIzNjc5YTgz

    Is it possible to display this png image then draw few arrow on the image?
    Last edited by madsum; 2011-12-01 at 12:04.
    Do it now! Today will be yesterday tomorrow - MadSum

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: how to draw several shape (circle, line, rec, etc.) with more control?

    Quote Originally Posted by madsum View Post
    Thanks for the suggestion. I cannot think of a logic to make my draw line wide like 2-3 pix in each dot.
    Here is the link for the attachment again:
    https://docs.google.com/open?id=0B08...liOTIzNjc5YTgz

    Is it possible to display this png image then draw few arrow on the image?
    Quick solution:

    1. You can go for some third party GUI development API and then can go ahead to draw all your customize graphics objects.Search for LWUIT, you will get a good idea about it when you will go through the same.

    2. Even you can take the line as the image and then keep on drawing the same image, using some clipping techniques of the Graphics API of the MIDP itself.

    Check and revert
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: how to draw several shape (circle, line, rec, etc.) with more control?

    You can also do a somewhat similar picture by using the normal LCDUI graphics primitives, and by using different shades of blue for the arrows, and different stroke styles (DOTTED, SOLID) for the circles.

    Hartti

  6. #6
    Registered User
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257

    Re: how to draw several shape (circle, line, rec, etc.) with more control?

    I would really like to use LCDUI primitives, but there is no way to make line thick. How to make it thicker? That was my inertial question or this thread.
    Do it now! Today will be yesterday tomorrow - MadSum

  7. #7
    Regular Contributor
    Join Date
    Dec 2011
    Posts
    174

    Re: how to draw several shape (circle, line, rec, etc.) with more control?

    Hi madsum,

    If you want to use the LCDUI for drawing thicker lines have you tried drawing several lines side by side. And for other shapes(rect, cricle etc.) draw a smaller shape inside the original one with the same background color . For example...

    Code:
    // background fill
    g.setColor(0xffffff);
    g.fillRect(0, 0,getWidth(),getHeight());
    
    int x1 = 30; int y1 = 30; int x2 = 230; int y2 = 230;
    
    // draw three lines side by side
    
    g.setColor(0xff0000);
    
    for(int i = -1 ;i<2;i++)
    {
    	if(x1<x2)
    		g.drawLine(x1-i,y1+i,x2-i,y2+i);
    	// if(x1>x2) etc...				
    }
    
    // draw a circle and then fill it with a smaller circle with the same background color. 
    
    g.fillRoundRect(60, 140, 60, 60, 60, 60);
    g.setColor(0xffffff);
    g.fillRoundRect(65, 145, 50, 50, 60, 60);
    Regards,
    tiviinik

  8. #8
    Registered User
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257

    Re: how to draw several shape (circle, line, rec, etc.) with more control?

    Thanks a lot Tiviinik! I was almost hopeless. Now it looks like I can do it.
    Do it now! Today will be yesterday tomorrow - MadSum

Similar Threads

  1. Replies: 1
    Last Post: 2011-03-21, 12:17
  2. How to draw filled-circle?
    By curiouswalker in forum Symbian User Interface
    Replies: 3
    Last Post: 2010-06-22, 16:54
  3. Placing images in circle shape
    By shankar_vn in forum Mobile Java General
    Replies: 1
    Last Post: 2009-11-19, 14:50
  4. why can i not draw line in Draw()?
    By isarc in forum Symbian
    Replies: 7
    Last Post: 2008-05-13, 10:51
  5. how to draw line
    By amitagrawal78 in forum Symbian
    Replies: 0
    Last Post: 2002-10-07, 04:10

Posting Permissions

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