MyGUI 3.5.3
MyGUI_TextureUtility.cpp
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#include "MyGUI_Precompiled.h"
10
12{
13
14#if !defined(MYGUI_DONT_USE_OBSOLETE)
15 const IntSize& getTextureSize(const std::string& _texture, bool _cache)
16 {
17 return RenderManager::getInstance().getTextureSize(_texture, _cache);
18 }
19#endif
20
21 uint32 toNativeColour(const Colour& _colour, VertexColourType _format)
22 {
23 uint32 val32 = uint8(_colour.alpha * 255);
24 val32 <<= 8;
25 if (_format == VertexColourType::ColourABGR)
26 {
27 val32 += uint8(_colour.blue * 255);
28 val32 <<= 8;
29 val32 += uint8(_colour.green * 255);
30 val32 <<= 8;
31 val32 += uint8(_colour.red * 255);
32 }
33 else
34 {
35 val32 += uint8(_colour.red * 255);
36 val32 <<= 8;
37 val32 += uint8(_colour.green * 255);
38 val32 <<= 8;
39 val32 += uint8(_colour.blue * 255);
40 }
41 return val32;
42 }
43
44 void convertColour(uint32& _colour, VertexColourType _format)
45 {
46 if (_format == VertexColourType::ColourABGR)
47 _colour = ((_colour & 0x00FF0000) >> 16) | ((_colour & 0x000000FF) << 16) | (_colour & 0xFF00FF00);
48 }
49
50} // namespace MyGUI
const IntSize & getTextureSize(const std::string &_texture, bool _cache)
void convertColour(uint32 &_colour, VertexColourType _format)
uint32 toNativeColour(const Colour &_colour, VertexColourType _format)
uint32_t uint32
Definition MyGUI_Types.h:47
uint8_t uint8
Definition MyGUI_Types.h:45
types::TSize< int > IntSize
Definition MyGUI_Types.h:29