Verlustfrei in 90° Winkeln drehen

Previous topic - Next topic

mull

Ich möchte gern ein im Programm erstelltes Rechteck um jeweils 90° b.z.w 180° drehen und dabei die gleiche Qualität beibehalten. Dieses will ich dann mit Grabsprite in eine neues Sprite kopieren.
Bei RotoSprite ist immer ein kleiner Qualitätsverlust.
Bei 90° drehungen müste es doch 1:1 gehen ?
AMD Phenom II x4 955 Proc. 3.2 GHZ,  4GB Ram
Windows 7 64bit Ultima
NVIDIA GeForce GTX 460
Leistungsindex 5,7

Moru

Try
SMOOTHSHADING FALSE
before you draw the sprite.

erico

Moru´s advice should get you a perfect quality square rotation.
You can always get the image info into an array and rotate it yourself, although I have just a slight idea on that, and at the final, it will look the same.

mull

#3
Habe es so gelöst in dem ich die Matrix gedreht habe.

           SPRITE2MEM(pix[], Feld.Img)
            // Drehen um 90° rechts
            LOCAL a%, b%, tmp%[] ; DIM tmp[w% * h%]
            FOR y% = 0 TO h-1
               FOR x% = 0 TO w-1
                  b = h-1-y + x * h ; a = w * y + x
                  tmp = pix[a]
               NEXT
            NEXT
            MEM2SPRITE(tmp[], Feld.Img, h,w)
AMD Phenom II x4 955 Proc. 3.2 GHZ,  4GB Ram
Windows 7 64bit Ultima
NVIDIA GeForce GTX 460
Leistungsindex 5,7

Schranz0r

Quote from: mull on 2011-Dec-13
Habe es so gelöst in dem ich die Matrix gedreht habe.

           SPRITE2MEM(pix[], Feld.Img)
            // Drehen um 90° rechts
            LOCAL a%, b%, tmp%[] ; DIM tmp[w*h]
            FOR y = 0 TO h-1
               FOR x = 0 TO w-1
                  b = h-1-y + x * h ; a = w * y + x
                  tmp = pix[a]
               NEXT
            NEXT
            MEM2SPRITE(tmp[], Feld.Img, h,w)

FREAK! :D
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard