interesting cylab, didnt think about having a transparent image and doing that…
I did find a solution last night though ! =D w00t, so it works perfectly, thanks for everyones help (will post code to solution, its not refactored yet so its kinda hard to follow, but heres the solution)
//g is graphics
//img is the square circle will be in
//value the sacle is multiplied, (1 for brighter, -1 for darker)
//filter the colors if they go over 255 or under 0
public void paint(Graphics2D g){
ImageBrightener.effectCircle(g, img, 1, true, 0, 0, 50, 50);
}
public class ImageBrightener {
public static void effectCircle(final Graphics2D g2, final BufferedImage image,
final int value, final boolean filter, final int x, final int y, final int width, final int height){
int[][] t = getRBGS(image, width, value, filter);
}
//scans circle finder array
//changes rbg values of image via the circlefinder array
static int[][] getRBGS(BufferedImage img, int radii, int value, boolean filter){
int[][] testbythis = CircleFinder.findCircle(radii, radii);
int[][] colors = new int[radii][radii];
for(int x=0;x<img.getWidth();x++){
for(int y=0;y<img.getHeight();y++){
if(testbythis[x][y] != 0){
int rgb = img.getRGB(x, y);
int alpha = ((rgb >> 24) & 0xff);
int red = ((rgb >> 16) & 0xff);
int green = ((rgb >> 8) & 0xff);
int blue = ((rgb ) & 0xff);
//System.out.println("Value: "+value);
//System.out.println("Test: "+testbythis[x][y]);
//System.out.println("Calc: "+testbythis[x][y]*value);
//System.out.println("Color: "+red);
//System.out.println("New C: "+(red+(testbythis[x][y]*value)));
//System.out.println("Color: "+green);
//System.out.println("New C: "+(green+(testbythis[x][y]*value)));
//System.out.println("Color: "+blue);
//System.out.println("New C: "+(blue+(testbythis[x][y]*value)));
red+= (testbythis[x][y] * value);
green+= (testbythis[x][y] * value);
blue+= (testbythis[x][y] * value);
if(filter){
if(red > 255)
red = 255;
if(green > 255)
green = 255;
if(blue > 255)
blue = 255;
if(red < 0)
red = 0;
if(green < 0)
green = 0;
if(blue < 0)
blue = 0;
}
rgb = (alpha << 24) | (red << 16) | (green << 8) | blue;
img.setRGB(x, y, rgb);
}//else
//colors[x][y] = -100;
}
}
return colors;
}
//create a buffered image, draw black rect on it
//draw 5 circles different colors, giving the circle a fade effect
//scan the rbg of the new image, if the color is the blue, put the respective number in the array
//return array
public class CircleFinder {
public static int[][] findCircle(int w, int h){
BufferedImage bi = new BufferedImage(w, h, Transparency.BITMASK);
Graphics2D g = bi.createGraphics();
g.setColor(Color.BLACK);
g.fillRect(0,0,w,h);
//g.setColor(Color.RED);
//g.fillOval(0,0,w,h);
int color = 255;
for(int i=0;i<5;i++){
Color c = new Color(0,0,color);
g.setColor(c);
int x = i*2;
int y = i*2;
int wi = w-(i*4);
int hi = w-(i*4);
g.fillOval(x,y,wi,hi);
color-=20;
}
//Test t = new Test(bi);
int[][] p = new int[w][h];
int multi = 1;
for(int x=0;x<w;x++){
for(int y=0;y<h;y++){
int rgb = bi.getRGB(x, y);
int red = ((rgb >> 16) & 0xff);
int blue = ((rgb ) & 0xff);
switch(blue){
case 255:
p[x][y] = 1;
break;
case 255-20:
p[x][y] = 2;
break;
case 255-40:
p[x][y] = 3;
break;
case 255-60:
p[x][y] = 4;
break;
case 255-80:
p[x][y] = 5;
break;
default:
p[x][y] = 0;
}
//if(red == 255){
// p[x][y] = 0;
//}else
// p[x][y] = 1;
}
}
return p;
}