class Tessell::Render::SoftwareBackend

Defined in:

tessell/render/software_backend.cr

Constructors

Instance Method Summary

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) : Int32
resolved_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

def self.new #

[View source]

Instance Method Detail

def attach_atlas(atlas : Text::GlyphAtlas) : Nil #

文本采样需要 atlas 页数据;与 GL 的 resolved_texture 对应。


[View source]
def begin_frame(dirty : Array(Tessell::Rect) | Nil = nil, theme : Tessell::Render::Theme = Tessell::Render::Theme.light) : Nil #

[View source]
def close : Nil #

[View source]
def create_texture(width : Int32, height : Int32, pixels : Bytes) : Int32 #
Description copied from class Tessell::Render::Backend

创建外部纹理;返回 handle(≥1,独立命名空间)。基类返回 0 = 不支持 (仿 draw_polygon 先例),实现方必须返回非 0。


[View source]
def destroy_texture(handle : Int32) : Nil #
Description copied from class Tessell::Render::Backend

销毁外部纹理;handle 失效后再绘制 Image 命令属应用层错误。


[View source]
def draw_draw_list(list : Tessell::Render::DrawList, from : Int32 = 0, count : Int32 = -1) : Int32 #
Description copied from class Tessell::Render::Backend

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.


[View source]
def draw_polygon(points : Array(Tessell::Point), color : UInt32, even_odd : Bool = true) : Bool #

even-odd 扫描填充(draw_polygon 的软件对应)。dirty 模式下逐脏矩形 裁剪(与 GLBackend 的 #2 修复同语义:覆盖不得写出脏区)。


[View source]
def draw_text(vertices : Array(Vertex), batches : Array(TextBatch), batch_count : Int32 = batches.size, from_batch : Int32 = 0, clip : Tessell::Rect | Nil = nil) : Int32 #
Description copied from class Tessell::Render::Backend

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.


[View source]
def end_frame : Nil #

[View source]
def height : Int32 #

[View source]
def init(width : Int32, height : Int32) : Nil #

[View source]
def pixel(x : Int32, y : Int32) : UInt32 #

[View source]
def pixels : Bytes #

[View source]
def resize(width : Int32, height : Int32) : Nil #

[View source]
def resolved_texture(page : Int32) : Int32 #

[View source]
def resolved_texture_external(handle : Int32) : Int32 #
Description copied from class Tessell::Render::Backend

外部纹理 handle 解析(独立命名空间,不与 glyph atlas 页号混用)。 基类返回 0 = 不支持;软件后端返回内部引用键。


[View source]
def stats : FrameStats #

[View source]
def sync_atlas(atlas : Text::GlyphAtlas) : Nil #
Description copied from class Tessell::Render::Backend

全量重传 glyph atlas 所有页(冷启动/整体重建用)。动态文本场景禁止 每帧调用——增量路径走 sync_atlas_dirty(issue #22)。


[View source]
def sync_atlas_dirty(atlas : Text::GlyphAtlas) : Nil #

软件后端无上传概念,增量与全量同为引用更新(issue #22)。


[View source]
def update_texture(handle : Int32, x : Int32, y : Int32, width : Int32, height : Int32, pixels : Bytes) : Nil #
Description copied from class Tessell::Render::Backend

增量区域上传(GL 走 glTexSubImage2D 同型链路)。基类 no-op。


[View source]
def width : Int32 #

[View source]