MCPcopy Create free account
hub / github.com/B33pBeeps/redthread / drawNoteInternal

Function drawNoteInternal

internal/app/draw.go:265–447  ·  view source on GitHub ↗
(c *Canvas, rect Rect, n *Note, selected bool, textMode TextStyleMode, borderOverride *RGB)

Source from the content-addressed store, hash-verified

263}
264
265func drawNoteInternal(c *Canvas, rect Rect, n *Note, selected bool, textMode TextStyleMode, borderOverride *RGB) {
266 tint := GetTint(n.Tint)
267 paper := tint.Paper
268 ink := tint.Ink
269 tape := tint.Tape
270 fiberCol := tint.Fiber
271
272 border := paper.Dimmed(0.8)
273 if selected {
274 border = SelBorder
275 }
276 if borderOverride != nil {
277 border = *borderOverride
278 }
279 borderAttr := uint8(0)
280 if selected {
281 borderAttr = AttrBold
282 }
283 if n.Flash > 0.05 {
284 border = Lerp(border, tint.Edge, n.Flash*0.6)
285 }
286
287 x0, y0, w, h := rect.X, rect.Y, rect.W, rect.H
288 if w < 6 || h < 4 {
289 return // too small to render
290 }
291
292 // 1. Clear interior.
293 for dy := 0; dy < h; dy++ {
294 for dx := 0; dx < w; dx++ {
295 c.SetBlank(x0+dx, y0+dy)
296 }
297 }
298
299 // 2. Tape strip (row 0) — simplified: crease pattern + single pin.
300 drawTapeStrip(c, x0, y0, w, tape, border, borderAttr, selected)
301
302 // 3. Vertical borders — varied chars per row for ASCII-weave feel.
303 seed := hash(n.ID)
304 for dy := 1; dy < h-1; dy++ {
305 leftCh := vertBorderChar(seed, dy)
306 rightCh := vertBorderChar(seed^0xA5A5, dy)
307 c.SetRune(x0, y0+dy, leftCh, border, borderAttr)
308 c.SetRune(x0+w-1, y0+dy, rightCh, border, borderAttr)
309 }
310
311 // 4. Bottom border (row h-1).
312 for dx := 0; dx < w; dx++ {
313 x := x0 + dx
314 var r rune
315 switch {
316 case dx == 0:
317 r = '╰'
318 case dx == w-1:
319 r = '╯'
320 default:
321 switch (dx + x0) % 6 {
322 case 0, 3:

Callers 2

drawNoteAtWithBorderFunction · 0.85
drawNoteAtFunction · 0.85

Calls 15

GetTintFunction · 0.85
LerpFunction · 0.85
drawTapeStripFunction · 0.85
hashFunction · 0.85
vertBorderCharFunction · 0.85
StyleTextFunction · 0.85
ModeAttrFunction · 0.85
runeLenFunction · 0.85
trimRunesFunction · 0.85
wrapLinesFunction · 0.85
DimmedMethod · 0.80
SetBlankMethod · 0.80

Tested by

no test coverage detected