public void RenderBitmap(bool isCreating = false, Point?mousePosition = null)
        {
            if (Points.Count == 0)
            {
                return;
            }
            if (Bitmap == null)
            {
                bitmap = new WriteableBitmap((int)Boundries.Width, (int)Boundries.Height, 96, 96, PixelFormats.Bgra32, null);
            }

            byte[] pixels1d = new byte[(int)Boundries.Width * (int)Boundries.Height * 4];
            int    stride   = 4 * (int)Boundries.Width;

            bitmap.WritePixels(Cleaner, pixels1d, stride, 0);


            for (int i = 0; i < Points.Count; i++)
            {
                bitmap.DrawPoint(Points[i].X + Points[i].XOffset, (int)Points[i].Y + Points[i].YOffset, Color, 3, Points[i].IsBlocked);
                if (i < Points.Count - 1)
                {
                    bitmap.DrawLine((int)Points[i].X + Points[i].XOffset, (int)Points[i].Y + Points[i].YOffset, (int)Points[i + 1].X + Points[i + 1].XOffset, (int)Points[i + 1].Y + Points[i + 1].YOffset, Color);
                }
                else if (i == Points.Count - 1)
                {
                    if (!isCreating)
                    {
                        bitmap.DrawLine((int)Points[i].X + Points[i].XOffset, (int)Points[i].Y + Points[i].YOffset, (int)Points[0].X + Points[0].XOffset, (int)Points[0].Y + Points[0].YOffset, Color);
                    }
                    else
                    {
                        if (mousePosition != null)
                        {
                            var mouseP = mousePosition.Value;

                            bitmap.DrawLine((int)Points[Points.Count - 1].X, (int)Points[Points.Count - 1].Y, (int)mouseP.X, (int)mouseP.Y, Color);
                            bitmap.DrawPoint((int)mouseP.X, (int)mouseP.Y, Color, 3);
                        }
                    }
                }
            }
            if (!isCreating)
            {
                int id = 1;
                foreach (var line in Lines)
                {
                    if (line.Relation != Relation.NONE)
                    {
                        if (line.RelationID == -1 && line.RelatedLine != null)
                        {
                            line.RelationID             = id;
                            line.RelatedLine.RelationID = id;
                            id++;
                        }

                        bitmap.DrawRelationBox((line.First.X + line.First.XOffset + line.Second.X + line.Second.XOffset) / 2,
                                               (line.First.Y + line.First.YOffset + line.Second.Y + line.Second.YOffset) / 2,
                                               line.Relation, line.RelationID);
                        line.RelationID = -1;
                    }
                }
            }
            Bitmap = bitmap;
        }