please give me the coding for dividing the image into four parts from the center in Java Advanced Imaging..
+1
A:
Not sure about JAI, but here's the BufferedImage
approach which you might use as an input for JAI. So maybe this works for your usecase
public static BufferedImage[] divide(BufferedImage source) {
// for odd widths or heights, the last row or column will be ignored
// fixing this behaviour is left as an exercise to the eager
int height = source.getHeight() / 2;
int width = source.getWidth() / 2;
return new BufferedImage[] {
source.getSubimage(0, 0, height, width), // top left
source.getSubimage(width, 0, height, width), // top right
source.getSubimage(0, height, height, width), // bottom left
source.getSubimage(width, height, width, height) // bottom right
};
}
sfussenegger
2010-02-03 09:44:11
+1
A:
There's an interesting bit of trompe-l'oeil in Sun's Java2D* demo using four unequal parts.
* See the lower, right quadrant of the Images
tab.
trashgod
2010-02-03 16:54:23
+1 for make me wonder about what <b>trompe-l'oeil</b> means ;-)
stacker
2010-02-07 19:51:34