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

Function drawEquipEmptyBlock

plugin/mcfish/pack.go:262–290  ·  view source on GitHub ↗

绘制装备栏区域

(fontdata []byte)

Source from the content-addressed store, hash-verified

260
261// 绘制装备栏区域
262func drawEquipEmptyBlock(fontdata []byte) (image.Image, error) {
263 canvas := gg.NewContext(1000, 300)
264 // 画底色
265 canvas.DrawRectangle(0, 0, 1000, 300)
266 canvas.SetRGBA255(255, 255, 255, 150)
267 canvas.Fill()
268 // 边框框
269 canvas.DrawRectangle(0, 0, 1000, 300)
270 canvas.SetLineWidth(3)
271 canvas.SetRGBA255(0, 0, 0, 255)
272 canvas.Stroke()
273
274 canvas.SetColor(color.Black)
275 err := canvas.ParseFontFace(fontdata, 100)
276 if err != nil {
277 return nil, err
278 }
279 textW, textH := canvas.MeasureString("装备信息")
280 canvas.DrawString("装备信息", 10, 10+textH)
281 canvas.DrawLine(10, textH*1.2, textW, textH*1.2)
282 canvas.SetLineWidth(3)
283 canvas.SetRGBA255(0, 0, 0, 255)
284 canvas.Stroke()
285 if err = canvas.ParseFontFace(fontdata, 50); err != nil {
286 return nil, err
287 }
288 canvas.DrawString("没有装备任何鱼竿", 50, 10+textH*2+50)
289 return canvas.Image(), nil
290}
291func drawEquipInfoBlock(equipInfo equip, fontdata []byte) (image.Image, error) {
292 canvas := gg.NewContext(1, 1)
293 err := canvas.ParseFontFace(fontdata, 100)

Callers 1

drawPackImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected