Первые попытки рисовать

This commit is contained in:
2026-02-24 20:51:40 +03:00
parent 4f386c981c
commit ef768e9fe7
4 changed files with 127 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
const dvui = @import("dvui");
const CpuRenderEngine = @import("CpuRenderEngine.zig");
const Document = @import("../models/Document.zig");
const basic_models = @import("../models/basic_models.zig");
pub const RenderEngine = union(enum) {
@@ -16,4 +17,11 @@ pub const RenderEngine = union(enum) {
.cpu => |cpu_r| cpu_r.example(canvas_size, visible_rect),
};
}
/// Растеризует документ в текстуру (размер и видимая область в пикселях холста).
pub fn render(self: RenderEngine, document: *const Document, canvas_size: basic_models.ImageSize, visible_rect: basic_models.ImageRect) !?dvui.Texture {
return switch (self) {
.cpu => |cpu_r| cpu_r.renderDocument(document, canvas_size, visible_rect),
};
}
};