Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
imagefilters.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
4
5#pragma once
6
7#include "irrlichttypes.h"
8#include <rect.h>
9
10namespace irr::video
11{
12 class IVideoDriver;
13 class IImage;
14}
15
16/* Fill in RGB values for transparent pixels, to correct for odd colors
17 * appearing at borders when blending. This is because many PNG optimizers
18 * like to discard RGB values of transparent pixels, but when blending then
19 * with non-transparent neighbors, their RGB values will show up nonetheless.
20 *
21 * This function modifies the original image in-place.
22 *
23 * Parameter "threshold" is the alpha level below which pixels are considered
24 * transparent. Should be 127 when the texture is used with ALPHA_CHANNEL_REF,
25 * 0 when alpha blending is used.
26 */
27void imageCleanTransparent(video::IImage *src, u32 threshold);
28
29/* Scale a region of an image into another image, using nearest-neighbor with
30 * anti-aliasing; treat pixels as crisp rectangles, but blend them at boundaries
31 * to prevent non-integer scaling ratio artifacts. Note that this may cause
32 * some blending at the edges where pixels don't line up perfectly, but this
33 * filter is designed to produce the most accurate results for both upscaling
34 * and downscaling.
35 */
36void imageScaleNNAA(video::IImage *src, const core::rect<s32> &srcrect, video::IImage *dest);
37
38/* Check and align image to npot2 if required by hardware
39 * @param image image to check for npot2 alignment
40 * @param driver driver to use for image operations
41 * @return image or copy of image aligned to npot2
42 */
43video::IImage *Align2Npot2(video::IImage *image, video::IVideoDriver *driver);
44
void imageCleanTransparent(video::IImage *src, u32 threshold)
Definition imagefilters.cpp:162
video::IImage * Align2Npot2(video::IImage *image, video::IVideoDriver *driver)
Definition imagefilters.cpp:268
void imageScaleNNAA(video::IImage *src, const core::rect< s32 > &srcrect, video::IImage *dest)
Definition imagefilters.cpp:177
Definition clientmap.h:35