Re: 90 Rotation in one buffer only




Hi,

> //image width and height
> int w, h;

> //only first quadrant
> int w2 = w / 2;
> int h2 = h / 2;

> //loop through pixels
> for(int j = 0; j < h2; j++) {
> for(int i = 0; i < w2; i++) {
> tmp = getPixel(i, j);
> setPixel(i, j, getPixel(i, h - j));
> setPixel(i, h - j, getPixel(w - i, h - j));
> setPixel(w - i, h - j, getPixel(w - i, j));
> setPixel(w - i, j, tmp);
> }
> }

Except that this doesn't work. If you split your image into four parts,
labeled 1,2,3,4 from left to right, top to bottom, this flips 3 to 1, 4 to
3, 2 to 4 and 1 to 2. However, each of these operations is a mirroring.
If 1,2,3,4 contain letters, they will come out "left handed" after this
operation has been performed. Thus, no rotataion here, sorry.

So long,
Thomas
.



Relevant Pages

  • Re: BufferedImage
    ... > i am creating images in java using ... > into integer pixels. ... That is because every pixel is packed into an int, ... Prev by Date: ...
    (comp.lang.java.help)
  • Re: 4-level image compression ?
    ... I'm playing with a small system where the display is 320x240 pixels, ... at which point one could also encode the delta. ... the above would use 64 bytes for the encode table, and 256 for decode. ... int paeth ...
    (comp.compression)
  • Re: Transparent Blit with NT4
    ... >> I should copy pixels form src to dest skipping pixels with color ... > bool ChromaBlt(HDC outDC, int inX, int inY, int outWidth, int ... > If you can't use any kind of mask at all then if the image you're ... transparent colour set to &00FFFFFF. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: [Linux-fbdev-devel] [PATCH] fbdev: fix fillrect for 24bpp modes
    ... pixels per machine word is not an integer. ... the native cpu endians. ... int dst_idx, unsigned long pat, int left, ...
    (Linux-Kernel)
  • Re: 1bpp to 8bpp grayscale smoothing (performance)
    ... int h = img.Height; ... and set the four pixels to this mean value. ... > // pixel except those in the first row and the first column, ...
    (microsoft.public.dotnet.framework.drawing)