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#include <SColor.h>
10
11namespace irr::video
12{
13 class IVideoDriver;
14 class IImage;
15}
16
17/* Fill in RGB values for transparent pixels, to correct for odd colors
18 * appearing at borders when blending. This is because many PNG optimizers
19 * like to discard RGB values of transparent pixels, but when blending then
20 * with non-transparent neighbors, their RGB values will show up nonetheless.
21 *
22 * This function modifies the original image in-place.
23 *
24 * Parameter "threshold" is the alpha level below which pixels are considered
25 * transparent. Should be 127 when the texture is used with ALPHA_CHANNEL_REF,
26 * 0 when alpha blending is used.
27 */
28void imageCleanTransparent(video::IImage *src, u32 threshold);
29
30/* Returns the gamma-correct average color of the image, with transparent pixels
31 * ignored. */
32video::SColor imageAverageColor(const video::IImage *img);
33
34/* Scale a region of an image into another image, using nearest-neighbor with
35 * anti-aliasing; treat pixels as crisp rectangles, but blend them at boundaries
36 * to prevent non-integer scaling ratio artifacts. Note that this may cause
37 * some blending at the edges where pixels don't line up perfectly, but this
38 * filter is designed to produce the most accurate results for both upscaling
39 * and downscaling.
40 */
41void imageScaleNNAA(video::IImage *src, const core::rect<s32> &srcrect, video::IImage *dest);
42
43/* Check and align image to npot2 if required by hardware
44 * @param image image to check for npot2 alignment
45 * @param driver driver to use for image operations
46 * @return image or copy of image aligned to npot2
47 */
48video::IImage *Align2Npot2(video::IImage *image, video::IVideoDriver *driver);
49
void imageCleanTransparent(video::IImage *src, u32 threshold)
Definition imagefilters.cpp:151
video::IImage * Align2Npot2(video::IImage *image, video::IVideoDriver *driver)
Definition imagefilters.cpp:353
void imageScaleNNAA(video::IImage *src, const core::rect< s32 > &srcrect, video::IImage *dest)
Definition imagefilters.cpp:262
video::SColor imageAverageColor(const video::IImage *img)
Definition imagefilters.cpp:251
Definition clientmap.h:35