Toshihiro Shimizu 890ddd
#include <stdexcept> /* std::domain_error  */</stdexcept>
Toshihiro Shimizu 890ddd
#include <limits>	/* std::numeric_limits */</limits>
Toshihiro Shimizu 890ddd
#include "igs_color_rgb_hsv.h"
Toshihiro Shimizu 890ddd
namespace
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
void pixel_rgba_(
Toshihiro Shimizu 890ddd
	const double red_in, const double gre_in, const double blu_in, const double alp_in, const double hue_noise // -0.5...0.5
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const double sat_noise, const double val_noise // -0.5...0.5
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const double alp_noise, double &red_out, double &gre_out, double &blu_out, double &alp_out)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	double hue, sat, val, alp;
Toshihiro Shimizu 890ddd
	igs::color::rgb_to_hsv(red_in, gre_in, blu_in, hue, sat, val);
Toshihiro Shimizu 890ddd
	alp = alp_in;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (0.0 != hue_noise) {
Toshihiro Shimizu 890ddd
		hue += 360.0 * hue_noise;
Toshihiro Shimizu 890ddd
		while (hue < 0.0) {
Toshihiro Shimizu 890ddd
			hue += 360.0;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		while (360.0 <= hue) {
Toshihiro Shimizu 890ddd
			hue -= 360.0;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if (0.0 != sat_noise) {
Toshihiro Shimizu 890ddd
		sat += sat_noise;
Toshihiro Shimizu 890ddd
		if (sat < 0.0) {
Toshihiro Shimizu 890ddd
			sat = 0.0;
Toshihiro Shimizu 890ddd
		} else if (1.0 < sat) {
Toshihiro Shimizu 890ddd
			sat = 1.0;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if (0.0 != val_noise) {
Toshihiro Shimizu 890ddd
		val += val_noise;
Toshihiro Shimizu 890ddd
		if (val < 0.0) {
Toshihiro Shimizu 890ddd
			val = 0.0;
Toshihiro Shimizu 890ddd
		} else if (1.0 < val) {
Toshihiro Shimizu 890ddd
			val = 1.0;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if (0.0 != alp_noise) {
Toshihiro Shimizu 890ddd
		alp += alp_noise;
Toshihiro Shimizu 890ddd
		alp = (alp < 0.0) ? 0.0 : ((1.0 < alp) ? 1.0 : alp);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	igs::color::hsv_to_rgb(hue, sat, val, red_out, gre_out, blu_out);
Toshihiro Shimizu 890ddd
	alp_out = alp;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
namespace
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
class noise_ref_
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	noise_ref_(
Toshihiro Shimizu 890ddd
		const unsigned char *array, const int height, const int width, const int channels, const int bits, const int xoffset, const int yoffset, const int zz);
Toshihiro Shimizu 890ddd
	double noise(
Toshihiro Shimizu 890ddd
		int xx // 0...width-1...
Toshihiro Shimizu 890ddd
		,
Toshihiro Shimizu 890ddd
		int yy   // 0...height-1...
Toshihiro Shimizu 890ddd
		) const; // return range is 0...1
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	const unsigned char *array_;
Toshihiro Shimizu 890ddd
	const int height_;
Toshihiro Shimizu 890ddd
	const int width_;
Toshihiro Shimizu 890ddd
	const int channels_;
Toshihiro Shimizu 890ddd
	const int bits_;
Toshihiro Shimizu 890ddd
	const double bmax_;
Toshihiro Shimizu 890ddd
	const int xoffset_;
Toshihiro Shimizu 890ddd
	const int yoffset_;
Toshihiro Shimizu 890ddd
	const int zz_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* copy constructorを無効化 */
Toshihiro Shimizu 890ddd
	noise_ref_(const noise_ref_ &);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* 代入演算子を無効化 */
Toshihiro Shimizu 890ddd
	noise_ref_ &operator=(const noise_ref_ &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
noise_ref_::noise_ref_(
Toshihiro Shimizu 890ddd
	const unsigned char *array, const int height, const int width, const int channels, const int bits, const int xoffset, const int yoffset, const int zz) : array_(array), height_(height), width_(width), channels_(channels), bits_(bits), bmax_(static_cast<double>((1 << bits) - 1)), xoffset_(xoffset), yoffset_(yoffset), zz_(zz)</double>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	if (0 == array) {
Toshihiro Shimizu 890ddd
		throw std::domain_error("noise_ref_  no data");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if ((zz < 0) || (channels <= zz)) {
Toshihiro Shimizu 890ddd
		throw std::domain_error("noise_ref_  bad zz");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if (
Toshihiro Shimizu 890ddd
		(std::numeric_limits<unsigned char="">::digits != this->bits_) &&</unsigned>
Toshihiro Shimizu 890ddd
		(std::numeric_limits<unsigned short="">::digits != this->bits_)) {</unsigned>
Toshihiro Shimizu 890ddd
		throw std::domain_error("noise_ref_  bad bits");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
double noise_ref_::noise(int xx, int yy) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	xx -= this->xoffset_;
Toshihiro Shimizu 890ddd
	yy -= this->yoffset_;
Toshihiro Shimizu 890ddd
	while (xx < 0) {
Toshihiro Shimizu 890ddd
		xx += this->width_;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	while (this->width_ <= xx) {
Toshihiro Shimizu 890ddd
		xx -= this->width_;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	while (yy < 0) {
Toshihiro Shimizu 890ddd
		yy += this->height_;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	while (this->height_ <= yy) {
Toshihiro Shimizu 890ddd
		yy -= this->height_;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (std::numeric_limits<unsigned char="">::digits == this->bits_) {</unsigned>
Toshihiro Shimizu 890ddd
		return (*(
Toshihiro Shimizu 890ddd
				   this->array_ +
Toshihiro Shimizu 890ddd
				   this->channels_ * this->width_ * yy +
Toshihiro Shimizu 890ddd
				   this->channels_ * xx +
Toshihiro Shimizu 890ddd
				   this->zz_)) /
Toshihiro Shimizu 890ddd
			   this->bmax_;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	return (*(
Toshihiro Shimizu 890ddd
			   reinterpret_cast<const *="" short="" unsigned="">(this->array_) +</const>
Toshihiro Shimizu 890ddd
			   this->channels_ * this->width_ * yy +
Toshihiro Shimizu 890ddd
			   this->channels_ * xx +
Toshihiro Shimizu 890ddd
			   this->zz_)) /
Toshihiro Shimizu 890ddd
		   this->bmax_;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
#include "igs_ifx_common.h" /* igs::image::rgba */
Toshihiro Shimizu 890ddd
#include "igs_hsv_add.h"
Toshihiro Shimizu 890ddd
namespace
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
/* raster画像にノイズをのせるtemplate */
Toshihiro Shimizu 890ddd
template <class class="" it,="" rt=""></class>
Toshihiro Shimizu 890ddd
void change_template_(
Toshihiro Shimizu 890ddd
	IT *image_array, const int height, const int width, const int channels
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const noise_ref_ &noi
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const RT *ref /* 求める画像(out)と同じ高さ、幅、チャンネル数 */
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const int ref_mode /* 0=R,1=G,2=B,3=A,4=Luminance,5=Nothing */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const double offset, const double hue_scale, const double sat_scale, const double val_scale, const double alp_scale
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const bool add_blend_sw)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	const int t_max = std::numeric_limits<it>::max();</it>
Toshihiro Shimizu 890ddd
	const double div_val = static_cast<double>(t_max);</double>
Toshihiro Shimizu 890ddd
	const double mul_val = static_cast<double>(t_max) + 0.999999;</double>
Toshihiro Shimizu 890ddd
	const int r_max = std::numeric_limits<rt>::max();</rt>
Toshihiro Shimizu 890ddd
	if (igs::image::rgba::siz == channels) {
Toshihiro Shimizu 890ddd
		using namespace igs::image::rgba;
Toshihiro Shimizu 890ddd
		for (int yy = 0; yy < height; ++yy) {
Toshihiro Shimizu 890ddd
			for (int xx = 0; xx < width; ++xx, image_array += channels) {
Toshihiro Shimizu 890ddd
				/* 変化量初期値 */
Toshihiro Shimizu 890ddd
				double refv = 1.0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 参照画像あればピクセル単位の画像変化量を得る */
Toshihiro Shimizu 890ddd
				if (ref != 0) {
Toshihiro Shimizu 890ddd
					refv *= igs::color::ref_value(
Toshihiro Shimizu 890ddd
						ref, channels, r_max, ref_mode);
Toshihiro Shimizu 890ddd
					ref += channels; /* continue;の前に行うこと */
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 加算合成で、Alpha値ゼロならRGB値を計算する必要はない */
Toshihiro Shimizu 890ddd
				if (add_blend_sw && (0 == image_array[alp])) {
Toshihiro Shimizu 890ddd
					continue;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
				/* 加算合成でなくAlpha合成の時は、
Toshihiro Shimizu 890ddd
			Alpha値がゼロでもRGB値は存在する(してもよい) */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* HSVAそれぞれに対するオフセット済ノイズ値 */
Toshihiro Shimizu 890ddd
				refv *= (noi.noise(xx, yy) - offset);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* マスクSWがON、なら変化をMask */
Toshihiro Shimizu 890ddd
				if (add_blend_sw && (image_array[alp] < t_max)) {
Toshihiro Shimizu 890ddd
					refv *= static_cast<double>(image_array[alp]) / div_val;</double>
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* RGBAにHSVAノイズを加える */
Toshihiro Shimizu 890ddd
				double rr, gg, bb, aa;
Toshihiro Shimizu 890ddd
				pixel_rgba_(
Toshihiro Shimizu 890ddd
					static_cast<double>(image_array[red]) / div_val, static_cast<double>(image_array[gre]) / div_val, static_cast<double>(image_array[blu]) / div_val, static_cast<double>(image_array[alp]) / div_val, refv * hue_scale, refv * sat_scale, refv * val_scale, refv * alp_scale, rr, gg, bb, aa);</double></double></double></double>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 変化後の値を戻す */
Toshihiro Shimizu 890ddd
				image_array[red] = static_cast<it>(rr * mul_val);</it>
Toshihiro Shimizu 890ddd
				image_array[gre] = static_cast<it>(gg * mul_val);</it>
Toshihiro Shimizu 890ddd
				image_array[blu] = static_cast<it>(bb * mul_val);</it>
Toshihiro Shimizu 890ddd
				image_array[alp] = static_cast<it>(aa * mul_val);</it>
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	} else if (igs::image::rgb::siz == channels) {
Toshihiro Shimizu 890ddd
		using namespace igs::image::rgb;
Toshihiro Shimizu 890ddd
		for (int yy = 0; yy < height; ++yy) {
Toshihiro Shimizu 890ddd
			for (int xx = 0; xx < width; ++xx, image_array += channels) {
Toshihiro Shimizu 890ddd
				/* 変化量初期値 */
Toshihiro Shimizu 890ddd
				double refv = 1.0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 参照画像あればピクセル単位の画像変化量を得る */
Toshihiro Shimizu 890ddd
				if (ref != 0) {
Toshihiro Shimizu 890ddd
					refv *= igs::color::ref_value(
Toshihiro Shimizu 890ddd
						ref, channels, r_max, ref_mode);
Toshihiro Shimizu 890ddd
					ref += channels; /* continue;の前に行うこと */
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* HSVそれぞれに対するオフセット済ノイズ値 */
Toshihiro Shimizu 890ddd
				refv *= (noi.noise(xx, yy) - offset);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* RGBにHSVノイズを加える */
Toshihiro Shimizu 890ddd
				double rr, gg, bb, aa;
Toshihiro Shimizu 890ddd
				pixel_rgba_(
Toshihiro Shimizu 890ddd
					static_cast<double>(image_array[red]) / div_val, static_cast<double>(image_array[gre]) / div_val, static_cast<double>(image_array[blu]) / div_val, 1.0, refv * hue_scale, refv * sat_scale, refv * val_scale, 0.0, rr, gg, bb, aa);</double></double></double>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 変化後の値を戻す */
Toshihiro Shimizu 890ddd
				image_array[red] = static_cast<it>(rr * mul_val);</it>
Toshihiro Shimizu 890ddd
				image_array[gre] = static_cast<it>(gg * mul_val);</it>
Toshihiro Shimizu 890ddd
				image_array[blu] = static_cast<it>(bb * mul_val);</it>
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	} else if (1 == channels) { /* grayscale */
Toshihiro Shimizu 890ddd
		for (int yy = 0; yy < height; ++yy) {
Toshihiro Shimizu 890ddd
			for (int xx = 0; xx < width; ++xx, ++image_array) {
Toshihiro Shimizu 890ddd
				/* 変化量初期値 */
Toshihiro Shimizu 890ddd
				double refv = 1.0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 参照画像あればピクセル単位の画像変化量を得る */
Toshihiro Shimizu 890ddd
				if (ref != 0) {
Toshihiro Shimizu 890ddd
					refv *= igs::color::ref_value(
Toshihiro Shimizu 890ddd
						ref, channels, r_max, ref_mode);
Toshihiro Shimizu 890ddd
					ref += channels; /* continue;の前に行うこと */
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* Lに対するオフセット済ノイズ値 */
Toshihiro Shimizu 890ddd
				refv *= (noi.noise(xx, yy) - offset);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 変化なしなら次へ */
Toshihiro Shimizu 890ddd
				if (0.0 == refv * val_scale) {
Toshihiro Shimizu 890ddd
					continue;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* GrayscaleにLノイズを加える */
Toshihiro Shimizu 890ddd
				double val = static_cast<double>(image_array[0]) / div_val + refv * val_scale;</double>
Toshihiro Shimizu 890ddd
				val = (val < 0.0) ? 0.0 : ((1.0 < val) ? 1.0 : val);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
				/* 変化後の値を戻す */
Toshihiro Shimizu 890ddd
				image_array[0] = static_cast<it>(val * mul_val);</it>
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void igs::hsv_add::change(
Toshihiro Shimizu 890ddd
	unsigned char *image_array, const int height, const int width, const int channels, const int bits
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const unsigned char *noi_image_array, const int noi_height, const int noi_width, const int noi_channels, const int noi_bits
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const unsigned char *ref /* 求める画像と同じ高、幅、channels数 */
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const int ref_bits /* refがゼロのときはここもゼロ */
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const int ref_mode /* 0=R,1=G,2=B,3=A,4=Luminance,5=Nothing */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const int xoffset, const int yoffset, const int from_rgba, const double offset, const double hue_scale, const double sat_scale, const double val_scale, const double alp_scale
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	,
Toshihiro Shimizu 890ddd
	const bool add_blend_sw)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	if ((0.0 == hue_scale) && (0.0 == sat_scale) && (0.0 == val_scale) && (0.0 == alp_scale)) {
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if ((igs::image::rgba::siz != channels) &&
Toshihiro Shimizu 890ddd
		(igs::image::rgb::siz != channels) &&
Toshihiro Shimizu 890ddd
		(1 != channels) /* grayscale */
Toshihiro Shimizu 890ddd
		) {
Toshihiro Shimizu 890ddd
		throw std::domain_error("Bad channels,Not rgba/rgb/grayscale");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ノイズ参照画像を作成する */
Toshihiro Shimizu 890ddd
	noise_ref_ noi(
Toshihiro Shimizu 890ddd
		noi_image_array
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		,
Toshihiro Shimizu 890ddd
		noi_height, noi_width, noi_channels, noi_bits
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		,
Toshihiro Shimizu 890ddd
		xoffset, yoffset, from_rgba);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* rgb(a)画像にhsv(a)でドットノイズを加える */
Toshihiro Shimizu 890ddd
	if ((std::numeric_limits<unsigned char="">::digits == bits) && ((std::numeric_limits<unsigned char="">::digits == ref_bits) || (0 == ref_bits))) {</unsigned></unsigned>
Toshihiro Shimizu 890ddd
		change_template_(
Toshihiro Shimizu 890ddd
			image_array, height, width, channels, noi, ref, ref_mode, offset, hue_scale, sat_scale, val_scale, alp_scale, add_blend_sw);
Toshihiro Shimizu 890ddd
	} else if ((std::numeric_limits<unsigned short="">::digits == bits) && ((std::numeric_limits<unsigned char="">::digits == ref_bits) || (0 == ref_bits))) {</unsigned></unsigned>
Toshihiro Shimizu 890ddd
		change_template_(
Toshihiro Shimizu 890ddd
			reinterpret_cast<unsigned *="" short="">(image_array), height, width, channels, noi, ref, ref_mode, offset, hue_scale, sat_scale, val_scale, alp_scale, add_blend_sw);</unsigned>
Toshihiro Shimizu 890ddd
	} else if ((std::numeric_limits<unsigned short="">::digits == bits) && (std::numeric_limits<unsigned short="">::digits == ref_bits)) {</unsigned></unsigned>
Toshihiro Shimizu 890ddd
		change_template_(
Toshihiro Shimizu 890ddd
			reinterpret_cast<unsigned *="" short="">(image_array), height, width, channels, noi, reinterpret_cast<const *="" short="" unsigned="">(ref), ref_mode, offset, hue_scale, sat_scale, val_scale, alp_scale, add_blend_sw);</const></unsigned>
Toshihiro Shimizu 890ddd
	} else if ((std::numeric_limits<unsigned char="">::digits == bits) && (std::numeric_limits<unsigned short="">::digits == ref_bits)) {</unsigned></unsigned>
Toshihiro Shimizu 890ddd
		change_template_(
Toshihiro Shimizu 890ddd
			image_array, height, width, channels, noi, reinterpret_cast<const *="" short="" unsigned="">(ref), ref_mode, offset, hue_scale, sat_scale, val_scale, alp_scale, add_blend_sw);</const>
Toshihiro Shimizu 890ddd
	} else {
Toshihiro Shimizu 890ddd
		throw std::domain_error("Bad bits,Not uchar/ushort");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}