mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 00:02:37 +02:00
use helper
This commit is contained in:
parent
7adea5ddbd
commit
6c904ad70b
@ -17,15 +17,15 @@ type cropSplitDoublePage struct {
|
|||||||
|
|
||||||
func (p *cropSplitDoublePage) Bounds(srcBounds image.Rectangle) (dstBounds image.Rectangle) {
|
func (p *cropSplitDoublePage) Bounds(srcBounds image.Rectangle) (dstBounds image.Rectangle) {
|
||||||
if p.right {
|
if p.right {
|
||||||
dstBounds = image.Rectangle{
|
dstBounds = image.Rect(
|
||||||
Min: image.Point{srcBounds.Max.X / 2, srcBounds.Min.Y},
|
srcBounds.Max.X/2, srcBounds.Min.Y,
|
||||||
Max: srcBounds.Max,
|
srcBounds.Max.X, srcBounds.Max.Y,
|
||||||
}
|
)
|
||||||
} else {
|
} else {
|
||||||
dstBounds = image.Rectangle{
|
dstBounds = image.Rect(
|
||||||
Min: srcBounds.Min,
|
srcBounds.Min.X, srcBounds.Min.Y,
|
||||||
Max: image.Point{srcBounds.Max.X / 2, srcBounds.Max.Y},
|
srcBounds.Max.X/2, srcBounds.Max.Y,
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -145,10 +145,7 @@ func LoadImages(path string, options *ImageOptions) ([]*Image, error) {
|
|||||||
// Convert image
|
// Convert image
|
||||||
dst := image.NewPaletted(g.Bounds(src.Bounds()), options.Palette)
|
dst := image.NewPaletted(g.Bounds(src.Bounds()), options.Palette)
|
||||||
if dst.Bounds().Dx() == 0 || dst.Bounds().Dy() == 0 {
|
if dst.Bounds().Dx() == 0 || dst.Bounds().Dy() == 0 {
|
||||||
dst = image.NewPaletted(image.Rectangle{
|
dst = image.NewPaletted(image.Rect(0, 0, 1, 1), dst.Palette)
|
||||||
Min: image.Point{0, 0},
|
|
||||||
Max: image.Point{1, 1},
|
|
||||||
}, dst.Palette)
|
|
||||||
dst.Set(0, 0, color.White)
|
dst.Set(0, 0, color.White)
|
||||||
} else {
|
} else {
|
||||||
g.Draw(dst, src)
|
g.Draw(dst, src)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user