Results 1 to 5 of 5
  1. #1
    totalspelnerd is offline Member
    Join Date
    Mar 2012
    Location
    Sweden
    Posts
    83
    Rep Power
    0

    Default Drawing a circle with inner and outer color?

    If you didn't understand my description in the title, I want to draw a circle that gradually changes into another color when the radius gets bigger. To explain it a little more I want to create a light source (for my game) that fades into darkness the longer away the point is from the center. Hope this explanation is good enough, otherwise ask me questions. The way I'm drawing graphics are with Graphics (or Graphics2D), if that is any help.

    So, if someone could be nice and tell me (or give me hint) how this could be done efficiently that would be great.

  2. #2
    nihirus's Avatar
    nihirus is offline Member
    Join Date
    Feb 2012
    Posts
    7
    Rep Power
    0

    Default Re: Drawing a circle with inner and outer color?

    I asked similar question but nobody cared to answer. So I ve gone through a little bit and found that class.

    RadialGradientPaint (Java Platform SE 7 )

    Still trying to understand the class. So can't give you exact/proper code example for your job particularly.

    Hope it helps mate.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,949
    Rep Power
    4

    Default Re: Drawing a circle with inner and outer color?

    What do you mean, nobody cared to answer?? You asked the question less than 24 hours ago! And since you found the answer why didn't you post it in your original thread so others could benefit?

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  4. #4
    nihirus's Avatar
    nihirus is offline Member
    Join Date
    Feb 2012
    Posts
    7
    Rep Power
    0

    Default Re: Drawing a circle with inner and outer color?

    The question was hard for me but very easy question for a swing pro I am guessing. So yes, 23 hours without getting 1 proper answer (or atleast a tip, a useful web site advice or small code explanation) is a long time. Also, finding that class is not a real solution for my question. If you read, you ll see it.

    Regards.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: Drawing a circle with inner and outer color?

    Quote Originally Posted by nihirus View Post
    The question was hard for me but very easy question for a swing pro I am guessing.
    And how many Swing pros are there on the forum? And out of those, how many need fancy paint gradients?

    Most Swing pros busy themselves with complex component layouts for data entry and retrieval and the associated database/web interactions, not with pretty colors.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Circle within Circle in Android
    By raihan26 in forum Android
    Replies: 0
    Last Post: 08-12-2012, 08:41 PM
  2. Replies: 27
    Last Post: 04-06-2012, 02:37 PM
  3. Inner or outer class
    By Dipke in forum New To Java
    Replies: 2
    Last Post: 07-22-2011, 01:57 PM
  4. drawing a dashed circle
    By Alarmmy in forum SWT / JFace
    Replies: 0
    Last Post: 07-13-2009, 09:46 AM

Tags for this Thread

Posting Permissions

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