Double-check that the input image's density is valid

Fixes a bug that could result in division by zero, at least for a JPEG
source image.
Fixes issues #19, #20
IW_IMPL(unsigned int) iw_color_get_int_sample(struct iw_color *clr, int channel,
	unsigned int maxcolorcode)
{
	int n;
	n = (int)(0.5+(clr->c[channel] * (double)maxcolorcode));
	if(n<0) n=0;
	else if(n>(int)maxcolorcode) n=(int)maxcolorcode;
	return (unsigned int)n;
}

IW_IMPL(unsigned int) iw_color_get_int_sample(struct iw_color *clr, int channel,
	unsigned int maxcolorcode)
{
	int n;
	n = (int)(0.5+(clr->c[channel] * (double)maxcolorcode));
	if(n<0) n=0;
	else if(n>(int)maxcolorcode) n=(int)maxcolorcode;
	return (unsigned int)n;
}
