Jaggy-o-mania

This topic contains 1 reply, has 2 voices, and was last updated by  abakobo 1 year, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11837

    PhatPeter
    Participant

    I can’t understand why the drawings gets jagged.
    Am drawing 45 degree rotated sprites on both the canvas (which comes out nicely) I also draw the same inside an image.

    I then draw THAT image at a 45 degree angle onto the canvas to make everything 90 degree again, well I hoped.
    It looks terrible how could it deteriorate that fast when the first copy look so perfect?
    Any solution to this?

    Make a few clicks in the upper left corner to create some visible sprites.

    #11849

    abakobo
    Participant

    You can’t have pixel perfect cascaded bitmap rotation unless you use only pi/2.0 multiples. Even a single pi/4.0 rotation is not pixel perfect. Play arround with gimp or whatever image program and you’ll see it can’t be done. The edges seems to have the same length but are not represented by the same number of pixels thus rounding thus data lost. In you app case they look different because the center of rotation is different thus other rounding. (and there’s some sin() cos() under the hood when rotating with a matrix to refer to another of your post I’ve read)

    You’ll have to go parametric and draw stuff only once when the final rotation/translation/size is known (doable with matrix), and on a canvas you won’t rotate later! Or you can also go vecto-drawings (which is even more parametric).
    You could also use bigger images then scale them down so the jaggs are less visible but it won’t be pixel perfect neither, that’s how gimp and other image manipulation program will do under the hodd (adding (bi)linear interpolation and antialisaing to look nice)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.