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

Function drawStroeEmptyImage

plugin/mcfish/store.go:663–695  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

661}
662
663func drawStroeEmptyImage() (picImage image.Image, err error) {
664 fontdata, err := file.GetLazyData(text.BoldFontFile, control.Md5File, true)
665 if err != nil {
666 return nil, err
667 }
668 canvas := gg.NewContext(1000, 300)
669 // 画底色
670 canvas.DrawRectangle(0, 0, 1000, 300)
671 canvas.SetRGBA255(255, 255, 255, 150)
672 canvas.Fill()
673 // 边框框
674 canvas.DrawRectangle(0, 0, 1000, 300)
675 canvas.SetLineWidth(3)
676 canvas.SetRGBA255(0, 0, 0, 255)
677 canvas.Stroke()
678
679 canvas.SetColor(color.Black)
680 err = canvas.ParseFontFace(fontdata, 100)
681 if err != nil {
682 return nil, err
683 }
684 textW, textH := canvas.MeasureString("价格信息")
685 canvas.DrawString("价格信息", 10, 10+textH*1.2)
686 canvas.DrawLine(10, textH*1.6, textW, textH*1.6)
687 canvas.SetLineWidth(3)
688 canvas.SetRGBA255(0, 0, 0, 255)
689 canvas.Stroke()
690 if err = canvas.ParseFontFace(fontdata, 50); err != nil {
691 return nil, err
692 }
693 canvas.DrawStringAnchored("当前商店并没有上架任何物品", 500, 10+textH*2+50, 0.5, 0)
694 return canvas.Image(), nil
695}
696
697func drawStroeInfoImage(stroeInfo []store) (picImage image.Image, err error) {
698 fontdata, err := file.GetLazyData(text.BoldFontFile, control.Md5File, true)

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected