@@ -20,7 +20,6 @@ import (
20
20
"github.com/FloatTech/floatbox/web"
21
21
"github.com/FloatTech/gg"
22
22
"github.com/FloatTech/imgfactory"
23
- "github.com/FloatTech/rendercard"
24
23
ctrl "github.com/FloatTech/zbpctrl"
25
24
"github.com/FloatTech/zbputils/control"
26
25
"github.com/FloatTech/zbputils/ctxext"
@@ -237,14 +236,17 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string, botrunsta
237
236
defer wg .Done ()
238
237
titlecard := gg .NewContext (cardw , titlecardh )
239
238
bwg .Wait ()
240
- titlecard .DrawImage (blurback , - 70 , - 70 )
241
239
242
240
titlecard .DrawRoundedRectangle (1 , 1 , float64 (titlecard .W ()- 1 * 2 ), float64 (titlecardh - 1 * 2 ), 16 )
241
+ titlecard .ClipPreserve ()
242
+ titlecard .DrawImage (blurback , - 70 , - 70 )
243
+ titlecard .SetColor (colorswitch (140 ))
244
+ titlecard .FillPreserve ()
245
+
243
246
titlecard .SetLineWidth (3 )
244
247
titlecard .SetColor (colorswitch (100 ))
245
- titlecard .StrokePreserve ()
246
- titlecard .SetColor (colorswitch (140 ))
247
- titlecard .Fill ()
248
+ titlecard .ResetClip ()
249
+ titlecard .Stroke ()
248
250
249
251
titlecard .DrawImage (avatarf .Circle (0 ).Image (), (titlecardh - avatarf .H ())/ 2 , (titlecardh - avatarf .H ())/ 2 )
250
252
@@ -288,20 +290,23 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string, botrunsta
288
290
fw , _ = titlecard .MeasureString (bs )
289
291
290
292
titlecard .DrawStringAnchored (bs , float64 (titlecardh )+ fw / 2 , float64 (titlecardh )* (0.5 + 0.75 / 2 ), 0.5 , 0.5 )
291
- titleimg = rendercard . Fillet ( titlecard .Image (), 16 )
293
+ titleimg = titlecard .Image ()
292
294
}()
293
295
go func () {
294
296
defer wg .Done ()
295
297
basiccard := gg .NewContext (cardw , basiccardh )
296
298
bwg .Wait ()
297
- basiccard .DrawImage (blurback , - 70 , - 70 - titlecardh - 40 )
298
299
299
300
basiccard .DrawRoundedRectangle (1 , 1 , float64 (basiccard .W ()- 1 * 2 ), float64 (basiccardh - 1 * 2 ), 16 )
301
+ basiccard .ClipPreserve ()
302
+ basiccard .DrawImage (blurback , - 70 , - 70 - titlecardh - 40 )
303
+ basiccard .SetColor (colorswitch (140 ))
304
+ basiccard .FillPreserve ()
305
+
300
306
basiccard .SetLineWidth (3 )
301
307
basiccard .SetColor (colorswitch (100 ))
302
- basiccard .StrokePreserve ()
303
- basiccard .SetColor (colorswitch (140 ))
304
- basiccard .Fill ()
308
+ basiccard .ResetClip ()
309
+ basiccard .Stroke ()
305
310
306
311
bslen := len (basicstate )
307
312
for i , v := range basicstate {
@@ -361,20 +366,23 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string, botrunsta
361
366
basiccard .DrawStringAnchored (s , (float64 (basiccard .W ())- 200 * float64 (bslen ))/ float64 (bslen + 1 )+ 200 / 2 + offset , 20 + 200 + 15 + fw + 15 + basiccard .FontHeight ()/ 2 + float64 (k )* textoffsety , 0.5 , 0.5 )
362
367
}
363
368
}
364
- basicimg = rendercard . Fillet ( basiccard .Image (), 16 )
369
+ basicimg = basiccard .Image ()
365
370
}()
366
371
go func () {
367
372
defer wg .Done ()
368
373
diskcard := gg .NewContext (cardw , diskcardh )
369
374
bwg .Wait ()
370
- diskcard .DrawImage (blurback , - 70 , - 70 - titlecardh - 40 - basiccardh - 40 )
371
375
372
376
diskcard .DrawRoundedRectangle (1 , 1 , float64 (diskcard .W ()- 1 * 2 ), float64 (diskcardh - 1 * 2 ), 16 )
377
+ diskcard .ClipPreserve ()
378
+ diskcard .DrawImage (blurback , - 70 , - 70 - titlecardh - 40 - basiccardh - 40 )
379
+ diskcard .SetColor (colorswitch (140 ))
380
+ diskcard .FillPreserve ()
381
+
373
382
diskcard .SetLineWidth (3 )
374
383
diskcard .SetColor (colorswitch (100 ))
375
- diskcard .StrokePreserve ()
376
- diskcard .SetColor (colorswitch (140 ))
377
- diskcard .Fill ()
384
+ diskcard .ResetClip ()
385
+ diskcard .Stroke ()
378
386
379
387
err = diskcard .ParseFontFace (fontbyte , 32 )
380
388
if err != nil {
@@ -427,6 +435,7 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string, botrunsta
427
435
}
428
436
429
437
diskcard .DrawRoundedRectangle (40 , 40 + (float64 (diskcardh - 40 * 2 )- 50 * float64 (dslen ))/ float64 (dslen - 1 )+ offset , float64 (diskcard .W ())- 40 - 100 , 50 , 12 )
438
+ diskcard .ClipPreserve ()
430
439
diskcard .Fill ()
431
440
432
441
colors := darkcolor
@@ -445,6 +454,7 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string, botrunsta
445
454
446
455
diskcard .DrawRoundedRectangle (40 , 40 + (float64 (diskcardh - 40 * 2 )- 50 * float64 (dslen ))/ float64 (dslen - 1 )+ offset , (float64 (diskcard .W ())- 40 - 100 )* v .precent * 0.01 , 50 , 12 )
447
456
diskcard .Fill ()
457
+ diskcard .ResetClip ()
448
458
449
459
diskcard .SetColor (fontcolorswitch ())
450
460
@@ -456,20 +466,23 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string, botrunsta
456
466
diskcard .DrawStringAnchored (strconv .FormatFloat (v .precent , 'f' , 0 , 64 )+ "%" , float64 (diskcard .W ())- 100 / 2 , 40 + (float64 (diskcardh - 40 * 2 )- 50 * float64 (dslen ))/ float64 (dslen - 1 )+ 50 / 2 + offset , 0.5 , 0.5 )
457
467
}
458
468
}
459
- diskimg = rendercard . Fillet ( diskcard .Image (), 16 )
469
+ diskimg = diskcard .Image ()
460
470
}()
461
471
go func () {
462
472
defer wg .Done ()
463
473
moreinfocard := gg .NewContext (cardw , moreinfocardh )
464
474
bwg .Wait ()
465
- moreinfocard .DrawImage (blurback , - 70 , - 70 - titlecardh - 40 - basiccardh - 40 - diskcardh - 40 )
466
475
467
476
moreinfocard .DrawRoundedRectangle (1 , 1 , float64 (moreinfocard .W ()- 1 * 2 ), float64 (moreinfocard .H ()- 1 * 2 ), 16 )
477
+ moreinfocard .ClipPreserve ()
478
+ moreinfocard .DrawImage (blurback , - 70 , - 70 - titlecardh - 40 - basiccardh - 40 - diskcardh - 40 )
479
+ moreinfocard .SetColor (colorswitch (140 ))
480
+ moreinfocard .FillPreserve ()
481
+
468
482
moreinfocard .SetLineWidth (3 )
469
483
moreinfocard .SetColor (colorswitch (100 ))
470
- moreinfocard .StrokePreserve ()
471
- moreinfocard .SetColor (colorswitch (140 ))
472
- moreinfocard .Fill ()
484
+ moreinfocard .ResetClip ()
485
+ moreinfocard .Stroke ()
473
486
474
487
err = moreinfocard .ParseFontFace (fontbyte , 32 )
475
488
if err != nil {
@@ -488,7 +501,7 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string, botrunsta
488
501
moreinfocard .DrawStringAnchored (v .name , 20 + fw / 2 , 30 + (float64 (moreinfocardh - 30 * 2 )- moreinfocard .FontHeight ()* float64 (milen ))/ float64 (milen - 1 )+ moreinfocard .FontHeight ()/ 2 + offset , 0.5 , 0.5 )
489
502
moreinfocard .DrawStringAnchored (v .text [0 ], float64 (moreinfocard .W ())- 20 - fw1 / 2 , 30 + (float64 (moreinfocardh - 30 * 2 )- moreinfocard .FontHeight ()* float64 (milen ))/ float64 (milen - 1 )+ moreinfocard .FontHeight ()/ 2 + offset , 0.5 , 0.5 )
490
503
}
491
- moreinfoimg = rendercard . Fillet ( moreinfocard .Image (), 16 )
504
+ moreinfoimg = moreinfocard .Image ()
492
505
}()
493
506
go func () {
494
507
defer wg .Done ()
@@ -668,7 +681,7 @@ func diskstate() (stateinfo []*status, err error) {
668
681
func moreinfo (m * ctrl.Control [* zero.Ctx ]) (stateinfo []* status , err error ) {
669
682
var mems runtime.MemStats
670
683
runtime .ReadMemStats (& mems )
671
- fmtmem := storagefmt (float64 (mems .Sys ))
684
+ fmtmem := storagefmt (float64 (mems .Alloc ))
672
685
673
686
hostinfo , err := host .Info ()
674
687
if err != nil {
0 commit comments