GLBasic forum

Other languages => GLBasic - de => Topic started by: mull on 2011-Dec-12

Title: Verlustfrei in 90° Winkeln drehen
Post by: mull on 2011-Dec-12
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 ?
Title: Re: Verlustfrei in 90° Winkeln drehen
Post by: Moru on 2011-Dec-12
Try
SMOOTHSHADING FALSE
before you draw the sprite.
Title: Re: Verlustfrei in 90° Winkeln drehen
Post by: erico on 2011-Dec-12
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.
Title: Re: Verlustfrei in 90° Winkeln drehen
Post by: 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)
Title: Re: Verlustfrei in 90° Winkeln drehen
Post by: Schranz0r on 2011-Dec-13
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