remove unecessary folder
This commit is contained in:
parent
17aa105606
commit
5908f1da11
4 changed files with 0 additions and 64 deletions
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
BIN
issue23/go.png
BIN
issue23/go.png
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB |
|
@ -1,64 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"image"
|
|
||||||
"image/draw"
|
|
||||||
"image/png"
|
|
||||||
"log"
|
|
||||||
"math"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/llgcode/draw2d"
|
|
||||||
)
|
|
||||||
|
|
||||||
func saveToPngFile(filePath string, m image.Image) {
|
|
||||||
f, err := os.Create(filePath)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
b := bufio.NewWriter(f)
|
|
||||||
err = png.Encode(b, m)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
err = b.Flush()
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
fmt.Printf("Wrote %s OK.\n", filePath)
|
|
||||||
}
|
|
||||||
func main() {
|
|
||||||
file, err := os.Open("android.png")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
a, _, err := image.Decode(file)
|
|
||||||
|
|
||||||
//load go icon image
|
|
||||||
file2, err := os.Open("go.png")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer file2.Close()
|
|
||||||
g, _, err := image.Decode(file2)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ar := a.Bounds()
|
|
||||||
w, h, x := ar.Dx(), ar.Dy(), 30.0
|
|
||||||
i := image.NewRGBA(image.Rect(0, 0, w, h))
|
|
||||||
draw.Draw(i, ar, a, ar.Min, draw.Src)
|
|
||||||
|
|
||||||
tr := draw2d.NewRotationMatrix(x * (math.Pi / 180.0))
|
|
||||||
draw2d.DrawImage(g, i, tr, draw.Over, draw2d.LinearFilter)
|
|
||||||
saveToPngFile("Test2.png", i)
|
|
||||||
}
|
|
Loading…
Reference in a new issue