Loading...
Searching...
No Matches
SColor.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __COLOR_H_INCLUDED__
#define __COLOR_H_INCLUDED__
#include "irrTypes.h"
#include "irrMath.h"
namespace irr
{
namespace video
{
enum ECOLOR_FORMAT
{
ECF_A1R5G5B5 = 0,
ECF_R5G6B5,
ECF_R8G8B8,
ECF_A8R8G8B8,
ECF_R16F,
ECF_G16R16F,
ECF_A16B16G16R16F,
ECF_R32F,
ECF_G32R32F,
ECF_A32B32G32R32F,
ECF_UNKNOWN
};
inline u16 RGBA16(u32 r, u32 g, u32 b, u32 a=0xFF)
{
return (u16)((a & 0x80) << 8 |
(r & 0xF8) << 7 |
(g & 0xF8) << 2 |
(b & 0xF8) >> 3);
}
inline u16 RGB16(u32 r, u32 g, u32 b)
{
return RGBA16(r,g,b);
}
inline u16 RGB16from16(u16 r, u16 g, u16 b)
{
return (0x8000 |
(r & 0x1F) << 10 |
(g & 0x1F) << 5 |
(b & 0x1F));
}
inline u16 X8R8G8B8toA1R5G5B5(u32 color)
{
return (u16)(0x8000 |
( color & 0x00F80000) >> 9 |
( color & 0x0000F800) >> 6 |
( color & 0x000000F8) >> 3);
}
inline u16 A8R8G8B8toA1R5G5B5(u32 color)
{
return (u16)(( color & 0x80000000) >> 16|
( color & 0x00F80000) >> 9 |
( color & 0x0000F800) >> 6 |
( color & 0x000000F8) >> 3);
}
inline u16 A8R8G8B8toR5G6B5(u32 color)
{
return (u16)(( color & 0x00F80000) >> 8 |
( color & 0x0000FC00) >> 5 |
( color & 0x000000F8) >> 3);
}
inline u32 A1R5G5B5toA8R8G8B8(u16 color)
{
return ( (( -( (s32) color & 0x00008000 ) >> (s32) 31 ) & 0xFF000000 ) |
(( color & 0x00007C00 ) << 9) | (( color & 0x00007000 ) << 4) |
(( color & 0x000003E0 ) << 6) | (( color & 0x00000380 ) << 1) |
(( color & 0x0000001F ) << 3) | (( color & 0x0000001C ) >> 2)
);
}
inline u32 R5G6B5toA8R8G8B8(u16 color)
{
return 0xFF000000 |
((color & 0xF800) << 8)|
((color & 0x07E0) << 5)|
((color & 0x001F) << 3);
}
inline u16 R5G6B5toA1R5G5B5(u16 color)
{
return 0x8000 | (((color & 0xFFC0) >> 1) | (color & 0x1F));
}
inline u16 A1R5G5B5toR5G6B5(u16 color)
{
return (((color & 0x7FE0) << 1) | (color & 0x1F));
}
inline u32 getAlpha(u16 color)
{
return ((color >> 15)&0x1);
}
inline u32 getRed(u16 color)
{
return ((color >> 10)&0x1F);
}
inline u32 getGreen(u16 color)
{
return ((color >> 5)&0x1F);
}
inline u32 getBlue(u16 color)
{
return (color & 0x1F);
}
inline s32 getAverage(s16 color)
{
return ((getRed(color)<<3) + (getGreen(color)<<3) + (getBlue(color)<<3)) / 3;
}
class SColor
{
public:
SColor() {}
SColor (u32 a, u32 r, u32 g, u32 b)
: color(((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff)) {}
SColor(u32 clr)
: color(clr) {}
u32 getAlpha() const { return color>>24; }
u32 getRed() const { return (color>>16) & 0xff; }
u32 getGreen() const { return (color>>8) & 0xff; }
u32 getBlue() const { return color & 0xff; }
f32 getLightness() const
{
return 0.5f*(core::max_(core::max_(getRed(),getGreen()),getBlue())+core::min_(core::min_(getRed(),getGreen()),getBlue()));
}
f32 getLuminance() const
{
return 0.3f*getRed() + 0.59f*getGreen() + 0.11f*getBlue();
}
u32 getAverage() const
{
return ( getRed() + getGreen() + getBlue() ) / 3;
}
void setAlpha(u32 a) { color = ((a & 0xff)<<24) | (color & 0x00ffffff); }
void setRed(u32 r) { color = ((r & 0xff)<<16) | (color & 0xff00ffff); }
void setGreen(u32 g) { color = ((g & 0xff)<<8) | (color & 0xffff00ff); }
void setBlue(u32 b) { color = (b & 0xff) | (color & 0xffffff00); }
u16 toA1R5G5B5() const { return A8R8G8B8toA1R5G5B5(color); }
void toOpenGLColor(u8* dest) const
{
*dest = (u8)getRed();
*++dest = (u8)getGreen();
*++dest = (u8)getBlue();
*++dest = (u8)getAlpha();
}
void set(u32 a, u32 r, u32 g, u32 b)
{
color = (((a & 0xff)<<24) | ((r & 0xff)<<16) | ((g & 0xff)<<8) | (b & 0xff));
}
void set(u32 col) { color = col; }
bool operator==(const SColor& other) const { return other.color == color; }
bool operator!=(const SColor& other) const { return other.color != color; }
bool operator<(const SColor& other) const { return (color < other.color); }
SColor operator+(const SColor& other) const
{
return SColor(core::min_(getAlpha() + other.getAlpha(), 255u),
core::min_(getRed() + other.getRed(), 255u),
core::min_(getGreen() + other.getGreen(), 255u),
core::min_(getBlue() + other.getBlue(), 255u));
}
SColor getInterpolated(const SColor &other, f32 d) const
{
d = core::clamp(d, 0.f, 1.f);
const f32 inv = 1.0f - d;
return SColor((u32)core::round32(other.getAlpha()*inv + getAlpha()*d),
(u32)core::round32(other.getRed()*inv + getRed()*d),
(u32)core::round32(other.getGreen()*inv + getGreen()*d),
(u32)core::round32(other.getBlue()*inv + getBlue()*d));
}
SColor getInterpolated_quadratic(const SColor& c1, const SColor& c2, f32 d) const
{
// this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
d = core::clamp(d, 0.f, 1.f);
const f32 inv = 1.f - d;
const f32 mul0 = inv * inv;
const f32 mul1 = 2.f * d * inv;
const f32 mul2 = d * d;
return SColor(
core::clamp( core::floor32(
getAlpha() * mul0 + c1.getAlpha() * mul1 + c2.getAlpha() * mul2 ), 0, 255 ),
core::clamp( core::floor32(
getRed() * mul0 + c1.getRed() * mul1 + c2.getRed() * mul2 ), 0, 255 ),
core::clamp ( core::floor32(
getGreen() * mul0 + c1.getGreen() * mul1 + c2.getGreen() * mul2 ), 0, 255 ),
core::clamp ( core::floor32(
getBlue() * mul0 + c1.getBlue() * mul1 + c2.getBlue() * mul2 ), 0, 255 ));
}
void setData(const void *data, ECOLOR_FORMAT format)
{
switch (format)
{
case ECF_A1R5G5B5:
color = A1R5G5B5toA8R8G8B8(*(u16*)data);
break;
case ECF_R5G6B5:
color = R5G6B5toA8R8G8B8(*(u16*)data);
break;
case ECF_A8R8G8B8:
color = *(u32*)data;
break;
case ECF_R8G8B8:
{
u8* p = (u8*)data;
set(255, p[0],p[1],p[2]);
}
break;
default:
color = 0xffffffff;
break;
}
}
void getData(void *data, ECOLOR_FORMAT format)
{
switch(format)
{
case ECF_A1R5G5B5:
{
u16 * dest = (u16*)data;
*dest = video::A8R8G8B8toA1R5G5B5( color );
}
break;
case ECF_R5G6B5:
{
u16 * dest = (u16*)data;
*dest = video::A8R8G8B8toR5G6B5( color );
}
break;
case ECF_R8G8B8:
{
u8* dest = (u8*)data;
dest[0] = (u8)getRed();
dest[1] = (u8)getGreen();
dest[2] = (u8)getBlue();
}
break;
case ECF_A8R8G8B8:
{
u32 * dest = (u32*)data;
*dest = color;
}
break;
default:
break;
}
}
u32 color;
};
class SColorf
{
public:
SColorf() : r(0.0f), g(0.0f), b(0.0f), a(1.0f) {}
SColorf(f32 r, f32 g, f32 b, f32 a = 1.0f) : r(r), g(g), b(b), a(a) {}
SColorf(SColor c)
{
const f32 inv = 1.0f / 255.0f;
r = c.getRed() * inv;
g = c.getGreen() * inv;
b = c.getBlue() * inv;
a = c.getAlpha() * inv;
}
SColor toSColor() const
{
return SColor((u32)core::round32(a*255.0f), (u32)core::round32(r*255.0f), (u32)core::round32(g*255.0f), (u32)core::round32(b*255.0f));
}
void set(f32 rr, f32 gg, f32 bb) {r = rr; g =gg; b = bb; }
void set(f32 aa, f32 rr, f32 gg, f32 bb) {a = aa; r = rr; g =gg; b = bb; }
SColorf getInterpolated(const SColorf &other, f32 d) const
{
d = core::clamp(d, 0.f, 1.f);
const f32 inv = 1.0f - d;
return SColorf(other.r*inv + r*d,
other.g*inv + g*d, other.b*inv + b*d, other.a*inv + a*d);
}
inline SColorf getInterpolated_quadratic(const SColorf& c1, const SColorf& c2,
f32 d) const
{
d = core::clamp(d, 0.f, 1.f);
// this*(1-d)*(1-d) + 2 * c1 * (1-d) + c2 * d * d;
const f32 inv = 1.f - d;
const f32 mul0 = inv * inv;
const f32 mul1 = 2.f * d * inv;
const f32 mul2 = d * d;
return SColorf (r * mul0 + c1.r * mul1 + c2.r * mul2,
g * mul0 + c1.g * mul1 + c2.g * mul2,
b * mul0 + c1.b * mul1 + c2.b * mul2,
a * mul0 + c1.a * mul1 + c2.a * mul2);
}
void setColorComponentValue(s32 index, f32 value)
{
switch(index)
{
case 0: r = value; break;
case 1: g = value; break;
case 2: b = value; break;
case 3: a = value; break;
}
}
f32 getAlpha() const { return a; }
f32 getRed() const { return r; }
f32 getGreen() const { return g; }
f32 getBlue() const { return b; }
f32 r;
f32 g;
f32 b;
f32 a;
};
class SColorHSL
{
public:
SColorHSL ( f32 h = 0.f, f32 s = 0.f, f32 l = 0.f )
: Hue ( h ), Saturation ( s ), Luminance ( l ) {}
void fromRGB(const SColorf &color);
void toRGB(SColorf &color) const;
f32 Hue;
f32 Saturation;
f32 Luminance;
private:
inline f32 toRGB1(f32 rm1, f32 rm2, f32 rh) const;
};
inline void SColorHSL::fromRGB(const SColorf &color)
{
const f32 maxVal = core::max_(color.getRed(), color.getGreen(), color.getBlue());
const f32 minVal = (f32)core::min_(color.getRed(), color.getGreen(), color.getBlue());
Luminance = (maxVal+minVal)*50;
if (core::equals(maxVal, minVal))
{
Hue=0.f;
Saturation=0.f;
return;
}
const f32 delta = maxVal-minVal;
if ( Luminance <= 50 )
{
Saturation = (delta)/(maxVal+minVal);
}
else
{
Saturation = (delta)/(2-maxVal-minVal);
}
Saturation *= 100;
if (core::equals(maxVal, color.getRed()))
Hue = (color.getGreen()-color.getBlue())/delta;
else if (core::equals(maxVal, color.getGreen()))
Hue = 2+((color.getBlue()-color.getRed())/delta);
else // blue is max
Hue = 4+((color.getRed()-color.getGreen())/delta);
Hue *= 60.0f;
while ( Hue < 0.f )
Hue += 360;
}
inline void SColorHSL::toRGB(SColorf &color) const
{
const f32 l = Luminance/100;
if (core::iszero(Saturation)) // grey
{
color.set(l, l, l);
return;
}
f32 rm2;
if ( Luminance <= 50 )
{
rm2 = l + l * (Saturation/100);
}
else
{
rm2 = l + (1 - l) * (Saturation/100);
}
const f32 rm1 = 2.0f * l - rm2;
const f32 h = Hue / 360.0f;
color.set( toRGB1(rm1, rm2, h + 1.f/3.f),
toRGB1(rm1, rm2, h),
toRGB1(rm1, rm2, h - 1.f/3.f)
);
}
// algorithm from Foley/Van-Dam
inline f32 SColorHSL::toRGB1(f32 rm1, f32 rm2, f32 rh) const
{
if (rh<0)
rh += 1;
if (rh>1)
rh -= 1;
if (rh < 1.f/6.f)
rm1 = rm1 + (rm2 - rm1) * rh*6.f;
else if (rh < 0.5f)
rm1 = rm2;
else if (rh < 2.f/3.f)
rm1 = rm1 + (rm2 - rm1) * ((2.f/3.f)-rh)*6.f;
return rm1;
}
} // end namespace video
} // end namespace irr
#endif
irr::video::SColorHSL::Saturation
f32 Saturation
Definition SColor.h:602
irr::video::SColorHSL::Hue
f32 Hue
Definition SColor.h:601
irr::video::SColorHSL::toRGB
void toRGB(SColorf &color) const
Definition SColor.h:646
irr::video::SColorHSL::fromRGB
void fromRGB(const SColorf &color)
Definition SColor.h:610
irr::video::SColorHSL::Luminance
f32 Luminance
Definition SColor.h:603
irr::video::SColorHSL::SColorHSL
SColorHSL(f32 h=0.f, f32 s=0.f, f32 l=0.f)
Definition SColor.h:595
irr::video::SColor
Class representing a 32 bit ARGB color.
Definition SColor.h:202
irr::video::SColor::color
u32 color
color in A8R8G8B8 Format
Definition SColor.h:447
irr::video::SColor::setBlue
void setBlue(u32 b)
Sets the blue component of the Color.
Definition SColor.h:274
irr::video::SColor::getGreen
u32 getGreen() const
Returns the green component of the color.
Definition SColor.h:231
irr::video::SColor::getInterpolated
SColor getInterpolated(const SColor &other, f32 d) const
Interpolates the color with a f32 value to another color.
Definition SColor.h:340
irr::video::SColor::operator!=
bool operator!=(const SColor &other) const
Compares the color to another color.
Definition SColor.h:319
irr::video::SColor::setData
void setData(const void *data, ECOLOR_FORMAT format)
set the color by expecting data in the given format
Definition SColor.h:378
irr::video::SColor::operator+
SColor operator+(const SColor &other) const
Adds two colors, result is clamped to 0..255 values.
Definition SColor.h:328
irr::video::SColor::toOpenGLColor
void toOpenGLColor(u8 *dest) const
Converts color to OpenGL color format.
Definition SColor.h:284
irr::video::SColor::set
void set(u32 col)
Definition SColor.h:311
irr::video::SColor::SColor
SColor(u32 clr)
Constructs the color from a 32 bit value. Could be another color.
Definition SColor.h:215
irr::video::SColor::getAverage
u32 getAverage() const
Get average intensity of the color in the range [0,255].
Definition SColor.h:251
irr::video::SColor::operator==
bool operator==(const SColor &other) const
Compares the color to another color.
Definition SColor.h:315
irr::video::SColor::getRed
u32 getRed() const
Returns the red component of the color.
Definition SColor.h:226
irr::video::SColor::getLuminance
f32 getLuminance() const
Get luminance of the color in the range [0,255].
Definition SColor.h:245
irr::video::SColor::setAlpha
void setAlpha(u32 a)
Sets the alpha component of the Color.
Definition SColor.h:259
irr::video::SColor::getData
void getData(void *data, ECOLOR_FORMAT format)
Write the color to data in the defined format.
Definition SColor.h:407
irr::video::SColor::getAlpha
u32 getAlpha() const
Returns the alpha component of the color.
Definition SColor.h:221
irr::video::SColor::set
void set(u32 a, u32 r, u32 g, u32 b)
Sets all four components of the color at once.
Definition SColor.h:307
irr::video::SColor::setRed
void setRed(u32 r)
Sets the red component of the Color.
Definition SColor.h:264
irr::video::SColor::getLightness
f32 getLightness() const
Get lightness of the color in the range [0,255].
Definition SColor.h:239
irr::video::SColor::SColor
SColor(u32 a, u32 r, u32 g, u32 b)
Constructs the color from 4 values representing the alpha, red, green and blue component.
Definition SColor.h:211
irr::video::SColor::toA1R5G5B5
u16 toA1R5G5B5() const
Calculates a 16 bit A1R5G5B5 value of this color.
Definition SColor.h:278
irr::video::SColor::SColor
SColor()
Constructor of the Color. Does nothing.
Definition SColor.h:207
irr::video::SColor::getInterpolated_quadratic
SColor getInterpolated_quadratic(const SColor &c1, const SColor &c2, f32 d) const
Returns interpolated color. ( quadratic ).
Definition SColor.h:354
irr::video::SColor::operator<
bool operator<(const SColor &other) const
comparison operator
Definition SColor.h:323
irr::video::SColor::setGreen
void setGreen(u32 g)
Sets the green component of the Color.
Definition SColor.h:269
irr::video::SColor::getBlue
u32 getBlue() const
Returns the blue component of the color.
Definition SColor.h:236
irr::video::SColorf
Class representing a color with four floats.
Definition SColor.h:459
irr::video::SColorf::getRed
f32 getRed() const
Returns the red component of the color in the range 0.0 to 1.0.
Definition SColor.h:565
irr::video::SColorf::getInterpolated
SColorf getInterpolated(const SColorf &other, f32 d) const
Interpolates the color with a f32 value to another color.
Definition SColor.h:520
irr::video::SColorf::getGreen
f32 getGreen() const
Returns the green component of the color in the range 0.0 to 1.0.
Definition SColor.h:568
irr::video::SColorf::SColorf
SColorf()
Default constructor for SColorf.
Definition SColor.h:463
irr::video::SColorf::getBlue
f32 getBlue() const
Returns the blue component of the color in the range 0.0 to 1.0.
Definition SColor.h:571
irr::video::SColorf::SColorf
SColorf(SColor c)
Constructs a color from 32 bit Color.
Definition SColor.h:481
irr::video::SColorf::setColorComponentValue
void setColorComponentValue(s32 index, f32 value)
Sets a color component by index. R=0, G=1, B=2, A=3.
Definition SColor.h:550
irr::video::SColorf::b
f32 b
blue component
Definition SColor.h:580
irr::video::SColorf::set
void set(f32 rr, f32 gg, f32 bb)
Sets three color components to new values at once.
Definition SColor.h:503
irr::video::SColorf::getAlpha
f32 getAlpha() const
Returns the alpha component of the color in the range 0.0 (transparent) to 1.0 (opaque).
Definition SColor.h:562
irr::video::SColorf::r
f32 r
red color component
Definition SColor.h:574
irr::video::SColorf::g
f32 g
green color component
Definition SColor.h:577
irr::video::SColorf::toSColor
SColor toSColor() const
Converts this color to a SColor without floats.
Definition SColor.h:491
irr::video::SColorf::SColorf
SColorf(f32 r, f32 g, f32 b, f32 a=1.0f)
Constructs a color from up to four color values: red, green, blue, and alpha.
Definition SColor.h:476
irr::video::SColorf::a
f32 a
alpha color component
Definition SColor.h:583
irr::video::SColorf::set
void set(f32 aa, f32 rr, f32 gg, f32 bb)
Sets all four color components to new values at once.
Definition SColor.h:514
irr::video::SColorf::getInterpolated_quadratic
SColorf getInterpolated_quadratic(const SColorf &c1, const SColorf &c2, f32 d) const
Returns interpolated color. ( quadratic ).
Definition SColor.h:532
irrMath.h
irrTypes.h
irr::core::max_
const T & max_(const T &a, const T &b)
returns maximum of two values. Own implementation to get rid of the STL (VS6 problems)
Definition irrMath.h:137
irr::core::clamp
const T clamp(const T &value, const T &low, const T &high)
clamps a value between low and high
Definition irrMath.h:166
irr::core::min_
const T & min_(const T &a, const T &b)
returns minimum of two values. Own implementation to get rid of the STL (VS6 problems)
Definition irrMath.h:123
irr::core::equals
bool equals(const f64 a, const f64 b, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals b, taking possible rounding errors into account
Definition irrMath.h:185
irr::core::floor32
REALINLINE s32 floor32(f32 x)
Definition irrMath.h:613
irr::core::round32
REALINLINE s32 round32(f32 x)
Definition irrMath.h:680
irr::core::iszero
bool iszero(const f64 a, const f64 tolerance=ROUNDING_ERROR_f64)
returns if a equals zero, taking rounding errors into account
Definition irrMath.h:270
irr::video
The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done ...
Definition EDriverFeatures.h:11
irr::video::A8R8G8B8toR5G6B5
u16 A8R8G8B8toR5G6B5(u32 color)
Converts a 32bit (A8R8G8B8) color to a 16bit R5G6B5 color.
Definition SColor.h:107
irr::video::ECOLOR_FORMAT
ECOLOR_FORMAT
An enum for the color format of textures used by the Irrlicht Engine.
Definition SColor.h:18
irr::video::ECF_A1R5G5B5
@ ECF_A1R5G5B5
16 bit color format used by the software driver.
Definition SColor.h:23
irr::video::ECF_UNKNOWN
@ ECF_UNKNOWN
Unknown color format:
Definition SColor.h:55
irr::video::ECF_A32B32G32R32F
@ ECF_A32B32G32R32F
128 bit floating point format. 32 bits are used for the red, green, blue and alpha channels.
Definition SColor.h:52
irr::video::ECF_R8G8B8
@ ECF_R8G8B8
24 bit color, no alpha channel, but 8 bit for red, green and blue.
Definition SColor.h:29
irr::video::ECF_R5G6B5
@ ECF_R5G6B5
Standard 16 bit color format.
Definition SColor.h:26
irr::video::ECF_A8R8G8B8
@ ECF_A8R8G8B8
Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
Definition SColor.h:32
irr::video::ECF_A16B16G16R16F
@ ECF_A16B16G16R16F
64 bit floating point format 16 bits are used for the red, green, blue and alpha channels.
Definition SColor.h:43
irr::video::ECF_G32R32F
@ ECF_G32R32F
64 bit floating point format using 32 bits for the red channel and 32 bits for the green channel.
Definition SColor.h:49
irr::video::ECF_R16F
@ ECF_R16F
16 bit floating point format using 16 bits for the red channel.
Definition SColor.h:37
irr::video::ECF_R32F
@ ECF_R32F
32 bit floating point format using 32 bits for the red channel.
Definition SColor.h:46
irr::video::ECF_G16R16F
@ ECF_G16R16F
32 bit floating point format using 16 bits for the red channel and 16 bits for the green channel.
Definition SColor.h:40
irr::video::RGB16from16
u16 RGB16from16(u16 r, u16 g, u16 b)
Creates a 16bit A1R5G5B5 color, based on 16bit input values.
Definition SColor.h:77
irr::video::getAlpha
u32 getAlpha(u16 color)
Returns the alpha component from A1R5G5B5 color.
Definition SColor.h:155
irr::video::getGreen
u32 getGreen(u16 color)
Returns the green component from A1R5G5B5 color.
Definition SColor.h:171
irr::video::R5G6B5toA8R8G8B8
u32 R5G6B5toA8R8G8B8(u16 color)
Returns A8R8G8B8 Color from R5G6B5 color.
Definition SColor.h:128
irr::video::A1R5G5B5toR5G6B5
u16 A1R5G5B5toR5G6B5(u16 color)
Returns R5G6B5 Color from A1R5G5B5 color.
Definition SColor.h:145
irr::video::RGB16
u16 RGB16(u32 r, u32 g, u32 b)
Creates a 16 bit A1R5G5B5 color.
Definition SColor.h:70
irr::video::RGBA16
u16 RGBA16(u32 r, u32 g, u32 b, u32 a=0xFF)
Creates a 16 bit A1R5G5B5 color.
Definition SColor.h:60
irr::video::X8R8G8B8toA1R5G5B5
u16 X8R8G8B8toA1R5G5B5(u32 color)
Converts a 32bit (X8R8G8B8) color to a 16bit A1R5G5B5 color.
Definition SColor.h:87
irr::video::A1R5G5B5toA8R8G8B8
u32 A1R5G5B5toA8R8G8B8(u16 color)
Convert A8R8G8B8 Color from A1R5G5B5 color.
Definition SColor.h:117
irr::video::A8R8G8B8toA1R5G5B5
u16 A8R8G8B8toA1R5G5B5(u32 color)
Converts a 32bit (A8R8G8B8) color to a 16bit A1R5G5B5 color.
Definition SColor.h:97
irr::video::getRed
u32 getRed(u16 color)
Returns the red component from A1R5G5B5 color.
Definition SColor.h:163
irr::video::R5G6B5toA1R5G5B5
u16 R5G6B5toA1R5G5B5(u16 color)
Returns A1R5G5B5 Color from R5G6B5 color.
Definition SColor.h:138
irr::video::getAverage
s32 getAverage(s16 color)
Returns the average from a 16 bit A1R5G5B5 color.
Definition SColor.h:186
irr::video::getBlue
u32 getBlue(u16 color)
Returns the blue component from A1R5G5B5 color.
Definition SColor.h:179
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::f32
float f32
32 bit floating point variable.
Definition irrTypes.h:104
irr::u32
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
irr::s16
signed short s16
16 bit signed variable.
Definition irrTypes.h:48
irr::u8
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.h:18
irr::s32
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
irr::u16
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.h:40
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0