mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-08 09:04:04 +00:00
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>
This commit is contained in:
30
vendor/github.com/Benau/tgsconverter/libtgsconverter/png.go
generated
vendored
Normal file
30
vendor/github.com/Benau/tgsconverter/libtgsconverter/png.go
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user