当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 14

MicroOS / pic2ascii
暂停

forked from wzshiming / pic2ascii
暂停
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
reset.go 550 Bytes
一键复制 编辑 Web IDE 原始数据 按行查看 历史
wzshiming 提交于 2018-01-24 18:19 . add reset 0
package pic2ascii
import (
"image"
"image/color"
)
type Reset struct {
image.Image
ox, oy int
dx, dy int
}
// Reset image
func NewReset(img image.Image) image.Image {
rect := img.Bounds()
ox := rect.Min.X
oy := rect.Min.Y
if ox == 0 && oy == 0 {
return img
}
dx := rect.Dx()
dy := rect.Dy()
return Reset{img, ox, oy, dx, dy}
}
func (c Reset) Bounds() image.Rectangle {
return image.Rectangle{
image.Point{0, 0},
image.Point{c.dx, c.dy},
}
}
func (c Reset) At(x, y int) color.Color {
return c.Image.At(x+c.ox, y+c.oy)
}
Go
1
https://gitee.com/MicroOS/pic2ascii.git
git@gitee.com:MicroOS/pic2ascii.git
MicroOS
pic2ascii
pic2ascii
master

搜索帮助