🔥 🎨 优化代码结构

This commit is contained in:
fumiama
2022-02-08 19:39:19 +08:00
parent 3df0414621
commit 806b77acce
29 changed files with 82 additions and 81 deletions

View File

@@ -4,6 +4,7 @@ import (
"image"
"github.com/FloatTech/zbputils/img"
"github.com/FloatTech/zbputils/img/writer"
)
// 摸
@@ -18,7 +19,7 @@ func (cc *context) mo() string {
img.LoadFirstFrame(*<-(*c)[3], 0, 0).InsertBottom(tou, 85, 75, 27, 37).Im,
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertBottom(tou, 90, 70, 22, 42).Im,
}
_ = img.SaveGif(img.MergeGif(1, mo), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(1, mo))
return "file:///" + name
}
@@ -38,7 +39,7 @@ func (cc *context) cuo() string {
img.LoadFirstFrame(*<-(*c)[3], 0, 0).InsertBottomC(m3.Im, 0, 0, 75, 130).Im,
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertBottomC(m4.Im, 0, 0, 75, 130).Im,
}
_ = img.SaveGif(img.MergeGif(5, cuo), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(5, cuo))
return "file:///" + name
}
@@ -51,7 +52,7 @@ func (cc *context) qiao() string {
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 40, 33, 57, 52).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 38, 36, 58, 50).Im,
}
_ = img.SaveGif(img.MergeGif(1, qiao), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(1, qiao))
return "file:///" + name
}
@@ -65,7 +66,7 @@ func (cc *context) chi() string {
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertBottom(tou, 0, 0, 1, 38).Im,
img.LoadFirstFrame(*<-(*c)[2], 0, 0).InsertBottom(tou, 0, 0, 1, 38).Im,
}
_ = img.SaveGif(img.MergeGif(1, chi), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(1, chi))
return "file:///" + name
}
@@ -83,7 +84,7 @@ func (cc *context) ceng() string {
img.LoadFirstFrame(*<-(*c)[4], 0, 0).InsertUp(tou, 75, 77, 56, 110).InsertUp(img.Rotate(tou2, -66, 132, 80).Im, 0, 0, 78, 40).Im,
img.LoadFirstFrame(*<-(*c)[5], 0, 0).InsertUp(tou, 75, 77, 62, 102).InsertUp(tou2, 71, 100, 110, 94).Im,
}
_ = img.SaveGif(img.MergeGif(8, ceng), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(8, ceng))
return "file:///" + name
}
@@ -110,7 +111,7 @@ func (cc *context) ken() string {
img.LoadFirstFrame(*<-(*c)[14], 0, 0).Im,
img.LoadFirstFrame(*<-(*c)[15], 0, 0).Im,
}
_ = img.SaveGif(img.MergeGif(7, ken), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(7, ken))
return "file:///" + name
}
@@ -123,7 +124,7 @@ func (cc *context) pai() string {
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 0, 0, 1, 47).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 0, 0, 1, 67).Im,
}
_ = img.SaveGif(img.MergeGif(1, pai), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(1, pai))
return "file:///" + name
}
@@ -136,7 +137,7 @@ func (cc *context) chong() string {
img.LoadFirstFrame(*<-(*c)[0], 0, 0).InsertUp(tou, 30, 30, 15, 53).Im,
img.LoadFirstFrame(*<-(*c)[1], 0, 0).InsertUp(tou, 30, 30, 40, 53).Im,
}
_ = img.SaveGif(img.MergeGif(1, chong), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(1, chong))
return "file:///" + name
}
@@ -155,6 +156,6 @@ func (cc *context) diu() string {
img.LoadFirstFrame(*<-(*c)[6], 0, 0).InsertUp(tou, 35, 35, 259, 31).Im,
img.LoadFirstFrame(*<-(*c)[7], 0, 0).InsertUp(tou, 175, 175, -50, 220).Im,
}
_ = img.SaveGif(img.MergeGif(7, diu), name)
_ = writer.SaveGIF2Path(name, img.MergeGif(7, diu))
return "file:///" + name
}

View File

@@ -6,6 +6,7 @@ import (
"strconv"
"github.com/FloatTech/zbputils/img"
"github.com/FloatTech/zbputils/img/writer"
)
// 爬
@@ -16,7 +17,7 @@ func (cc *context) pa() string {
rand := rand.Intn(60) + 1
dc := img.LoadFirstFrame(dlblock(`pa/`+strconv.Itoa(rand)+`.png`), 0, 0).
InsertBottom(tou, 100, 100, 0, 400).Im
_ = img.SavePng(dc, name)
_ = writer.SavePNG2Path(name, dc)
return "file:///" + name
}
@@ -29,7 +30,7 @@ func (cc *context) si() string {
dc := img.LoadFirstFrame(dlblock(`si/0.png`), 0, 0).
InsertBottom(im1.Im, im1.W, im1.H, -3, 370).
InsertBottom(im2.Im, im2.W, im2.H, 653, 310).Im
_ = img.SavePng(dc, name)
_ = writer.SavePNG2Path(name, dc)
return "file:///" + name
}
@@ -64,6 +65,6 @@ func (cc *context) other(value ...string) string {
a = img.Size(im.Im, w, h).Im
}
_ = img.SavePng(a, name)
_ = writer.SavePNG2Path(name, a)
return "file:///" + name
}