Also, the method would have to be able to change any part of the image so not only the eyes, if needed of course so would that work in such case as well? Just a little a bit on arrays but that's about it.
JAVA PIXEL SORTER HOW TO
To be honest with you, I was not taught how to create linked lists or any of the storage methods yet. I.e: we do a floodfill with color W, to non-C, in the terms of my old BASIC. Now, create a Queue (a LinkedList is fine!) andĬhange the corresponding pixel to W (see your libray for a suitable method!)įor each neighbor: if the color of the corresponding pixel is C, put it on the queue. Let the color of that point be C, and let the wanted color be W Of which you are certain it is part of the eye that needs One way would be to get the coordinates of a point (pixel) PictObj.write(FileChooser.getMediaDirectory() + "/orangeEyes.jpg") Īnd as you can probably tell the method needs to accept these variables: x, y, width, height, original colour and new colour. Write(FileChooser.getMediaDirectory() + "/butterfly1edges.jpg") PictObj.EdgeColour(0, 0, pictObj.getWidth(), pictObj.getHeight(), 10). Picture pictObj = new Picture(FileChooser.pickAFile()) But I'm not sure how to do that exactly.įtMediaPath("mediasources/") the end of an eye) or in fact orange and it would change to white.
So I was thinking about doing a loop that would detect whether the colour is different to orange and then stop (i.e. What's the simplest way to change the colours of individual pixels in IntelliJ? If I was to for example, change the colour of the eyes to orange (from white) in this picture: The problem is however, to make sure that the orange doesn't go outside the eyes.