Ejemplo n.º 1
0
 private void PaintRaw(IEnumerable <ILine> lines)
 {
     using (Graphics pg = Graphics.FromImage(SourceBitmap))
     {
         pg.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
         int totalCount = lines.SelectMany(e => e.Vertices).Count();
         int current    = 0;
         foreach (var sequence in lines)
         {
             foreach (var vertex in sequence.Vertices)
             {
                 float      penSize  = vertex.Size;
                 float      halfSize = penSize / 2;
                 SolidBrush brush    = new SolidBrush(vertex.Color);
                 pg.FillRectangle(brush, new RectangleF(vertex.X - halfSize, vertex.Y - halfSize, penSize, penSize));
                 current += 1;
                 OnPaintingUpdated?.Invoke(this, new OnPaintingUpdatedEventArgs(vertex, current / (float)totalCount));
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void PaintLines(IEnumerable <ILine> lines)
 {
     using (Graphics pg = Graphics.FromImage(SourceBitmap))
     {
         pg.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
         int totalCount = lines.Count();
         int current    = 0;
         foreach (Line line in lines)
         {
             if (line.IsOutline)
             {
                 PaintOutline(pg, line);
             }
             else
             {
                 PaintLine(pg, line);
             }
             current += 1;
             OnPaintingUpdated?.Invoke(this, new OnPaintingUpdatedEventArgs(line.Vertices.FirstOrDefault(), current / (float)totalCount));
         }
     }
 }
Ejemplo n.º 3
0
        public void Start(IPainting painting)
        {
            var lines      = painting.Lines;
            int totalCount = lines.SelectMany(e => e.Vertices).Count();
            int current    = 0;

            foreach (var line in lines)
            {
                if (CheckKey() == false)
                {
                    return;
                }
                VirtualKeyboard.MouseMove((int)(line.Vertices.First().X + Offset.X), (int)(line.Vertices.First().Y + Offset.Y), SleepTime);
                VirtualKeyboard.MouseDown(SleepTime);
                foreach (var SubPoint in line.Vertices)
                {
                    VirtualKeyboard.MouseMove((int)(SubPoint.X + Offset.X), (int)(SubPoint.Y + Offset.Y), SleepTime);
                    current += 1;
                    OnPaintingUpdated?.Invoke(this, new OnPaintingUpdatedEventArgs(SubPoint, current / (float)totalCount));
                }
                VirtualKeyboard.MouseUp(SleepTime);
            }
        }