summaryrefslogtreecommitdiff
path: root/src/guiscalingfilter.h
diff options
context:
space:
mode:
authorAaron Suen <warr1024@gmail.com>2015-03-09 09:32:11 -0400
committerkwolekr <kwolekr@minetest.net>2015-04-01 00:01:05 -0400
commit6d61375cc72bad5c569d25c253adca4e3701dd27 (patch)
tree790accab0443ebcff77790da83a306d713045b01 /src/guiscalingfilter.h
parentb4247dff2e003dd8c5ea5a1f3ae349d0bfab90bc (diff)
downloadminetest-6d61375cc72bad5c569d25c253adca4e3701dd27.tar.gz
minetest-6d61375cc72bad5c569d25c253adca4e3701dd27.tar.bz2
minetest-6d61375cc72bad5c569d25c253adca4e3701dd27.zip
Clean scaling pre-filter for formspec/HUD.
Diffstat (limited to 'src/guiscalingfilter.h')
-rw-r--r--src/guiscalingfilter.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/guiscalingfilter.h b/src/guiscalingfilter.h
new file mode 100644
index 000000000..768fe8d52
--- /dev/null
+++ b/src/guiscalingfilter.h
@@ -0,0 +1,52 @@
+/*
+Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#ifndef _GUI_SCALING_FILTER_H_
+#define _GUI_SCALING_FILTER_H_
+
+#include "irrlichttypes_extrabloated.h"
+
+/* Manually insert an image into the cache, useful to avoid texture-to-image
+ * conversion whenever we can intercept it.
+ */
+void guiScalingCache(io::path key, video::IVideoDriver *driver, video::IImage *value);
+
+// Manually clear the cache, e.g. when switching to different worlds.
+void guiScalingCacheClear(video::IVideoDriver *driver);
+
+/* Get a cached, high-quality pre-scaled texture for display purposes. If the
+ * texture is not already cached, attempt to create it. Returns a pre-scaled texture,
+ * or the original texture if unable to pre-scale it.
+ */
+video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver, video::ITexture *src,
+ const core::rect<s32> &srcrect, const core::rect<s32> &destrect);
+
+/* Convenience wrapper for guiScalingResizeCached that accepts parameters that
+ * are available at GUI imagebutton creation time.
+ */
+video::ITexture *guiScalingImageButton(video::IVideoDriver *driver, video::ITexture *src,
+ s32 width, s32 height);
+
+/* Replacement for driver->draw2DImage() that uses the high-quality pre-scaled
+ * texture, if configured.
+ */
+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);
+
+#endif