Feature #6802 » 0005-Fix-parseCssColor-to-take-a-float-alpha-in-rgba.patch
| src/web/ColorUtils.C | ||
|---|---|---|
|
#include "ColorUtils.h"
|
||
|
#include "Wt/WException.h"
|
||
|
#include "Wt/WLogger.h"
|
||
|
#include "web/WebUtils.h"
|
||
| ... | ... | |
|
|
||
|
if (has_alpha) {
|
||
|
try {
|
||
|
alpha = Utils::stoi(boost::trim_copy(arguments[3]));
|
||
|
double alpha_d = Utils::stof(boost::trim_copy(arguments[3]));
|
||
|
if (alpha_d < 0.0 || alpha_d > 1.0)
|
||
|
throw WException("parseCssColor: alpha value out of range 0.0 to 1.0");
|
||
|
alpha = std::round(alpha_d * 255.);
|
||
|
} catch (std::exception& e) {
|
||
|
LOG_ERROR("could not parse rgb format: " << n);
|
||
|
alpha = 255;
|
||