Minetest  5.4.0
guiscalingfilter.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 
19 #pragma once
20 
22 
23 /* Manually insert an image into the cache, useful to avoid texture-to-image
24  * conversion whenever we can intercept it.
25  */
26 void guiScalingCache(const io::path &key, video::IVideoDriver *driver, video::IImage *value);
27 
28 // Manually clear the cache, e.g. when switching to different worlds.
30 
31 /* Get a cached, high-quality pre-scaled texture for display purposes. If the
32  * texture is not already cached, attempt to create it. Returns a pre-scaled texture,
33  * or the original texture if unable to pre-scale it.
34  */
35 video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver, video::ITexture *src,
36  const core::rect<s32> &srcrect, const core::rect<s32> &destrect);
37 
38 /* Convenience wrapper for guiScalingResizeCached that accepts parameters that
39  * are available at GUI imagebutton creation time.
40  */
41 video::ITexture *guiScalingImageButton(video::IVideoDriver *driver, video::ITexture *src,
42  s32 width, s32 height);
43 
44 /* Replacement for driver->draw2DImage() that uses the high-quality pre-scaled
45  * texture, if configured.
46  */
47 void draw2DImageFilterScaled(video::IVideoDriver *driver, video::ITexture *txr,
48  const core::rect<s32> &destrect, const core::rect<s32> &srcrect,
49  const core::rect<s32> *cliprect = 0, const video::SColor *const colors = 0,
50  bool usealpha = false);
51 
52 /*
53  * 9-slice / segment drawing
54  */
55 void draw2DImage9Slice(video::IVideoDriver *driver, video::ITexture *texture,
56  const core::rect<s32> &rect, const core::rect<s32> &middle,
57  const core::rect<s32> *cliprect = nullptr,
58  const video::SColor *const colors = nullptr);
void draw2DImageFilterScaled(video::IVideoDriver *driver, video::ITexture *txr, const core::rect< s32 > &destrect, const core::rect< s32 > &srcrect, const core::rect< s32 > *cliprect=0, const video::SColor *const colors=0, bool usealpha=false)
Definition: guiscalingfilter.cpp:155
void guiScalingCache(const io::path &key, video::IVideoDriver *driver, video::IImage *value)
Definition: guiscalingfilter.cpp:43
void guiScalingCacheClear()
Definition: guiscalingfilter.cpp:54
video::ITexture * guiScalingImageButton(video::IVideoDriver *driver, video::ITexture *src, s32 width, s32 height)
Definition: guiscalingfilter.cpp:142
video::ITexture * guiScalingResizeCached(video::IVideoDriver *driver, video::ITexture *src, const core::rect< s32 > &srcrect, const core::rect< s32 > &destrect)
Definition: guiscalingfilter.cpp:72
void draw2DImage9Slice(video::IVideoDriver *driver, video::ITexture *texture, const core::rect< s32 > &rect, const core::rect< s32 > &middle, const core::rect< s32 > *cliprect=nullptr, const video::SColor *const colors=nullptr)
Definition: guiscalingfilter.cpp:173