MCPcopy Index your code
hub / github.com/FloatTech/ZeroBot-Plugin / drawArticleEmptyBlock

Function drawArticleEmptyBlock

plugin/mcfish/pack.go:388–416  ·  view source on GitHub ↗

绘制背包信息区域

(fontdata []byte)

Source from the content-addressed store, hash-verified

386
387// 绘制背包信息区域
388func drawArticleEmptyBlock(fontdata []byte) (image.Image, error) {
389 canvas := gg.NewContext(1000, 300)
390 // 画底色
391 canvas.DrawRectangle(0, 0, 1000, 300)
392 canvas.SetRGBA255(255, 255, 255, 150)
393 canvas.Fill()
394 // 边框框
395 canvas.DrawRectangle(0, 0, 1000, 300)
396 canvas.SetLineWidth(3)
397 canvas.SetRGBA255(0, 0, 0, 255)
398 canvas.Stroke()
399
400 canvas.SetColor(color.Black)
401 err := canvas.ParseFontFace(fontdata, 100)
402 if err != nil {
403 return nil, err
404 }
405 textW, textH := canvas.MeasureString("背包信息")
406 canvas.DrawString("背包信息", 10, 10+textH*1.2)
407 canvas.DrawLine(10, textH*1.6, textW, textH*1.6)
408 canvas.SetLineWidth(3)
409 canvas.SetRGBA255(0, 0, 0, 255)
410 canvas.Stroke()
411 if err = canvas.ParseFontFace(fontdata, 50); err != nil {
412 return nil, err
413 }
414 canvas.DrawStringAnchored("背包没有存放任何东西", 500, 10+textH*2+50, 0.5, 0)
415 return canvas.Image(), nil
416}
417func drawArticleInfoBlock(uid int64, articles []article, fontdata []byte) (image.Image, error) {
418 canvas := gg.NewContext(1, 1)
419 err := canvas.ParseFontFace(fontdata, 100)

Callers 1

drawPackImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected