mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 16:22:37 +02:00
Compare commits
1 Commits
418d51662c
...
ef27485273
Author | SHA1 | Date | |
---|---|---|---|
ef27485273 |
@ -31,9 +31,10 @@ func (p *positionFilter) Draw(dst draw.Image, src image.Image, options *gift.Opt
|
|||||||
draw.Draw(dst, dst.Bounds(), image.White, dst.Bounds().Min, draw.Over)
|
draw.Draw(dst, dst.Bounds(), image.White, dst.Bounds().Min, draw.Over)
|
||||||
|
|
||||||
srcBounds := src.Bounds()
|
srcBounds := src.Bounds()
|
||||||
left, top := (p.viewWidth-srcBounds.Dx())/2, (p.viewHeight-srcBounds.Dy())/2
|
left, top := 0, (p.viewHeight-srcBounds.Dy())/2
|
||||||
if p.align == PositionLeft {
|
|
||||||
left = 0
|
if p.align == PositionCenter {
|
||||||
|
left = (p.viewWidth - srcBounds.Dx()) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.align == PositionRight {
|
if p.align == PositionRight {
|
||||||
|
@ -20,8 +20,8 @@ func NewGift(options *ImageOptions) *gift.GIFT {
|
|||||||
}
|
}
|
||||||
g.Add(
|
g.Add(
|
||||||
filters.Resize(options.ViewWidth, options.ViewHeight, gift.LanczosResampling),
|
filters.Resize(options.ViewWidth, options.ViewHeight, gift.LanczosResampling),
|
||||||
filters.Pixel(),
|
|
||||||
filters.Position(options.ViewWidth, options.ViewHeight, filters.PositionCenter),
|
filters.Position(options.ViewWidth, options.ViewHeight, filters.PositionCenter),
|
||||||
|
filters.Pixel(),
|
||||||
)
|
)
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
func NewBar(max int, description string, currentJob, totalJob int) *progressbar.ProgressBar {
|
func NewBar(max int, description string, currentJob, totalJob int) *progressbar.ProgressBar {
|
||||||
fmtJob := fmt.Sprintf("%%0%dd", len(fmt.Sprint(totalJob)))
|
fmtJob := fmt.Sprintf("%%0%dd", len(fmt.Sprint(totalJob)))
|
||||||
fmtDesc := fmt.Sprintf("[%s/%s] %%-15s", fmtJob, fmtJob)
|
fmtDesc := fmt.Sprintf("[%s/%s] %%-15s", fmtJob, fmtJob)
|
||||||
|
return progressbar.DefaultBytesSilent(int64(max))
|
||||||
return progressbar.NewOptions(max,
|
return progressbar.NewOptions(max,
|
||||||
progressbar.OptionSetWriter(os.Stderr),
|
progressbar.OptionSetWriter(os.Stderr),
|
||||||
progressbar.OptionOnCompletion(func() {
|
progressbar.OptionOnCompletion(func() {
|
||||||
|
@ -44,9 +44,14 @@ func (e *ePub) getToc(title string, images []*Image) string {
|
|||||||
if len(ol.ChildElements()) == 1 && e.StripFirstDirectoryFromToc {
|
if len(ol.ChildElements()) == 1 && e.StripFirstDirectoryFromToc {
|
||||||
ol = ol.ChildElements()[0]
|
ol = ol.ChildElements()[0]
|
||||||
}
|
}
|
||||||
if len(ol.ChildElements()) > 0 {
|
|
||||||
nav.AddChild(ol)
|
beginning := etree.NewElement("li")
|
||||||
}
|
beginningLink := beginning.CreateElement("a")
|
||||||
|
beginningLink.CreateAttr("href", images[0].TextPath())
|
||||||
|
beginningLink.CreateText("Start of the book")
|
||||||
|
ol.InsertChildAt(0, beginning)
|
||||||
|
|
||||||
|
nav.AddChild(ol)
|
||||||
|
|
||||||
doc.Indent(2)
|
doc.Indent(2)
|
||||||
r, _ := doc.WriteToString()
|
r, _ := doc.WriteToString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user