public void fülle(Graphics g, Point pixel, BufferedImage bild, ZeichenBlock block)
{
//hier füllt er flächen aus
System.out.println("füllen");
try{
Color ausgangs_farbe = new Color(bild.getRGB(pixel.x, pixel.y));
Color füllFarbe= g.getColor();
Point[] umliegende_Pixel=getUmliegendePixel(pixel, bild, ausgangs_farbe);
try{
for(int i=0;i<umliegende_Pixel.length; i++ )
{
fülle(g, umliegende_Pixel[i], bild, block);
}
}catch(java.lang.StackOverflowError e){}
g.drawLine(pixel.x, pixel.y, pixel.x, pixel.y);
}catch(java.lang.ArrayIndexOutOfBoundsException e){System.err.println(e);}
//System.out.println(ausgangs_farbe);
}
Point[] getUmliegendePixel(Point pixel, BufferedImage bild, Color ausgangs_farbe)
{
Point[] last_Points=new Point[0];
Point[] Points=new Point[1];
if(new Color(bild.getRGB(pixel.x-1, pixel.y)).equals(ausgangs_farbe) )
{
try{
Points = new Point[last_Points.length+1];
}catch(java.lang.NullPointerException e){}
for(int i=0;i< Points.length-1;i++)
{
Points[i] = last_Points[i];
}
Points[Points.length-1]=new Point(pixel.x-1, pixel.y);
}
if(new Color(bild.getRGB(pixel.x+1, pixel.y)).equals(ausgangs_farbe) )
{
try{
Points = new Point[last_Points.length+1];
}catch(java.lang.NullPointerException e){}
for(int i=0;i< Points.length-1;i++)
{
Points[i] = last_Points[i];
}
Points[Points.length-1]=new Point(pixel.x+1, pixel.y);
}
if(new Color(bild.getRGB(pixel.x, pixel.y-1)).equals(ausgangs_farbe) )
{
try{
Points = new Point[last_Points.length+1];
}catch(java.lang.NullPointerException e){}
for(int i=0;i< Points.length-1;i++)
{
Points[i] = last_Points[i];
}
Points[Points.length-1]=new Point(pixel.x, pixel.y-1);
}
if(new Color(bild.getRGB(pixel.x, pixel.y+1)).equals(ausgangs_farbe) )
{
try{
Points = new Point[last_Points.length+1];
}catch(java.lang.NullPointerException e){}
for(int i=0;i< Points.length-1;i++)
{
Points[i] = last_Points[i];
}
Points[Points.length-1]=new Point(pixel.x, pixel.y+1);
}
return Points;
}