|
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace FracMaster
{
public class Utils
{
private Utils()
{
}
static public int InterpolateColors(int s1, int s2, int weigth)
{
Color c1 = Color.FromArgb(s1);
Color c2 = Color.FromArgb(s2);
byte red = (byte)(((int)c1.R + ((int)((c2.R - c1.R) * weigth) >> 8)) & 0xff);
byte green = (byte)(((int)c1.G + ((int)((c2.G - c1.G) * weigth) >> 8)) & 0xff);
byte blue = (byte)(((int)c1.B + ((int)((c2.B - c1.B) * weigth) >> 8)) & 0xff);
return Color.FromArgb(red, green, blue).ToArgb();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have started programming at the age of 13 on the commodore 64.
Ever since then I have been programming on many systems in many languages.
During the last 12 years I have been working as professional programmer in different companies and different areas.
Now I am working as freelancer programmer / consultant