private static void DrawRestrictionSameSizeIcon(MemoryBitmap bitmap, int startX, int startY, int endX, int endY) { startY = (startY + endY) / 2 - 3; endY = startY + 6; startX++; endX--; for (int x = startX; x <= endX; x++) { bitmap.SetPixel(x, startY, Color.Black); bitmap.SetPixel(x, endY, Color.Black); } }
public static void DrawRestrictionLabel(Figures.Edge e, MemoryBitmap bitmap, Color?color = null, Figures.Edge.Restriction?restriction = null) { int restrictionBoxSizeDiv2 = Helper.restrictionBoxSize / 2; Point point = new Point(((int)e.Previous.X + (int)e.Next.X) / 2, ((int)e.Previous.Y + (int)e.Next.Y) / 2); int startX = point.X - restrictionBoxSize, endX = point.X + restrictionBoxSize; int midX = (endX + startX) / 2; int startY = point.Y - restrictionBoxSizeDiv2, endY = point.Y + restrictionBoxSizeDiv2; for (int x = startX; x <= midX; x++) { for (int y = startY; y <= endY; y++) { bitmap.SetPixel(x, y, color.HasValue ? color.Value.ToArgb() : e.RestrictionData); } } for (int x = midX; x <= endX; x++) { for (int y = startY; y <= endY; y++) { bitmap.SetPixel(x, y, color.HasValue ? color.Value.ToArgb() : e.RestrictionData); } } for (int x = startX + 1; x <= midX - 1; x++) { for (int y = startY + 1; y <= endY - 1; y++) { bitmap.SetPixel(x, y, Color.White); } } for (int x = startX + 1; x <= endX - 1; x++) { for (int y = startY + 1; y <= endY - 1; y++) { bitmap.SetPixel(x, y, Color.White); } } Graphics g = bitmap.GetGraphics(); g.DrawString(restriction.HasValue ? "X" : e.RestrictionNum.ToString(), f, Brushes.Black, midX + padding, startY + padding); if (!restriction.HasValue) { restriction = e.EnactedRestriction; } DrawRestrictionIcon(bitmap, restriction.Value, startX + padding, startY + padding, midX - padding, endY - padding); }
private static void DrawRestrictionPerpendicularIcon(MemoryBitmap bitmap, int startX, int startY, int endX, int endY) { startX = (startX + endX) / 2 - 1; endX = startX + 2; startY = (startY + endY) / 2 - 1; endY = startY + 2; for (int x = startX; x <= endX; x++) { for (int y = startY; y <= endY; y++) { bitmap.SetPixel(x, y, Color.Black); } } }