예제 #1
0
 private int[] parseIntArray(SunflowSharp.Systems.Parser p)
 {
     List<int> array = new List<int>();
     bool done = false;
     do
     {
         string s = p.getNextToken();
         if (s.StartsWith("["))
             s = s.Substring(1);
         if (s.EndsWith("]"))
         {
             s = s.Substring(0, s.Length - 1);
             done = true;
         }
         array.Add(int.Parse(s));
     } while (!done);
     return array.ToArray();
 }
예제 #2
0
 public void imageUpdate(int x, int y, int w, int h, SunflowSharp.Image.Color[] data)
 {
     if (InvokeRequired)
         Invoke(new imageUpdateDelegate(imageUpdate), x, y, w, h, data);
     else
     {
         try
         {
             lock (bitmap)
             {
                 using (Bitmap flip = new Bitmap(w, h))
                     using (Graphics g = Graphics.FromImage(flip))
                     {
                         for (int i = x, index = 0; i < x + w; i++)
                             for (int j = y; j < y + h; j++, index++)
                             {
                                 flip.SetPixel(i % 32, j % 32, Color.FromArgb(data[index].copy().toNonLinear().toRGB()));
                                 //flip.SetPixel(i % 32, j % 32, Color.FromArgb((int)(data[index].r * 255), (int)(data[index].g * 255), (int)(data[index].b * 255)));
                             }
                         flip.RotateFlip(RotateFlipType.Rotate90FlipX);
                         using (Graphics form = Graphics.FromImage(bitmap))
                             form.DrawImage(flip, x, y);
                     }
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
         Invalidate();
     }
 }