Re: 90 Rotation in one buffer only
- From: "Andrey Kuznetsov" <spam0@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 24 Nov 2005 23:20:09 +0100
and here is clockwise rotate:
public void rotate() {
int w = width - 1;
int h = height - 1;
int w2 = width / 2;
int h2 = height / 2;
int tmp;
for (int y = 0; y < h2; y++) {
for (int x = 0; x < w2; x++) {
tmp = getPixel(x, y);
setPixel(x, y, getPixel(y, h - x));
setPixel(y, h - x, getPixel(w - x, h - y));
setPixel(w - x, h - y, getPixel(w - y, x));
setPixel(w - y, x, tmp);
}
}
}
--
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
.
- Follow-Ups:
- Re: 90 Rotation in one buffer only
- From: Naresh
- Re: 90 Rotation in one buffer only
- References:
- 90 Rotation in one buffer only
- From: Naresh
- Re: 90 Rotation in one buffer only
- From: Andrey Kuznetsov
- Re: 90 Rotation in one buffer only
- From: Thomas Richter
- Re: 90 Rotation in one buffer only
- From: Andrey Kuznetsov
- 90 Rotation in one buffer only
- Prev by Date: Re: 90 Rotation in one buffer only
- Next by Date: Re: 90 Rotation in one buffer only
- Previous by thread: Re: 90 Rotation in one buffer only
- Next by thread: Re: 90 Rotation in one buffer only
- Index(es):
Relevant Pages
|