|
SpriteFilter | |
SpriteFilter ThisSprite, Mode | |
Parameters: ThisSprite = The Sprite that you want to change the filtering mode on Mode = Flag to set filtering mode the sprite should use (0=No filtering default, 1 = Bilinear) |
|
Returns: NONE | |
SpriteFilter is used to enable/disable the BiLinear sprite filtering. Sprite Filtering smoothes out the quality of rotated/scaled sprites. In particular when the sprite is scaled up. Without filtering, when a sprite is scaled up, each pixel expands, which can make the result look blocky. Filtering helps by interpolating (bleeding) neighboring pixels into each other. So the blocks become gradients in the output. You can blow the image up as far you like, but the bigger it gets the more pixels smudge together, Making it blurry. Also, if we scale an image down, the default scaling routines truncate the pixel it grabs without regard to the surrounding pixels. This can give some unwanted artifacts in some images, in particular images that have lots of dithered pixels, or grids/lines for example. Filtering can help reduce such effects also, since each pixels are the result of the weighted average of it's neighbors. Thus smoothing out the outputted image. It should be noted though that if you scale the image down to smaller than it's original size by more than 50%, then errors will start to be introduced. Here we see an example of sprite being filter when scaled at 50% intervals from 50 up to 200% of actual size. FACTS: * Sprite filtering is disabled (set to 0) by default. * When a filtered sprite is drawn, each pixel from the sprite image is blended with it's neighboring pixels. This blending calculation is heavy (on your CPU) to perform in real time, so it's best used sparingly. Pre-calculation is recommended. * Sprite filtering can make images blurry the bigger they're scaled. * See SpriteDrawMode for more effects that can be combined with sprite filtering. |
|
Example Source: Download This Example
|
Related Info: | GetSpriteFilter | GetSpriteTint | SpriteDrawMode | SpriteTint : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |