Additional Padding for Cover art to fit correctly

As specified in #2 the image gets out of the preview box, the previous
commit solves the problem but the image placement in the box differs
from terminal to terminal it might need some extra padding so user can
define some extra padding in the render.go
This commit is contained in:
aditya-K2
2021-10-29 10:14:57 +05:30
parent 97b2e4c4bc
commit 93e6885ae9
2 changed files with 16 additions and 25 deletions

View File

@@ -13,6 +13,9 @@ type Renderer struct {
c chan string
}
var ADDITIONAL_PADDING_X int = 16
var ADDITIONAL_PADDING_Y int = 24
/*
Returns a new Renderer with a string channel
*/
@@ -39,10 +42,11 @@ func (self *Renderer) Send(path string) {
*/
func openImage(path string, c chan string) {
fw, fh := getFontWidth()
var im *ueberzug.Image
if path != "stop" {
img2, _ := getImg(getAlbumArt(path))
im, _ = ueberzug.NewImage(img2, (IMG_X*10)+15, (IMG_Y*22)+10)
im, _ = ueberzug.NewImage(img2, int(float32(IMG_X)*fw)+ADDITIONAL_PADDING_X, int(float32(IMG_Y)*fh)+ADDITIONAL_PADDING_Y)
}
d := <-c
if im != nil {