5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-14 06:10:27 +00:00
matterbridge/vendor/github.com/Benau/tgsconverter/libtgsconverter/png.go
Benau 53cafa9f3d
Convert .tgs with go libraries (and cgo) (telegram) (#1569)
This commit adds support for go/cgo tgs conversion when building with the -tags `cgo`
The default binaries are still "pure" go and uses the old way of converting.

* Move lottie_convert.py conversion code to its own file

* Add optional libtgsconverter

* Update vendor

* Apply suggestions from code review

* Update bridge/helper/libtgsconverter.go

Co-authored-by: Wim <wim@42.be>
2021-08-24 22:32:50 +02:00

31 lines
528 B
Go

package libtgsconverter
import "bytes"
import "image"
import "image/png"
type topng struct {
result []byte
}
func(to_png *topng) init(w uint, h uint, options ConverterOptions) {
}
func(to_png *topng) SupportsAnimation() bool {
return false
}
func (to_png *topng) AddFrame(image *image.RGBA, fps uint) error {
var data []byte
w := bytes.NewBuffer(data)
if err := png.Encode(w, image); err != nil {
return err
}
to_png.result = w.Bytes()
return nil
}
func (to_png *topng) Result() []byte {
return to_png.result
}