mirror of
https://github.com/talgo-cloud/talgo-libwebp.git
synced 2026-03-07 21:48:16 -08:00
Add RGB encoder
This commit is contained in:
parent
10d006dab5
commit
4ba34829e7
3 changed files with 162 additions and 0 deletions
|
|
@ -118,6 +118,8 @@ func EncodeRGBA(w io.Writer, img image.Image, c Config) (err error) {
|
|||
pic.writer = C.WebPWriterFunction(C.writeWebP)
|
||||
|
||||
switch p := img.(type) {
|
||||
case *RGBImage:
|
||||
C.WebPPictureImportRGB(pic, (*C.uint8_t)(&p.Pix[0]), C.int(p.Stride))
|
||||
case *image.RGBA:
|
||||
C.WebPPictureImportRGBA(pic, (*C.uint8_t)(&p.Pix[0]), C.int(p.Stride))
|
||||
case *image.NRGBA:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue