Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 826633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:26:44+00:00 2026-05-15T03:26:44+00:00

If I have a QuadCurve like this ( + = node): + + \

  • 0

If I have a QuadCurve like this (+ = node):

+         +
 \      ./
   +--⁻⁻

And I fill it in Java 2D the result is something like this: (x = colored)

+xxxxxxxxx+
 \xxxxxx./
   +--⁻⁻

But I want to color the other side:

+         +
x\      ./x
xxx +--⁻⁻xx
xxxxxxxxxxx

This succeeds by drawing a rectangle around the curve in the color I want to color the other side and then fill the curve with the background color.

But this isn’t good enough to fill a convex rounded (based on QuadCurves) polygon. In case of some coordinates for the rectangles (as explained in the trick I used) overlap other pieces of the polygon. Here are two images (the green area is my polygon):

alt text http://img204.imageshack.us/img204/7823/convexpolygon.png alt text http://img708.imageshack.us/img708/3669/convexpolygon2.png

So, the question is simple: “How can I color a shape build of curves?”
But to the answer will not be simple I think…

Any advice would be VERY VERY appreciated.
Thanks in advance.

Maybe I’m going to make a bounty for this question if I don’t get an answer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:26:45+00:00Added an answer on May 15, 2026 at 3:26 am

    Pick a point known to be inside the Polygon.

    Know the “boundary color” (in this case, black).

    recurrsiveFill(Pixel p, Color fill, Color bound) {
        p.setColor(fill);
        if(p.left.color  != bound && p.left.color != fill) 
            recurrsiveFill(p.left , fill, bound);
        if(p.right.color != bound && p.right.color != fill) 
            recurrsiveFill(p.right, fill, bound);
        if(p.up.color    != boun d&& p.up.color    != fill) 
            recurrsiveFill(p.up,    fill, bound);
        if(p.down.color  != bound && p.down.color  != fill) 
            recurrsiveFill(p.down,  fill, bound);
    }
    

    You can adapt this as necessary to suit your specific needs.

    This works for any fill for a completely bounded shape. You’ll also want to incorporate special conditions (edges of the picture, for example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have converted devise new session from erb to Haml but doens't work, this is
have a php code like this,going to convert it in to C#. function isValid($n){
Have a recurring situation, petty I know, but I'd like to consolidate the following:
Have a text box which get data for price. If someone enter something like
I have this ASP.NET/SQLServer2005 website running on a production server (Win2003, QuadCore, 4GB). The
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have a movieclip wich has a simple movement of a simple shape. This
Have searched the database but need to specifically sum(of hours flown or days off)in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.