Proper way to scale an SDL Surface without clipping?

前端 未结 3 606
星月不相逢
星月不相逢 2021-01-12 04:51

what is the proper way to scale an SDL Surface? I found one explanation online but it required redrawing the Surface pixel by pixel. It seems like there should be some way o

3条回答
  •  遥遥无期
    2021-01-12 05:09

    SDL doesn't support scaled blitting. According to the documentation of SDL_BlitSurface:

    Note: the SDL blitter does not (yet) have the capability of scaling the blitted surfaces up or down like it is the case with other more sophisticated blitting mechanisms. You have to figure something out for yourself if you want to scale images (e.g. use SDL_gfx).

    You could find SDL_gfx here. Writing your own blitting function isn't that bad, it might be a fun and useful learning experiment (though you'd be reinventing the wheel). Using OpenGL is also an option, as stuff like scaling and rotating could be done in a single function call.

提交回复
热议问题