//! get a filtered pixel
	inline ColourValue CImage::getPixelBox(SINT32 x, SINT32 y, SINT32 fx, SINT32 fy, SINT32 bias) const
	{
		ColourValue c;
		SINT32 a = 0, r = 0, g = 0, b = 0;

		for (SINT32 dx = 0; dx != fx; ++dx)
		{
			for (SINT32 dy = 0; dy != fy; ++dy)
			{
				c = getPixel(SINT32_min(x + dx, Size.Width - 1),
					SINT32_min(y + dy, Size.Height - 1)
					);

				a += c.getAlpha();
				r += c.getRed();
				g += c.getGreen();
				b += c.getBlue();
			}

		}

		SINT32 sdiv = s32_log2_f32(fx * fy);

		a = SINT32_clamp((a >> sdiv) + bias, 0, 255);
		r = SINT32_clamp((r >> sdiv) + bias, 0, 255);
		g = SINT32_clamp((g >> sdiv) + bias, 0, 255);
		b = SINT32_clamp((b >> sdiv) + bias, 0, 255);

		c.setAlpha(a);
		c.setRed(r);
		c.setBlue(b);
		c.setGreen(g);
		//c.set(a, r, g, b);
		return c;
	}
	//! returns a pixel
	ColourValue CImage::getPixel(UINT32 x, UINT32 y) const
	{
		ColourValue c;
		if (x >= Size.Width || y >= Size.Height)
			return c;
		
		switch (Format)
		{
		case ECF_A1R5G5B5:
			c.setAsARGB(A1R5G5B5toA8R8G8B8(((UINT16*)Data)[y*Size.Width + x]));
			return c; //A1R5G5B5toA8R8G8B8(((UINT16*)Data)[y*Size.Width + x]);
		case ECF_R5G6B5:
			c.setAsARGB(R5G6B5toA8R8G8B8(((UINT16*)Data)[y*Size.Width + x]));
			return c;//R5G6B5toA8R8G8B8(((UINT16*)Data)[y*Size.Width + x]);
		case ECF_A8R8G8B8:
			c.setAsARGB(((UINT32*)Data)[y*Size.Width + x]);
			return c;// ((UINT32*)Data)[y*Size.Width + x];
		case ECF_R8G8B8:
		{
			UINT8* p = Data + (y * 3)*Size.Width + (x * 3);
			c.setAlpha(255);
			c.setRed(p[0]);
			c.setBlue(p[1]);
			c.setGreen(p[2]);
			return c;
		}
#ifndef _DEBUG
		default:
			break;
#endif
		}

		return ColourValue(0);
	}