abstract class
Tessell::Kit::Painter
- Tessell::Kit::Painter
- Reference
- Object
Overview
绘制契约(issue #15, Painter 实现与宿主必须共同遵守):
- z-order:调用顺序即绘制顺序。text 与形状命令可任意交错,后提交者 覆盖先提交者——「先画文字再画不透明覆盖层」必须能盖住文字。 宿主禁止把文本收集后统一放到形状之后上屏(那会把 z-order 变成 「所有形状 → 所有文本」)。
- clip:push_clip/pop_clip 同时约束形状与文本;嵌套 clip 取交集。 滚动容器边缘的文本由后端 scissor 裁切,组件不得依赖“只发完全可见 文本”的 workaround。
- 文本基线:text(x, baseline_y, ...) 的坐标是基线起点(y-down), 与 Render::TextRenderer 的顶点生成约定一致。
Direct Known Subclasses
Defined in:
tessell/kit/painter.crInstance Method Summary
- #fill_rect(rect : Rect, color : UInt32) : Nil
- #fill_round_rect(rect : Rect, radius : Float32, color : UInt32) : Nil
-
#image(texture_id : Int32, bounds : Rect, tint : UInt32 = 4294967295_u32, src : Rect | Nil = nil) : Nil
外部纹理四边形(issue #28):texture_id 来自 Backend#create_texture (独立命名空间);tint 默认全白 = 原样;src 缺省 = 整图(后端按 纹理尺寸换算 uv)。
- #line(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, color : UInt32, width : Float32 = 1.0_f32) : Nil
- #pop_clip : Nil
- #push_clip(rect : Rect) : Nil
- #stroke_rect(rect : Rect, color : UInt32, width : Float32 = 1.0_f32) : Nil
- #stroke_round_rect(rect : Rect, radius : Float32, color : UInt32, width : Float32 = 1.0_f32) : Nil
- #text(x : Float32, baseline_y : Float32, text : String, color : UInt32, size : Float32, font_id : Int32 = 0) : Nil
Instance Method Detail
abstract
def image(texture_id : Int32, bounds : Rect, tint : UInt32 = 4294967295_u32, src : Rect | Nil = nil) : Nil
#
外部纹理四边形(issue #28):texture_id 来自 Backend#create_texture (独立命名空间);tint 默认全白 = 原样;src 缺省 = 整图(后端按 纹理尺寸换算 uv)。
abstract
def line(x1 : Float32, y1 : Float32, x2 : Float32, y2 : Float32, color : UInt32, width : Float32 = 1.0_f32) : Nil
#
abstract
def stroke_round_rect(rect : Rect, radius : Float32, color : UInt32, width : Float32 = 1.0_f32) : Nil
#
abstract
def text(x : Float32, baseline_y : Float32, text : String, color : UInt32, size : Float32, font_id : Int32 = 0) : Nil
#