删除无用代码,加入RPC调用

This commit is contained in:
2025-03-21 17:00:13 +08:00
parent 903472de6c
commit ded0148ba6
51 changed files with 483 additions and 57881 deletions

View File

@@ -1,6 +1,7 @@
package common
import (
"bytes"
"fmt"
"image"
"image/color"
@@ -50,7 +51,7 @@ func Bpp(BitsPerPixel uint16) (pixel int) {
pixel = 4
default:
glog.Error("非法位图数据")
glog.Error("invalid BitsPerPixel")
}
return
@@ -96,22 +97,15 @@ func DrawOneBitmap(bitmap *Bitmap, name string) {
}
draw.Draw(finalImg, finalImg.Bounds(), m, m.Bounds().Min, draw.Src)
//_, _ = os.ReadFile(fmt.Sprintf("%s.png", name))
outFile, err := os.Create(fmt.Sprintf("%s.png", name))
if err != nil {
glog.Errorf("创建文件失败: %v", err)
}
outFile, _ := os.Create(fmt.Sprintf("%s.png", name))
defer outFile.Close()
// 保存图像为PNG文件
err = png.Encode(outFile, finalImg)
if err != nil {
glog.Errorf("保存文件失败: %v", err)
}
_ = png.Encode(outFile, finalImg)
}
func DrawFullImage(outputName string, bitmapList []*Bitmap) {
func DrawFullImage(outputName string, bitmapList []*Bitmap) []byte {
// 对位图按 DestTop 和 DestLeft 排序
sort.Slice(bitmapList, func(i, j int) bool {
if bitmapList[i].DestTop == bitmapList[j].DestTop {
@@ -157,16 +151,15 @@ func DrawFullImage(outputName string, bitmapList []*Bitmap) {
}
// 创建保存PNG文件
outFile, err := os.Create(fmt.Sprintf("%s.png", outputName))
if err != nil {
glog.Errorf("创建文件失败: %v", err)
}
defer outFile.Close()
//outFile, _ := os.Create(fmt.Sprintf("%s.png", outputName))
//defer outFile.Close()
//_ = png.Encode(outFile, finalImg)
err = png.Encode(outFile, finalImg)
var buff bytes.Buffer
err := png.Encode(&buff, finalImg)
if err != nil {
glog.Errorf("保存文件失败: %v", err)
return nil
}
glog.Info("合并图像完成")
return buff.Bytes()
}