Первая растеризация

This commit is contained in:
2026-02-24 21:56:15 +03:00
parent ef768e9fe7
commit e5dd455d14
8 changed files with 376 additions and 85 deletions

22
src/render/cpu/broken.zig Normal file
View File

@@ -0,0 +1,22 @@
const std = @import("std");
const Document = @import("../../models/Document.zig");
const pipeline = @import("pipeline.zig");
const line = @import("line.zig");
const DrawContext = pipeline.DrawContext;
const Color = @import("dvui").Color;
const Object = Document.Object;
const default_stroke: Color.PMA = .{ .r = 0, .g = 0, .b = 0, .a = 255 };
/// Рисует ломаную по точкам в локальных координатах. Обводка по stroke_rgba.
pub fn draw(ctx: *DrawContext, obj: *const Object) void {
const p_prop = obj.getProperty(.points) orelse return;
const pts = p_prop.points.items;
if (pts.len < 2) return;
const stroke = if (obj.getProperty(.stroke_rgba)) |s| pipeline.rgbaToPma(s.stroke_rgba) else default_stroke;
var i: usize = 0;
while (i + 1 < pts.len) : (i += 1) {
line.drawLine(ctx, pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y, stroke);
}
}