コード例 #1
0
        public static Gradient LoadPallete(string path)
        {
            List <RgbaValue> pallete     = new List <RgbaValue>();
            StreamReader     palleteData = new StreamReader(path);

            while (!palleteData.EndOfStream)
            {
                try
                {
                    string   palleteString = palleteData.ReadLine();
                    string[] palleteTokens = palleteString.Split(new char[1] {
                        ' '
                    }, StringSplitOptions.RemoveEmptyEntries);
                    byte      r     = (byte)int.Parse(palleteTokens[0]);
                    byte      g     = (byte)int.Parse(palleteTokens[1]);
                    byte      b     = (byte)int.Parse(palleteTokens[2]);
                    RgbaValue color = new RgbaValue(r, g, b);
                    pallete.Add(color);
                }
                catch (FormatException) { }
            }
            return(new Gradient(pallete.ToArray(), 256));
        }
コード例 #2
0
 public override void WritePixel(int x, int y, RgbaValue color)
 {
     Bitmap.SetPixel(x, y, new SKColor(color.Blue, color.Green, color.Red, color.Alpha));
 }