Luanti 5.15.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 video
12{
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/* Returns the gamma-correct average color of the image, with transparent pixels
30 * ignored. */
31video::SColor imageAverageColor(const video::IImage *img);
32
33/* Scale a region of an image into another image, using nearest-neighbor with
34 * anti-aliasing; treat pixels as crisp rectangles, but blend them at boundaries
35 * to prevent non-integer scaling ratio artifacts. Note that this may cause
36 * some blending at the edges where pixels don't line up perfectly, but this
37 * filter is designed to produce the most accurate results for both upscaling
38 * and downscaling.
39 */
40void imageScaleNNAA(video::IImage *src, const core::rect<s32> &srcrect, video::IImage *dest);
void imageCleanTransparent(video::IImage *src, u32 threshold)
Definition imagefilters.cpp:109
void imageScaleNNAA(video::IImage *src, const core::rect< s32 > &srcrect, video::IImage *dest)
Definition imagefilters.cpp:220
video::SColor imageAverageColor(const video::IImage *img)
Definition imagefilters.cpp:209
Definition clientmap.h:36