Official Murl Engine Forum

Full Version: Color class extension
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The Color class should provide the following method:

UInt32 ToUInt32Clamped() const
{
UInt32 red = Math::Clamp<SInt32>(Math::Round(mColor[RED] * Float(255.0)), 0, 255);
UInt32 green = Math::Clamp<SInt32>(Math::Round(mColor[GREEN] * Float(255.0)), 0, 255);
UInt32 blue = Math::Clamp<SInt32>(Math::Round(mColor[BLUE] * Float(255.0)), 0, 255);
UInt32 alpha = Math::Clamp<SInt32>(Math::Round(mColor[ALPHA] * Float(255.0)), 0, 255);
return red + (green << 8) + (blue << 16) + (alpha << 24);
}

This will help converting overdriven floating point color values.
Hi Andy,

thanks for your proposal. We will consider it for the next update.