All pastes #908936 Raw Edit

k4st

public text v1 · immutable
·published 2008-02-18 20:37 UTC
rendered paste body
public Picture circleNegate(int centerx, int centery, int radius)
{
  int x, y;
  Pixel pixelObj;
  for(y=centery-radius; y<=centery+radius; y++)
  {
     for(x = centerx-radius; x <= centerx+radius; x++) 
     {
        if(Math.sqrt((int)((x-centerx)*(x-centerx) - (y-centery)*(y-centery))) <= radius)
        {
         pixelObj= this.getPixel(x,y);
         pixelObj.setRed(255-pixelObj.getRed());
         pixelObj.setBlue(255-pixelObj.getBlue());
         pixelObj.setGreen(255-pixelObj.getGreen());
     }
  }
} 
  return this;
}