tui-td 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2716bc85090a6430068ad8820f9736657a3f122571999e34c39529060f59d487
4
- data.tar.gz: b73ff229c0396a87a5121b43ff81edf65be1f13de1aed58a7404cd263a0ba84e
3
+ metadata.gz: 2f09dac0e163cc0b1f2e699d66fe25fd656003b28ad17867a32154073cec8a62
4
+ data.tar.gz: a46f622e3a7a89c0451e603e89266575eec49b346af851c8bce393230684c759
5
5
  SHA512:
6
- metadata.gz: be25c3cfca1b280dacc7a2b968c887de55fce953e1c9903dd725d1291b34918375771eec7324522407ef783c2fc9010f0ef69b2e7c5fccc142bf6b2bd1396f40
7
- data.tar.gz: 0ee80ad5882c21763241f39c781a03a30180baf04707f7af5652bd913254b69c647efa59b06c57ff534b8b797a188adfaf40068f37956cad08b33a4cbc28cae0
6
+ metadata.gz: adb1c08cd89f21f59e270c73d94f8542ada7949069ebb5c6dcad27dc860264df93f09dea8e8c2053e90f909ca9c5405254e0f51d2afbd6dba194e1b3d293e4d3
7
+ data.tar.gz: 70597354fa770012221aa26f03a2ce4198f13ebb8ea66f1bacba20f7be740b1487d31c6908de19036889ae3ab0f60fc4a7cf57d993c5b938453f51618ecb9b28
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.7
4
+
5
+ - Screenshot rendering for 23 special characters: blocks (▀ ▄ █), triangles (▲ ▼), arrows (↑ ↓ → ←), half blocks (▌ ▐)
6
+ - Screenshot rendering for symbols: checkmarks (✓ ✗ ✖), checkboxes (☐ ☑ ☒), gear (⚙), warning (⚠), info (ℹ)
7
+ - Screenshot rendering for punctuation: ellipsis (…), em dash (—)
8
+ - Cursor drawing support in screenshot renderer
9
+ - Braille character rendering in screenshot
10
+ - Rounded corner box-drawing characters (╭ ╮ ╯ ╰) in screenshot
11
+ - `page_up` / `page_down` key support in test runner and driver
12
+ - Fixed junction pixels in rounded corner box-drawing characters
13
+
3
14
  ## 0.2.6
4
15
 
5
16
  - ISO-2022 charset switching support (G0/G1 designators, Shift Out/In) with DEC Special Character & Line Drawing mapping
data/README.md CHANGED
@@ -417,10 +417,14 @@ Top-level structure returned by `state_data` / `--json`:
417
417
 
418
418
  ```json
419
419
  {
420
- "size": {"rows": 40, "cols": 120},
421
- "cursor": {"row": 5, "col": 12},
422
- "rows": [[{"char": "A", "fg": "cyan", ...}]],
423
- "raw": "\e[31mred\e[0m\n..."
420
+ "size": {"rows": 40, "cols": 120},
421
+ "cursor": {"row": 5, "col": 12},
422
+ "cursor_visible": true,
423
+ "cursor_style": "block",
424
+ "mouse_mode": null,
425
+ "mouse_format": null,
426
+ "rows": [[{"char": "A", "fg": "cyan", ...}]],
427
+ "raw": "\e[31mred\e[0m\n..."
424
428
  }
425
429
  ```
426
430
 
data/lib/tui_td/driver.rb CHANGED
@@ -77,6 +77,8 @@ module TUITD
77
77
  when :backspace then send("\u007f")
78
78
  when :ctrl_c then send("\u0003")
79
79
  when :ctrl_d then send("\u0004")
80
+ when :page_up then send("\e[5~")
81
+ when :page_down then send("\e[6~")
80
82
  else send(keys.to_s)
81
83
  end
82
84
  end
@@ -117,6 +117,10 @@ module TUITD
117
117
  "┃" => [true, true, false, false, :heavy],
118
118
  "║" => [true, true, false, false, :double],
119
119
  # corners
120
+ "╭" => [false, true, false, true, :light_rounded],
121
+ "╮" => [false, true, true, false, :light_rounded],
122
+ "╯" => [true, false, true, false, :light_rounded],
123
+ "╰" => [true, false, false, true, :light_rounded],
120
124
  "┌" => [false, true, false, true, :light],
121
125
  "┍" => [false, true, false, true, :light],
122
126
  "┎" => [false, true, false, true, :light],
@@ -126,7 +130,6 @@ module TUITD
126
130
  "┒" => [false, true, true, false, :light],
127
131
  "┓" => [false, true, true, false, :heavy],
128
132
  "└" => [true, false, false, true, :light],
129
- "▼" => [true, false, false, true, :light],
130
133
  "┖" => [true, false, false, true, :light],
131
134
  "┗" => [true, false, false, true, :heavy],
132
135
  "┘" => [true, false, true, false, :light],
@@ -220,6 +223,8 @@ module TUITD
220
223
  end
221
224
  end
222
225
 
226
+ draw_cursor(image)
227
+
223
228
  image.save(output_path)
224
229
  output_path
225
230
  end
@@ -248,7 +253,110 @@ module TUITD
248
253
  return
249
254
  end
250
255
 
251
- return if char == " " || char.ord < 32 || char.ord > 126
256
+ char_ord = char.ord
257
+ if char_ord == 10095 # '❯'
258
+ draw_chevron(image, px, py, fg_rgb)
259
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
260
+ return
261
+ elsif char_ord == 9210 || char_ord == 9679 # '⏺' or '●'
262
+ draw_circle(image, px, py, fg_rgb)
263
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
264
+ return
265
+ elsif char_ord >= 0x2800 && char_ord <= 0x28ff # Braille spinner
266
+ draw_braille(image, px, py, char, fg_rgb)
267
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
268
+ return
269
+ elsif char_ord == 0x2580 # '▀'
270
+ fill_rect(image, px, py, CELL_W, 8, fg_rgb)
271
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
272
+ return
273
+ elsif char_ord == 0x2584 # '▄'
274
+ fill_rect(image, px, py + 8, CELL_W, 8, fg_rgb)
275
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
276
+ return
277
+ elsif char_ord == 0x2588 # '█'
278
+ fill_rect(image, px, py, CELL_W, CELL_H, fg_rgb)
279
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
280
+ return
281
+ elsif char_ord == 0x25B2 # '▲'
282
+ draw_up_triangle(image, px, py, fg_rgb)
283
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
284
+ return
285
+ elsif char_ord == 0x25BC # '▼'
286
+ draw_down_triangle(image, px, py, fg_rgb)
287
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
288
+ return
289
+ elsif char_ord == 0x2713 # '✓'
290
+ draw_checkmark(image, px, py, fg_rgb)
291
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
292
+ return
293
+ elsif char_ord == 0x2717 # '✗'
294
+ draw_ballot_x(image, px, py, fg_rgb)
295
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
296
+ return
297
+ elsif char_ord == 0x2191 # '↑'
298
+ draw_up_arrow(image, px, py, fg_rgb)
299
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
300
+ return
301
+ elsif char_ord == 0x2192 # '→'
302
+ draw_right_arrow(image, px, py, fg_rgb)
303
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
304
+ return
305
+ elsif char_ord == 0x2193 # '↓'
306
+ draw_down_arrow(image, px, py, fg_rgb)
307
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
308
+ return
309
+ elsif char_ord == 0x2699 # '⚙'
310
+ draw_gear(image, px, py, fg_rgb)
311
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
312
+ return
313
+ elsif char_ord == 0x26A0 # '⚠'
314
+ draw_warning(image, px, py, fg_rgb)
315
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
316
+ return
317
+ elsif char_ord == 0x2026 # '…'
318
+ draw_ellipsis(image, px, py, fg_rgb)
319
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
320
+ return
321
+ elsif char_ord == 0x2014 # '—'
322
+ (px..(px + 7)).each { |x| image[x, py + 8] = ChunkyPNG::Color.rgb(*fg_rgb) }
323
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
324
+ return
325
+ elsif char_ord == 0x2190 # '←'
326
+ draw_left_arrow(image, px, py, fg_rgb)
327
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
328
+ return
329
+ elsif char_ord == 0x258C # '▌'
330
+ draw_left_half_block(image, px, py, fg_rgb)
331
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
332
+ return
333
+ elsif char_ord == 0x2590 # '▐'
334
+ draw_right_half_block(image, px, py, fg_rgb)
335
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
336
+ return
337
+ elsif char_ord == 0x2610 # '☐'
338
+ draw_empty_checkbox(image, px, py, fg_rgb)
339
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
340
+ return
341
+ elsif char_ord == 0x2611 # '☑'
342
+ draw_checked_checkbox(image, px, py, fg_rgb)
343
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
344
+ return
345
+ elsif char_ord == 0x2612 # '☒'
346
+ draw_x_checkbox(image, px, py, fg_rgb)
347
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
348
+ return
349
+ elsif char_ord == 0x2139 # 'ℹ'
350
+ draw_info_symbol(image, px, py, fg_rgb)
351
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
352
+ return
353
+ elsif char_ord == 0x2716 # '✖'
354
+ draw_heavy_x(image, px, py, fg_rgb)
355
+ draw_underline(image, px, py, CELL_W, fg_rgb) if underline
356
+ return
357
+ end
358
+
359
+ return if char == " " || char_ord < 32 || char_ord > 126
252
360
 
253
361
  rows_data = glyph_rows(char)
254
362
  return unless rows_data
@@ -331,7 +439,7 @@ module TUITD
331
439
  end
332
440
  if right
333
441
  ((cx - 2)..(px + 7)).each { |x| image[x, py + 6] = color }
334
- ((cx - 2)..(px + 7)).each { |x| image[x, py + 10] = color }
442
+ ((cx - 2)..(px + 10)).each { |x| image[x, py + 10] = color }
335
443
  end
336
444
  if up
337
445
  (py..(cy + 2)).each { |y| image[px + 2, y] = color }
@@ -370,6 +478,29 @@ module TUITD
370
478
  image[cx + 1, y] = color
371
479
  end
372
480
  end
481
+ elsif style == :light_rounded
482
+ case char
483
+ when "╭"
484
+ (px + 5..px + 7).each { |x| image[x, py + 8] = color }
485
+ (py + 10..py + 15).each { |y| image[px + 4, y] = color }
486
+ image[px + 4, py + 9] = color
487
+ image[px + 5, py + 9] = color
488
+ when "╮"
489
+ (px..px + 3).each { |x| image[x, py + 8] = color }
490
+ (py + 10..py + 15).each { |y| image[px + 4, y] = color }
491
+ image[px + 4, py + 9] = color
492
+ image[px + 3, py + 9] = color
493
+ when "╯"
494
+ (px..px + 3).each { |x| image[x, py + 8] = color }
495
+ (py..py + 6).each { |y| image[px + 4, y] = color }
496
+ image[px + 4, py + 7] = color
497
+ image[px + 3, py + 7] = color
498
+ when "╰"
499
+ (px + 5..px + 7).each { |x| image[x, py + 8] = color }
500
+ (py..py + 6).each { |y| image[px + 4, y] = color }
501
+ image[px + 4, py + 7] = color
502
+ image[px + 5, py + 7] = color
503
+ end
373
504
  else # :light
374
505
  if left
375
506
  (px..cx).each { |x| image[x, cy] = color }
@@ -386,5 +517,341 @@ module TUITD
386
517
  end
387
518
  end
388
519
 
520
+ def draw_cursor(image)
521
+ cursor_info = @state[:cursor] || @state["cursor"] || {}
522
+ cursor_vis = @state[:cursor_visible]
523
+ cursor_vis = cursor_info[:visible] if cursor_vis.nil?
524
+ cursor_vis = cursor_info["visible"] if cursor_vis.nil?
525
+ cursor_vis = false if cursor_vis.nil? # default invisible
526
+
527
+ return unless cursor_vis
528
+
529
+ ri = cursor_info[:row] || cursor_info["row"] || 0
530
+ ci = cursor_info[:col] || cursor_info["col"] || 0
531
+
532
+ return if ri < 0 || ri >= @rows || ci < 0 || ci >= @cols
533
+
534
+ style_val = @state[:cursor_style] || cursor_info[:style] || cursor_info["style"] || 1
535
+
536
+ px = ci * CELL_W
537
+ py = ri * CELL_H
538
+
539
+ color_rgb = [255, 255, 255] # Weiß standardmäßig
540
+ color = ChunkyPNG::Color.rgb(*color_rgb)
541
+
542
+ case style_val
543
+ when 1, 2 # Blinking Block oder Steady Block
544
+ CELL_H.times do |dy|
545
+ CELL_W.times do |dx|
546
+ x = px + dx
547
+ y = py + dy
548
+ next if x >= image.width || y >= image.height
549
+ original_color = image[x, y]
550
+ r = 255 - ChunkyPNG::Color.r(original_color)
551
+ g = 255 - ChunkyPNG::Color.g(original_color)
552
+ b = 255 - ChunkyPNG::Color.b(original_color)
553
+ image[x, y] = ChunkyPNG::Color.rgb(r, g, b)
554
+ end
555
+ end
556
+ when 3, 4 # Underline
557
+ 2.times do |h_offset|
558
+ y = py + CELL_H - 1 - h_offset
559
+ next if y >= image.height
560
+ CELL_W.times do |dx|
561
+ x = px + dx
562
+ next if x >= image.width
563
+ image[x, y] = color
564
+ end
565
+ end
566
+ when 5, 6 # Bar
567
+ 2.times do |w_offset|
568
+ x = px + w_offset
569
+ next if x >= image.width
570
+ CELL_H.times do |dy|
571
+ y = py + dy
572
+ next if y >= image.height
573
+ image[x, y] = color
574
+ end
575
+ end
576
+ end
577
+ end
578
+
579
+ def draw_chevron(image, px, py, fg_rgb)
580
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
581
+ (0..3).each do |i|
582
+ image[px + 2 + i, py + 4 + i] = color
583
+ image[px + 3 + i, py + 4 + i] = color # bold/thick chevron
584
+
585
+ image[px + 5 - i, py + 8 + i] = color
586
+ image[px + 6 - i, py + 8 + i] = color # bold/thick chevron
587
+ end
588
+ end
589
+
590
+ def draw_circle(image, px, py, fg_rgb)
591
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
592
+ cx = px + 4
593
+ cy = py + 8
594
+ (-3..3).each do |dy|
595
+ r_width = case dy.abs
596
+ when 3 then 1
597
+ when 2 then 2
598
+ else 3
599
+ end
600
+ (-r_width..r_width).each do |dx|
601
+ x = cx + dx
602
+ y = cy + dy
603
+ next if x < px || x >= px + CELL_W || y < py || y >= py + CELL_H
604
+ image[x, y] = color
605
+ end
606
+ end
607
+ end
608
+
609
+ def draw_braille(image, px, py, char, fg_rgb)
610
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
611
+ mask = char.ord - 0x2800
612
+ dot_coords = [
613
+ [2, 3], # Dot 1
614
+ [2, 6], # Dot 2
615
+ [2, 9], # Dot 3
616
+ [5, 3], # Dot 4
617
+ [5, 6], # Dot 5
618
+ [5, 9], # Dot 6
619
+ [2, 12], # Dot 7
620
+ [5, 12] # Dot 8
621
+ ]
622
+ dot_coords.each_with_index do |(dx, dy), idx|
623
+ if (mask & (1 << idx)) != 0
624
+ 2.times do |ddy|
625
+ 2.times do |ddx|
626
+ x = px + dx + ddx
627
+ y = py + dy + ddy
628
+ next if x >= image.width || y >= image.height
629
+ image[x, y] = color
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end
635
+
636
+ def draw_up_triangle(image, px, py, fg_rgb)
637
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
638
+ (5..8).each do |dy|
639
+ width = dy - 5
640
+ (4 - width..4 + width).each do |dx|
641
+ image[px + dx, py + dy] = color
642
+ end
643
+ end
644
+ end
645
+
646
+ def draw_down_triangle(image, px, py, fg_rgb)
647
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
648
+ (5..8).each do |dy|
649
+ width = 8 - dy
650
+ (4 - width..4 + width).each do |dx|
651
+ image[px + dx, py + dy] = color
652
+ end
653
+ end
654
+ end
655
+
656
+ def draw_checkmark(image, px, py, fg_rgb)
657
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
658
+ image[px + 2, py + 8] = color
659
+ image[px + 3, py + 9] = color
660
+ image[px + 4, py + 10] = color
661
+ image[px + 5, py + 8] = color
662
+ image[px + 6, py + 6] = color
663
+ image[px + 7, py + 4] = color
664
+ end
665
+
666
+ def draw_ballot_x(image, px, py, fg_rgb)
667
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
668
+ image[px + 2, py + 5] = color
669
+ image[px + 3, py + 6] = color
670
+ image[px + 3, py + 7] = color
671
+ image[px + 4, py + 8] = color
672
+ image[px + 5, py + 9] = color
673
+ image[px + 5, py + 10] = color
674
+ image[px + 6, py + 11] = color
675
+ image[px + 2, py + 11] = color
676
+ image[px + 3, py + 10] = color
677
+ image[px + 3, py + 9] = color
678
+ image[px + 5, py + 7] = color
679
+ image[px + 5, py + 6] = color
680
+ image[px + 6, py + 5] = color
681
+ end
682
+
683
+ def draw_up_arrow(image, px, py, fg_rgb)
684
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
685
+ (3..12).each { |dy| image[px + 4, py + dy] = color }
686
+ image[px + 3, py + 4] = color
687
+ image[px + 5, py + 4] = color
688
+ image[px + 2, py + 5] = color
689
+ image[px + 6, py + 5] = color
690
+ end
691
+
692
+ def draw_down_arrow(image, px, py, fg_rgb)
693
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
694
+ (3..12).each { |dy| image[px + 4, py + dy] = color }
695
+ image[px + 3, py + 11] = color
696
+ image[px + 5, py + 11] = color
697
+ image[px + 2, py + 10] = color
698
+ image[px + 6, py + 10] = color
699
+ end
700
+
701
+ def draw_right_arrow(image, px, py, fg_rgb)
702
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
703
+ (1..6).each { |dx| image[px + dx, py + 8] = color }
704
+ image[px + 5, py + 7] = color
705
+ image[px + 5, py + 9] = color
706
+ image[px + 4, py + 6] = color
707
+ image[px + 4, py + 10] = color
708
+ end
709
+
710
+ def draw_gear(image, px, py, fg_rgb)
711
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
712
+ image[px + 4, py + 6] = color
713
+ image[px + 4, py + 10] = color
714
+ image[px + 2, py + 8] = color
715
+ image[px + 6, py + 8] = color
716
+ image[px + 3, py + 7] = color
717
+ image[px + 5, py + 7] = color
718
+ image[px + 3, py + 9] = color
719
+ image[px + 5, py + 9] = color
720
+ image[px + 4, py + 5] = color
721
+ image[px + 4, py + 11] = color
722
+ image[px + 1, py + 8] = color
723
+ image[px + 7, py + 8] = color
724
+ image[px + 2, py + 6] = color
725
+ image[px + 6, py + 6] = color
726
+ image[px + 2, py + 10] = color
727
+ image[px + 6, py + 10] = color
728
+ end
729
+
730
+ def draw_warning(image, px, py, fg_rgb)
731
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
732
+ image[px + 4, py + 3] = color
733
+ image[px + 3, py + 4] = color
734
+ image[px + 5, py + 4] = color
735
+ image[px + 3, py + 5] = color
736
+ image[px + 5, py + 5] = color
737
+ image[px + 2, py + 6] = color
738
+ image[px + 6, py + 6] = color
739
+ image[px + 2, py + 7] = color
740
+ image[px + 6, py + 7] = color
741
+ image[px + 1, py + 8] = color
742
+ image[px + 7, py + 8] = color
743
+ image[px + 1, py + 9] = color
744
+ image[px + 7, py + 9] = color
745
+ (1..7).each { |dx| image[px + dx, py + 10] = color }
746
+ image[px + 4, py + 5] = color
747
+ image[px + 4, py + 6] = color
748
+ image[px + 4, py + 7] = color
749
+ image[px + 4, py + 9] = color
750
+ end
751
+
752
+ def draw_ellipsis(image, px, py, fg_rgb)
753
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
754
+ image[px + 1, py + 12] = color
755
+ image[px + 4, py + 12] = color
756
+ image[px + 6, py + 12] = color
757
+ end
758
+
759
+ def draw_left_arrow(image, px, py, fg_rgb)
760
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
761
+ (1..6).each { |dx| image[px + dx, py + 8] = color }
762
+ image[px + 2, py + 7] = color
763
+ image[px + 2, py + 9] = color
764
+ image[px + 3, py + 6] = color
765
+ image[px + 3, py + 10] = color
766
+ end
767
+
768
+ def draw_left_half_block(image, px, py, fg_rgb)
769
+ fill_rect(image, px, py, 4, CELL_H, fg_rgb)
770
+ end
771
+
772
+ def draw_right_half_block(image, px, py, fg_rgb)
773
+ fill_rect(image, px + 4, py, 4, CELL_H, fg_rgb)
774
+ end
775
+
776
+ def draw_checkbox_border(image, px, py, color)
777
+ (1..6).each do |dx|
778
+ image[px + dx, py + 4] = color
779
+ image[px + dx, py + 11] = color
780
+ end
781
+ (4..11).each do |dy|
782
+ image[px + 1, py + dy] = color
783
+ image[px + 6, py + dy] = color
784
+ end
785
+ end
786
+
787
+ def draw_empty_checkbox(image, px, py, fg_rgb)
788
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
789
+ draw_checkbox_border(image, px, py, color)
790
+ end
791
+
792
+ def draw_checked_checkbox(image, px, py, fg_rgb)
793
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
794
+ draw_checkbox_border(image, px, py, color)
795
+ image[px + 2, py + 8] = color
796
+ image[px + 3, py + 9] = color
797
+ image[px + 4, py + 7] = color
798
+ image[px + 5, py + 5] = color
799
+ end
800
+
801
+ def draw_x_checkbox(image, px, py, fg_rgb)
802
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
803
+ draw_checkbox_border(image, px, py, color)
804
+ image[px + 2, py + 5] = color
805
+ image[px + 2, py + 6] = color
806
+ image[px + 3, py + 7] = color
807
+ image[px + 3, py + 8] = color
808
+ image[px + 4, py + 7] = color
809
+ image[px + 4, py + 8] = color
810
+ image[px + 5, py + 9] = color
811
+ image[px + 5, py + 10] = color
812
+ image[px + 2, py + 10] = color
813
+ image[px + 2, py + 9] = color
814
+ image[px + 5, py + 6] = color
815
+ image[px + 5, py + 5] = color
816
+ end
817
+
818
+ def draw_info_symbol(image, px, py, fg_rgb)
819
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
820
+ (3..5).each do |dx|
821
+ image[px + dx, py + 4] = color
822
+ image[px + dx, py + 12] = color
823
+ end
824
+ image[px + 2, py + 5] = color
825
+ image[px + 6, py + 5] = color
826
+ image[px + 2, py + 11] = color
827
+ image[px + 6, py + 11] = color
828
+ (6..10).each do |dy|
829
+ image[px + 1, py + dy] = color
830
+ image[px + 7, py + dy] = color
831
+ end
832
+ image[px + 4, py + 6] = color
833
+ (8..10).each do |dy|
834
+ image[px + 4, py + dy] = color
835
+ end
836
+ end
837
+
838
+ def draw_heavy_x(image, px, py, fg_rgb)
839
+ color = ChunkyPNG::Color.rgb(*fg_rgb)
840
+ [4, 5, 11, 12].each do |dy|
841
+ image[px + 1, py + dy] = color
842
+ image[px + 2, py + dy] = color
843
+ image[px + 5, py + dy] = color
844
+ image[px + 6, py + dy] = color
845
+ end
846
+ [6, 7, 9, 10].each do |dy|
847
+ image[px + 2, py + dy] = color
848
+ image[px + 3, py + dy] = color
849
+ image[px + 4, py + dy] = color
850
+ image[px + 5, py + dy] = color
851
+ end
852
+ image[px + 3, py + 8] = color
853
+ image[px + 4, py + 8] = color
854
+ end
855
+
389
856
  end
390
857
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TUITD
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tui-td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Haluk Durmus