Skip to content

graphx: Rotated scaled sprite results in distortions to original sprite even if the rotation angle is a multiple of 64 (90 degrees in reality), even at small sizes #813

Description

@Puffycosmo

When rotating a sprite with the gfx_RotatedTransparentSprite, an asset undergoes a slight mutilation even when the passed value is 128 (180 degrees). It is reflected across the x-axis, but parts of it are offset relative to the unrotated original. The sprite is 16x16, which is much smaller than the stated 210 x 210 threshold for artifacts. Code and the asset in question are included:

gfx_TransparentSprite(arrowFilled, 111 + 98 + 15, 71); gfx_RotatedTransparentSprite(arrowFilled, 111 + 98 + 15, 169, 128);

Original asset:
Image

Result of rotation:
Image

The 'head' of the arrow is noticeably offset relative to the 'body', which is not present in the original.

I haven't tested it for other angle values and other sprites yet, but this issue would probably generalize to others, as I see nothing special in this asset. Since gfx_RotatedTransparentSprite uses (I believe) the same logic as the other rotated sprite drawing routines, it makes sense that it would also affect the others.

Of course, I expect significant distortions to occur when the rotation angle is not a multiple of 64 (90 degrees), as resolution is very low, but it seems to me that this shouldn't happen for angular multiples of 90, much less 180 degrees? I'm not familiar with the inner workings of graphx, but it's intuitive that this is one of the special situations where a rotation would not cause a distortion...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions