Hi,
I've been trying to get this function to work all week and I keep getting the error message "could not find a method to load flowers" (that's the name of the file). If it were to work, the colors of the checkerboard pattern should swap when the mouse is clicked, I have no idea what the error message means and I've tried everything to fix it but nothing works. Any and all help would be greatly appreciated!
Thanks!
PImage theImage, im1, im2, im3;
void setup()
{
size(500, 500);
theImage = loadImage ("flowers");
PImage im1, im2, im3 ;
im1 = loadImage("flowers.jpg") ;
float r, g, b;
color tempColor, newColor;
{
size(500, 500);
theImage = loadImage ("flowers");
PImage im1, im2, im3 ;
im1 = loadImage("flowers.jpg") ;
float r, g, b;
color tempColor, newColor;
im2 = im1.get(1, 100, 200, 200) ;
im3 = im1.get(1, 100, 200, 200);
im3 = im1.get(1, 100, 200, 200);
for (int i=0; i < im3.width; i++)
{
for (int j=0; j < im3.height; j++)
{
tempColor=im3.get(i, j);
r=red(tempColor);
g=green(tempColor);
b=blue(tempColor);
newColor=color(r+50, g-100, b+50);
im3.set(i, j, newColor);
}
}
for (int i = 0 ; i <=5 ; i++)
{
for (int j = 0 ; j <=5 ; j++)
{
if (((i+j)%2) == 0)
image(im3, i*100, j*100);
else
image (im2, i*100, j*100) ;
}
}
}
{
for (int j=0; j < im3.height; j++)
{
tempColor=im3.get(i, j);
r=red(tempColor);
g=green(tempColor);
b=blue(tempColor);
newColor=color(r+50, g-100, b+50);
im3.set(i, j, newColor);
}
}
for (int i = 0 ; i <=5 ; i++)
{
for (int j = 0 ; j <=5 ; j++)
{
if (((i+j)%2) == 0)
image(im3, i*100, j*100);
else
image (im2, i*100, j*100) ;
}
}
}
PImage colorize (PImage theImage)
{
PImage output = theImage.get(0, 0, theImage.width, theImage.height);
{
PImage output = theImage.get(0, 0, theImage.width, theImage.height);
im1 = loadImage("flowers.jpg");
float r, g, b;
color tempColor, newColor;
color tempColor, newColor;
im2 = im1.get(1, 100, 100, 100) ;
im3 = im1.get(1, 100, 100, 100);
im3 = im1.get(1, 100, 100, 100);
for (int i=0; i < im3.width; i++)
{
for (int j=0; j < im3.height; j++)
{
tempColor=im3.get(i, j);
r=red(tempColor);
g=green(tempColor);
b=blue(tempColor);
newColor=color(r+50, g-100, b+50);
im3.set(i, j, newColor);
}
}
{
for (int j=0; j < im3.height; j++)
{
tempColor=im3.get(i, j);
r=red(tempColor);
g=green(tempColor);
b=blue(tempColor);
newColor=color(r+50, g-100, b+50);
im3.set(i, j, newColor);
}
}
for (int i = 0 ; i <=5 ; i++)
{
for (int j = 0 ; j <=5 ; j++)
{
if (((i+j)%2) == 0)
image(im2, i*100, j*100);
else
image (im3, i*100, j*100) ;
}
}
return output;
}
{
for (int j = 0 ; j <=5 ; j++)
{
if (((i+j)%2) == 0)
image(im2, i*100, j*100);
else
image (im3, i*100, j*100) ;
}
}
return output;
}
void draw()
{
}
{
}
int counter = 0;
void mousePressed()
{
counter++;
{
counter++;
if (counter==0)
{
PImage im1 = colorize (theImage);
image (im1, 0, 0);
counter=0;
}
}
{
PImage im1 = colorize (theImage);
image (im1, 0, 0);
counter=0;
}
}
1