Inspired by the article
“Transparent pixels also have feelings or artifacts of png'shek with transparency,” I decided to talk about some of the problems that may arise when developing a 2D game.
In this article I would like to talk about the non-trivial problems that I had to face when developing 2D games related to texture filtering.
All these artifacts occur when texture filtering is enabled. As well as scaling, rotation of the texture or if it has fractional coordinates.
A little about filtering textures.
Textures overlaid on triangles in screen space. Usually the size of the triangular fragment of the texture is different from the size of the triangular face on the screen. When the texture fragment is smaller than the image of the face on the screen, the texture fragment is enlarged to the size of the face. When the texture is larger than the edge on the screen, it shrinks. In both cases, distortion occurs.
Filtering is a technique for reducing these distortions.
Filtering is very useful, but as it turned out, it can cause some problems in applications where it is important that the original image is identical to the original one.
')
Let this image we want to display:

Textured Addressing.
Texture addressing modes indicate how the video processor should behave if the texture coordinate of the triangle's vertex goes beyond the image. There are four types of addressing: wrapping (wrap), frame color (border color), single overlay (clamp), and reflection (mirror).
When the WRAP texture addressing mode is set, the pixels on one side of the image fall on the other.

Decision:
Use WRAP addressing only if necessary. If you just need to bring out the texture, use the CLAMP mode.
Textures whose dimensions, width or height, are not multiples of a power of two.
On some video cards, textures whose dimensions, width or height, are not multiple of a power of two, are supplemented. And we get the following image:

Of course, we will not see the augmented part of the image on the screen. You can find out about its existence by getting a texture buffer and finding that it is larger than expected. But this part will be involved in filtering. As a result of this, we can see its part on the border of the image.

Decision:
You can fill this area, in whole or in part, with pixels that lie on the border. Like this:

Common decision:
As a
general solution , you can leave a frame of several pixels around the texture area that will fall on the screen.
The blue frame is the area to be displayed on the screen.Another solution is to leave a transparent frame at the edges of the image.

But in this case, there may be a problem from the article, which is listed at the beginning. But it is also solvable. For example, you can use the program
PVRTextureTool .
Sources:
1. Frank D. Luna. Introduction to programming 3D games with DX9. Wordware Publishing, 2003. ISBN: 1-55622-922-4