text overlay x & y pos as params
This commit is contained in:
@@ -48,7 +48,7 @@ func LoadFace(path string, size float64) (font.Face, error) {
|
||||
// NewTextOverlay rasterizes text (white, anti-aliased) onto a black backing
|
||||
// box, centered horizontally. Box width and x are multiples of 6 so the box
|
||||
// covers whole v210 blocks and the per-frame copy is word-aligned.
|
||||
func NewTextOverlay(text string, frameW, frameH int, face font.Face) (*TextOverlay, error) {
|
||||
func NewTextOverlay(text string, frameW, frameH, posX, posY int, face font.Face) (*TextOverlay, error) {
|
||||
if text == "" {
|
||||
return nil, fmt.Errorf("text: empty string")
|
||||
}
|
||||
@@ -89,10 +89,12 @@ func NewTextOverlay(text string, frameW, frameH int, face font.Face) (*TextOverl
|
||||
return nil, fmt.Errorf("text: box %dpx does not fit frame height %dpx", topMargin+h, frameH)
|
||||
}
|
||||
|
||||
// posX = ((frameW - w) / 2 / 6) * 6
|
||||
// posY = topMargin
|
||||
o := &TextOverlay{
|
||||
frameW: frameW,
|
||||
x: ((frameW - w) / 2 / 6) * 6,
|
||||
y: topMargin,
|
||||
x: posX,
|
||||
y: posY,
|
||||
w: w,
|
||||
h: h,
|
||||
cov: make([]byte, w*h),
|
||||
|
||||
Reference in New Issue
Block a user