2
0

guiscalingfilter.h 2.1 KB

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