×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    18

    Unhappy J2me Customize Stroke Style

    hi all,
    i have a big problem that i spent 2days working on it but i didn't have any satisfied result,

    i want to draw shapes in j2me like arc, round rectangle , line but with different border width ; namely i want to make border of these shapes more large such as using BasicStroke class in Jse.

    i tried alot of solutions such as drawing shapes inside others , rrectangle inside another one so it could appears as a single rrctangle but with large border size, but i Fails, the are empty pixels between them.

    please any one can help?

  2. #2
    Registered User
    Join Date
    Sep 2009
    Location
    Bangalore, India
    Posts
    49

    Re: J2me Customize Stroke Style

    Guys even i am looking for the same ... Pls provide some solution for the same..
    Regards
    Nilanchala

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: J2me Customize Stroke Style

    I'm afraid there is no "width" option.

    Obviously, with plain rectangles, it is fairly easy just to draw one inside another.

    With arcs, circles, rounded-rects, there is no rule to make them fit inside each other. Even if you managed to get it to work, there is a chance that the code would fail on another device, since there is no standard arc algorithm.

    Four options:

    1. Don't use them. Draw plain rectangles insteads.

    2. Draw them yourself, one pixel (or filled-rect) at a time.

    3. Construct shapes from bit-map images.

    4. Consider using SVG instead.

    Graham.

  4. #4
    Registered User
    Join Date
    Jun 2010
    Posts
    18

    Re: J2me Customize Stroke Style

    i tried this code
    for (int j = 1; j < bw / 4 + 1; j++) {
    for (int i = 0; i <= 5; i++) {
    g.drawArc(xPos + j, yPos + j, width - 2 * j, height - 2 * j, i, endAngle);
    }
    }
    it works well on the emulator and produce the correct arc
    but on the real device those fucking empty pixels still exist

  5. #5
    Registered User
    Join Date
    Jun 2010
    Posts
    18

    Re: J2me Customize Stroke Style

    Quote Originally Posted by grahamhughes View Post
    I'm afraid there is no "width" option.

    Obviously, with plain rectangles, it is fairly easy just to draw one inside another.

    With arcs, circles, rounded-rects, there is no rule to make them fit inside each other. Even if you managed to get it to work, there is a chance that the code would fail on another device, since there is no standard arc algorithm.

    Four options:

    1. Don't use them. Draw plain rectangles insteads.

    2. Draw them yourself, one pixel (or filled-rect) at a time.

    3. Construct shapes from bit-map images.

    4. Consider using SVG instead.

    Graham.
    How i can use SVG instead ?
    this can draw the nedded arcs and round rects correctly?

  6. #6
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: J2me Customize Stroke Style

    Quote Originally Posted by omarhassan123 View Post
    How i can use SVG instead ?
    this can draw the nedded arcs and round rects correctly?
    If you use Images in place of drawing your own lines,rect;s and arcs..... you can use them of any width and you will not face such issues of empty pixels.
    SVG is a image format - stands for Scalable Vector Graphics - which can be easily scaled.
    Thanks,
    Ekta

  7. #7
    Registered User
    Join Date
    Jun 2010
    Posts
    18

    Re: J2me Customize Stroke Style

    Quote Originally Posted by ektasrv View Post
    If you use Images in place of drawing your own lines,rect;s and arcs..... you can use them of any width and you will not face such issues of empty pixels.
    SVG is a image format - stands for Scalable Vector Graphics - which can be easily scaled.
    yes, i understood
    but let me give you a brief idea about my application

    my application is two sided application one side jse and another side j2me
    what you draw on the jse side should be displayed on jme side

    so those arcs and round rects are options for drawing; i dont draw a specific arc figure.

    regards,

    Omar

  8. #8
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: J2me Customize Stroke Style

    Quote Originally Posted by omarhassan123 View Post
    yes, i understood
    but let me give you a brief idea about my application

    my application is two sided application one side jse and another side j2me
    what you draw on the jse side should be displayed on jme side

    so those arcs and round rects are options for drawing; i dont draw a specific arc figure.

    regards,

    Omar
    If you want to reflect what is drawn on JSE side to J2me, just capture JSE screen and push it J2me screen as image, if needed you can allow the user to edit the image on J2me side also, capture and push it back to JSE side.
    Thanks,
    Ekta

Similar Threads

  1. Stroke-rate meter using accelerometer?
    By jwshale in forum Symbian
    Replies: 0
    Last Post: 2009-12-14, 21:00
  2. J2ME Polish ChoiceGroup style
    By poojs in forum Mobile Java General
    Replies: 1
    Last Post: 2009-10-26, 06:15
  3. how to create customize fonts in j2me
    By prashantpersistent in forum Mobile Java General
    Replies: 5
    Last Post: 2008-10-16, 14:30
  4. Textfield key stroke detection
    By sevics in forum Mobile Java General
    Replies: 2
    Last Post: 2004-12-17, 20:38
  5. stroke - Dashed
    By ktreddy in forum Symbian
    Replies: 1
    Last Post: 2003-02-07, 15:35

Posting Permissions

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