mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-24 15:52:38 +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) {
|
||||
if p.right {
|
||||
dstBounds = image.Rectangle{
|
||||
Min: image.Point{srcBounds.Max.X / 2, srcBounds.Min.Y},
|
||||
Max: srcBounds.Max,
|
||||
}
|
||||
dstBounds = image.Rect(
|
||||
srcBounds.Max.X/2, srcBounds.Min.Y,
|
||||
srcBounds.Max.X, srcBounds.Max.Y,
|
||||
)
|
||||
} else {
|
||||
dstBounds = image.Rectangle{
|
||||
Min: srcBounds.Min,
|
||||
Max: image.Point{srcBounds.Max.X / 2, srcBounds.Max.Y},
|
||||
}
|
||||
dstBounds = image.Rect(
|
||||
srcBounds.Min.X, srcBounds.Min.Y,
|
||||
srcBounds.Max.X/2, srcBounds.Max.Y,
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -145,10 +145,7 @@ func LoadImages(path string, options *ImageOptions) ([]*Image, error) {
|
||||
// Convert image
|
||||
dst := image.NewPaletted(g.Bounds(src.Bounds()), options.Palette)
|
||||
if dst.Bounds().Dx() == 0 || dst.Bounds().Dy() == 0 {
|
||||
dst = image.NewPaletted(image.Rectangle{
|
||||
Min: image.Point{0, 0},
|
||||
Max: image.Point{1, 1},
|
||||
}, dst.Palette)
|
||||
dst = image.NewPaletted(image.Rect(0, 0, 1, 1), dst.Palette)
|
||||
dst.Set(0, 0, color.White)
|
||||
} else {
|
||||
g.Draw(dst, src)
|
||||
|
Loading…
x
Reference in New Issue
Block a user