Заливка и замкнутая фигура

This commit is contained in:
2026-03-03 14:21:55 +03:00
parent e5b8e6735d
commit 32cffb757d
5 changed files with 181 additions and 1 deletions

View File

@@ -18,6 +18,11 @@ pub const Data = union(enum) {
end_point: Point2_f,
points: std.ArrayList(Point2_f),
/// Замкнутый контур (для ломаной: отрезок последняя–первая точка + заливка).
closed: bool,
/// Включена ли заливка.
filled: bool,
/// Цвет заливки, 0xRRGGBBAA.
fill_rgba: u32,

View File

@@ -25,6 +25,9 @@ pub fn appendDefaultShapeProperties(allocator: std.mem.Allocator, obj: *Object)
var points = std.ArrayList(Point2_f).empty;
try points.appendSlice(allocator, &default_points);
try obj.properties.append(allocator, .{ .data = .{ .points = points } });
try obj.properties.append(allocator, .{ .data = .{ .closed = false } });
try obj.properties.append(allocator, .{ .data = .{ .filled = true } });
try obj.properties.append(allocator, .{ .data = .{ .fill_rgba = obj.getProperty(.stroke_rgba).?.stroke_rgba } });
}
/// Локальные границы: AABB по точкам.