class
Tessell::Render::SoftwareBackend
- Tessell::Render::SoftwareBackend
- Tessell::Render::Backend
- Reference
- Object
Defined in:
tessell/render/software_backend.crConstructors
Instance Method Summary
-
#attach_atlas(atlas : Text::GlyphAtlas) : Nil
文本采样需要 atlas 页数据;与 GL 的 resolved_texture 对应。
- #begin_frame(dirty : Array(Tessell::Rect) | Nil = nil, theme : Tessell::Render::Theme = Tessell::Render::Theme.light) : Nil
- #close : Nil
-
#create_texture(width : Int32, height : Int32, pixels : Bytes) : Int32
创建外部纹理;返回 handle(≥1,独立命名空间)。基类返回 0 = 不支持 (仿 draw_polygon 先例),实现方必须返回非 0。
-
#destroy_texture(handle : Int32) : Nil
销毁外部纹理;handle 失效后再绘制 Image 命令属应用层错误。
-
#draw_draw_list(list : Tessell::Render::DrawList, from : Int32 = 0, count : Int32 = -1) : Int32
Draw a command list.
-
#draw_polygon(points : Array(Tessell::Point), color : UInt32, even_odd : Bool = true) : Bool
even-odd 扫描填充(draw_polygon 的软件对应)。dirty 模式下逐脏矩形 裁剪(与 GLBackend 的 #2 修复同语义:覆盖不得写出脏区)。
-
#draw_text(vertices : Array(Vertex), batches : Array(TextBatch), batch_count : Int32 = batches.size, from_batch : Int32 = 0, clip : Tessell::Rect | Nil = nil) : Int32
Issue #15 contract: text is part of the command order — a host may draw text segments interleaved with draw_draw_list segments.
- #end_frame : Nil
- #height : Int32
- #init(width : Int32, height : Int32) : Nil
- #pixel(x : Int32, y : Int32) : UInt32
- #pixels : Bytes
- #resize(width : Int32, height : Int32) : Nil
- #resolved_texture(page : Int32) : Int32
-
#resolved_texture_external(handle : Int32) : Int32
外部纹理 handle 解析(独立命名空间,不与 glyph atlas 页号混用)。 基类返回 0 = 不支持;软件后端返回内部引用键。
- #stats : FrameStats
-
#sync_atlas(atlas : Text::GlyphAtlas) : Nil
全量重传 glyph atlas 所有页(冷启动/整体重建用)。动态文本场景禁止 每帧调用——增量路径走 sync_atlas_dirty(issue #22)。
-
#sync_atlas_dirty(atlas : Text::GlyphAtlas) : Nil
软件后端无上传概念,增量与全量同为引用更新(issue #22)。
-
#update_texture(handle : Int32, x : Int32, y : Int32, width : Int32, height : Int32, pixels : Bytes) : Nil
增量区域上传(GL 走 glTexSubImage2D 同型链路)。基类 no-op。
- #width : Int32
Instance methods inherited from class Tessell::Render::Backend
begin_frame(dirty : Array(Tessell::Rect) | Nil = nil, theme : Tessell::Render::Theme = Tessell::Render::Theme.light) : Nil
begin_frame,
close : Nil
close,
create_texture(width : Int32, height : Int32, pixels : Bytes) : Int32
create_texture,
destroy_texture(handle : Int32) : Nil
destroy_texture,
draw_draw_list(list : Tessell::Render::DrawList, from : Int32 = 0, count : Int32 = -1) : Int32
draw_draw_list,
draw_polygon(points : Array(Tessell::Point), color : UInt32, even_odd : Bool = true) : Bool
draw_polygon,
draw_text(vertices : Array(Vertex), batches : Array(TextBatch), batch_count : Int32 = batches.size, from_batch : Int32 = 0, clip : Tessell::Rect | Nil = nil) : Int32
draw_text,
end_frame : Nil
end_frame,
init(width : Int32, height : Int32) : Nil
init,
resize(width : Int32, height : Int32) : Nil
resize,
resolved_texture(page : Int32, color : Bool) : Int32resolved_texture(page : Int32) : Int32 resolved_texture, resolved_texture_external(handle : Int32) : Int32 resolved_texture_external, stats : FrameStats stats, sync_atlas(atlas : Text::GlyphAtlas) : Nil sync_atlas, sync_atlas_dirty(atlas : Text::GlyphAtlas) : Nil sync_atlas_dirty, update_texture(handle : Int32, x : Int32, y : Int32, width : Int32, height : Int32, pixels : Bytes) : Nil update_texture
Class methods inherited from class Tessell::Render::Backend
text_batch_end(size : Int32, batch_count : Int32, from_batch : Int32) : Int32
text_batch_end
Constructor Detail
Instance Method Detail
创建外部纹理;返回 handle(≥1,独立命名空间)。基类返回 0 = 不支持 (仿 draw_polygon 先例),实现方必须返回非 0。
销毁外部纹理;handle 失效后再绘制 Image 命令属应用层错误。
Draw a command list. Backends that support 2D primitives implement this;
base returns 0 = unsupported rather than silently claiming success.
Text commands are skipped here (rendered via draw_text) so a host can
interleave shape/text segments in command order. from/count select
a sub-range of the list (count < 0 = to the end). Returns number of
non-text commands actually submitted.
even-odd 扫描填充(draw_polygon 的软件对应)。dirty 模式下逐脏矩形 裁剪(与 GLBackend 的 #2 修复同语义:覆盖不得写出脏区)。
Issue #15 contract: text is part of the command order — a host may draw
text segments interleaved with draw_draw_list segments. from_batch
selects the unsubmitted suffix of batches; clip restricts the text
segment to a scissor rect (nil = unclipped).
Return value = quads submitted by THIS call (delta, issue #46);
stats.submitted_quads is the FRAME cumulative total (reset only in
begin_frame) — interleaved submissions accumulate, never reset.
外部纹理 handle 解析(独立命名空间,不与 glyph atlas 页号混用)。 基类返回 0 = 不支持;软件后端返回内部引用键。
全量重传 glyph atlas 所有页(冷启动/整体重建用)。动态文本场景禁止 每帧调用——增量路径走 sync_atlas_dirty(issue #22)。
增量区域上传(GL 走 glTexSubImage2D 同型链路)。基类 no-op。