Creating Graphics In Code
БесплатноБез исполняемых скриптовНе проверенCreates WPF graphics dynamically in C# code using Shape, PathGeometry, and PathFigure classes. Use when building charts, diagrams, or procedurally generated…
от christian289★ 42 звезды на GitHubОб этом скилле
Creating WPF Graphics in Code
Programmatically create shapes and geometry for dynamic graphics.
1. Shape Factory Pattern
namespace MyApp.Graphics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
public static class ShapeFactory
{
/// <summary>
/// Create circular marker
/// </summary>
public static Ellipse CreateCircle(double size, Brush fill, Brush? stroke = null)
{
var ellipse = new Ellipse
{
Width = size,
Height = size,
Fill = fill
};
if (stroke is not null)
{
ellipse.Stroke = stroke;
ellipse.StrokeThickness = 1;
}
return ellipse;
}
/// <summary>
/// Create rectangle with optional corner radius
/// </summary>
public static Rectangle CreateRectangle(
double width,
double height,
Brush fill,
double cornerRadius = 0)
{
return new Rectangle
{
Width = width,
Height = height,
Fill = fill,
RadiusX = cornerRadius,
RadiusY = cornerRadius
};
}
/// <summary>
/// Create line between two points
/// </summary>
public static Line CreateLine(Point start, Point end, Brush stroke, double thickness = 1)
{
return new Line
{
X1 = start.X,
Y1 = start.Y,
X2 = end.X,
Y2 = end.Y,
Stroke = stroke,
StrokeThickness = thickness
};
}
}
2. Geometry Builder Pattern
namespace MyApp.Graphics;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
public static class GeometryBuilder
{
/// <summary>
/// Create polygon from points
/// </summary>
public static PathGeometry CreatePolygon(IReadOnlyList<Point> points)
{
if (points.Count < 3)
return new PathGeometry();
var figure = new PathFigure
{
StartPoint = points[0],
IsClosed = true,
IsFilled = true
};
for (var i = 1; i < points.Count; i++)
{
figure.Segments.Add(new LineSegment(points[i], isStroked: true));
}
var geometry = new PathGeometry();
geometry.Figures.Add(figure);
return geometry;
}
/// <summary>
/// Create polyline (open path)
/// </summary>
public static PathGeometry CreatePolyline(IReadOnlyList<Point> points)
{
if (points.Count < 2)
return new PathGeometry();
var figure = new PathFigure
{
StartPoint = points[0],
IsClosed = false
};
for (var i = 1; i < points.Count; i++)
{
figure.Segments.Add(new LineSegment(points[i], isStroked: true));
}
var geometry = new PathGeometry();
geometry.Figures.Add(figure);
return geometry;
}
/// <summary>
/// Create cubic Bezier curve
/// </summary>
public static PathGeometry CreateBezierCurve(
Point start,
Point control1,
Point control2,
Point end)
{
var figure = new PathFigure { StartPoint = start };
figure.Segments.Add(new BezierSegment(control1, control2, end, isStroked: true));
var geometry = new PathGeometry();
geometry.Figures.Add(figure);
return geometry;
}
/// <summary>
/// Create arc
/// </summary>
public static PathGeometry CreateArc(
Point start,
Point end,
Size size,
SweepDirection direction = SweepDirection.Clockwise)
{
var figure = new PathFigure { StartPoint = start };
figure.Segments.Add(new ArcSegment(end, size, 0, false, direction, isStroked: true));
var geometry = new PathGeometry();
geometry.Figures.Add(figure);
return geometry;
}
}
3. Arrow Creation
/// <summary>
/// Create arrow with head
/// </summary>
public static Path CreateArrow(Point start, Point end, Brush stroke, double headSize = 10)
{
var geometry = new PathGeometry();
// Arrow body
var bodyFigure = new PathFigure { StartPoint = start };
bodyFigure.Segments.Add(new LineSegment(end, isStroked: true));
geometry.Figures.Add(bodyFigure);
// Calculate arrow head direction
var direction = end - start;
direction.Normalize();
var perpendicular = new Vector(-direction.Y, direction.X);
var headBase = end - direction * headSize;
var headLeft = headBase + perpendicular * (headSize / 2);
var headRight = headBase - perpendicular * (headSize / 2);
// Arrow head
var headFigure = new PathFigure { StartPoint = end, IsClosed = true, IsFilled = true };
headFigure.Segments.Add(new LineSegment(headLeft, isStroked: true));
headFigure.Segments.Add(new LineSegment(headRight, isStroked: true))
Установить Creating Graphics In Code в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Creating Graphics In Code?
Creates WPF graphics dynamically in C# code using Shape, PathGeometry, and PathFigure classes. Use when building charts, diagrams, or procedurally generated graphics.
Как установить скилл Creating Graphics In Code?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Creating Graphics In Code запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic