Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
guiscalingfilter.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 <path.h>
9#include <rect.h>
10#include <SColor.h>
11
12namespace irr::video
13{
14 class IImage;
15 class ITexture;
16 class IVideoDriver;
17}
18
19/* Manually insert an image into the cache, useful to avoid texture-to-image
20 * conversion whenever we can intercept it.
21 */
22void guiScalingCache(const io::path &key, video::IVideoDriver *driver, video::IImage *value);
23
24// Manually clear the cache, e.g. when switching to different worlds.
26
27/* Get a cached, high-quality pre-scaled texture for display purposes. If the
28 * texture is not already cached, attempt to create it. Returns a pre-scaled texture,
29 * or the original texture if unable to pre-scale it.
30 */
31video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver, video::ITexture *src,
32 const core::rect<s32> &srcrect, const core::rect<s32> &destrect);
33
34/* Convenience wrapper for guiScalingResizeCached that accepts parameters that
35 * are available at GUI imagebutton creation time.
36 */
37video::ITexture *guiScalingImageButton(video::IVideoDriver *driver, video::ITexture *src,
38 s32 width, s32 height);
39
40/* Replacement for driver->draw2DImage() that uses the high-quality pre-scaled
41 * texture, if configured.
42 */
43void draw2DImageFilterScaled(video::IVideoDriver *driver, video::ITexture *txr,
44 const core::rect<s32> &destrect, const core::rect<s32> &srcrect,
45 const core::rect<s32> *cliprect = nullptr,
46 const video::SColor *const colors = nullptr, bool usealpha = false);
47
48/*
49 * 9-slice / segment drawing
50 */
51void draw2DImage9Slice(video::IVideoDriver *driver, video::ITexture *texture,
52 const core::rect<s32> &destrect, const core::rect<s32> &srcrect,
53 const core::rect<s32> &middlerect, const core::rect<s32> *cliprect = nullptr,
54 const video::SColor *const colors = nullptr);
void guiScalingCache(const io::path &key, video::IVideoDriver *driver, video::IImage *value)
Definition guiscalingfilter.cpp:31
void guiScalingCacheClear()
Definition guiscalingfilter.cpp:46
void draw2DImageFilterScaled(video::IVideoDriver *driver, video::ITexture *txr, const core::rect< s32 > &destrect, const core::rect< s32 > &srcrect, const core::rect< s32 > *cliprect=nullptr, const video::SColor *const colors=nullptr, bool usealpha=false)
Definition guiscalingfilter.cpp:156
video::ITexture * guiScalingResizeCached(video::IVideoDriver *driver, video::ITexture *src, const core::rect< s32 > &srcrect, const core::rect< s32 > &destrect)
Definition guiscalingfilter.cpp:64
void draw2DImage9Slice(video::IVideoDriver *driver, video::ITexture *texture, const core::rect< s32 > &destrect, const core::rect< s32 > &srcrect, const core::rect< s32 > &middlerect, const core::rect< s32 > *cliprect=nullptr, const video::SColor *const colors=nullptr)
Definition guiscalingfilter.cpp:178
video::ITexture * guiScalingImageButton(video::IVideoDriver *driver, video::ITexture *src, s32 width, s32 height)
Definition guiscalingfilter.cpp:143
Definition clientmap.h:35