static void HSV(FastBitmap.MyColor dst, int H, double S, double V) { int Hi = (H / 60) % 6; double Vmin = (100 - S) * V / 100; double a = (V - Vmin) * (H % 60) / 60; byte Vinc = (byte)Math.Round((Vmin + a) * 255 / 100); byte Vdec = (byte)Math.Round((V - a) * 255 / 100); byte iVmin = (byte)Math.Round(Vmin * 255 / 100); byte iV = (byte)Math.Round(V * 255 / 100); switch (Hi) { case (0): dst.Set(iV, Vinc, iVmin); return; case (1): dst.Set(Vdec, iV, iVmin); return; case (2): dst.Set(iVmin, iV, Vinc); return; case (3): dst.Set(iVmin, Vdec, iV); return; case (4): dst.Set(Vinc, iVmin, iV); return; case (5): dst.Set(iV, iVmin, Vdec); return; } }
static void ValueColor(FastBitmap.MyColor src, FastBitmap.MyColor dst, int depth) { byte res = (byte)Math.Round(Value(src, depth) * 255 / 100); dst.Set(res, res, res); }
static void SaturationColor(FastBitmap.MyColor src, FastBitmap.MyColor dst, int depth) { byte res = (byte)Math.Round(Saturation(src, depth) * 255 / 100); dst.Set(res, res, res); }