title: JAVA - swing - draw/fill with invert/negated colors of destination canvas
body: <p>I cannot find any info on how to draw shapes on a graphic canvas, making sure what I draw is not the same color as the background</p>
  
  <p>there are some solutions out there but they all use images drawing only with per pixel operations/loops or filters; I also tried different Composite operations, but none suit what I want</p>
  
  <p>so lets say I do </p>
  
  <pre><code>g.setColor(color.white) // relevant in this case ? not sure
  g.fillRect(...)
  </code></pre>
  
  <p>I want the rectangle to be in inverted colors of the background so it is always visible</p>
  
  <p>sorry I cant provide more code, I really dont know how to achieve this</p>
  
  <p>thanks</p>