This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How paint non-rectangular java.awt.geom.Area or break Area into Rectangles?  RSS feed

 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a window that has rectangles (set at runtime) which are drawn a certain way and then the leftover area needs to be drawn in. (See below) I have been unable to use:



Because Graphics does not support non-rectangular Shape objects. I was thinking of breaking up the leftover area into rectangles, but I don't know how to do this. Can anyone help me?


[ January 26, 2005: Message edited by: Dan Bizman ]
 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ouch, I've posted three separate questions and gotten no answers. Please, can someone help me with this?

I need to figure out how to break an Area into rectangles.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because Graphics does not support non-rectangular Shape objects
Constructing Complex Shapes from Geometry Primitives
 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the code! I'm not sure if it will work though because while "fill(...)" can do those shapes, I don't think "setClip(...)" and "drawImage(...)" can do it with such a space (like your yellow space). Were you able to get that to work with drawing an image into the yellowed space after setting the clip?

I'll see if I can get it to work.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!