This site requires JavaScript, please enable it in your browser!
Greenfoot back
ironphoenix20
ironphoenix20 wrote ...

2017/5/8

Emboss Image new

1
2
3
ironphoenix20 ironphoenix20

2017/5/8

#
Now it says setColor cannot be applied to (int, int, greenfoot.color) but only (greenfoot.color)
ironphoenix20 ironphoenix20

2017/5/8

#
never mind, i changed it to setColorAt
danpost danpost

2017/5/8

#
ironphoenix20 wrote...
never mind, i changed it to setColorAt
Yeah. It should work now.
ironphoenix20 ironphoenix20

2017/5/8

#
the method is not working. nothing is happening to my image when i click emboss.
danpost danpost

2017/5/8

#
ironphoenix20 wrote...
the method is not working. nothing is happening to my image when i click emboss.
Show the code where the click is detected and specify the class it is in.
ironphoenix20 ironphoenix20

2017/5/8

#
else if (Greenfoot.mouseClicked(emboss)){
                if (redoImages.size()>0)
                {
                    redoCount = 0;
                    redoImages.clear();
                }
                //if(undoCount>0)
                undoImages.add(createGreenfootImageFromBI(deepCopy(image.getBufferedImage())));
                undoImages.trimToSize();
                Processor.emboss(image.getBufferedImage()); 
                undoCount++; 
            }
This is in the world class. emboss is my button. line 10 should be changing the image.
danpost danpost

2017/5/8

#
How is 'image' declared and what is the 'getBufferedImage' method?
ironphoenix20 ironphoenix20

2017/5/8

#
I am just getting the buffered image (backing image) of the greenfoot image and manipulating that through the emboss method. In the method, all I changed from yours was that the parameter is a bufferedimage which gets converted into a greenfoot image, then embossed, then converted back to a bufferedimage. and image is declared in the beginning of the world class as a greenfoot image
ironphoenix20 ironphoenix20

2017/5/8

#
i think there's something wrong with the actual method that's not embossing the pixels properly as there seems to be no error in the world class or calling the method, etc.
danpost danpost

2017/5/8

#
ironphoenix20 wrote...
i think there's something wrong with the actual method that's not embossing the pixels properly as there seems to be no error in the world class or calling the method, etc.
Well, I know if you pass the GreenfootImage itself, 'image', to the method as I modified it, that it works. I did notice that the alpha part of the pixels where being changed by the process before I modified it. The image was coming up something like a flat translucent gray.
ironphoenix20 ironphoenix20

2017/5/8

#
Really? It works? Let me try again.
danpost danpost

2017/5/8

#
ironphoenix20 wrote...
Really? It works? Let me try again.
Proof is in the demo -- here.
ironphoenix20 ironphoenix20

2017/5/8

#
Wheres the demo?
ironphoenix20 ironphoenix20

2017/5/8

#
your simulation has a timer for the emboss. can i use your method to make the emboss happen immediately when i press a button?
ironphoenix20 ironphoenix20

2017/5/8

#
the code still doesn't work in my simulation. maybe because i don't have a timer. i need it to just change the image to an embossed image immediately.
There are more replies on the next page.
1
2
3