Skip to content

Commit

Permalink
Rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Apr 11, 2021
1 parent 3a211f6 commit 38d8f20
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions internal/libwebp/a__encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import (
"io"
"unsafe"

"github.com/bep/gowebp/libwebp/options"
"github.com/bep/gowebp/libwebp/webpoptions"
)

type (
Expand All @@ -105,7 +105,7 @@ type (
//
// TODO(bep) Can we handle *image.YCbCr without conversion?
// TODO(bep) check filled alpha channel.
func Encode(w io.Writer, src image.Image, o options.EncodingOptions) error {
func Encode(w io.Writer, src image.Image, o webpoptions.EncodingOptions) error {
config, err := encodingOptionsToCConfig(o)
if err != nil {
return err
Expand Down Expand Up @@ -175,7 +175,7 @@ func ConvertToNRGBA(src image.Image) *image.NRGBA {
return dst
}

func encodingOptionsToCConfig(o options.EncodingOptions) (*C.WebPConfig, error) {
func encodingOptionsToCConfig(o webpoptions.EncodingOptions) (*C.WebPConfig, error) {
cfg := &C.WebPConfig{}
quality := C.float(o.Quality)

Expand Down
4 changes: 2 additions & 2 deletions libwebp/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"image"
"io"

"github.com/bep/gowebp/libwebp/options"
"github.com/bep/gowebp/libwebp/webpoptions"

"github.com/bep/gowebp/internal/libwebp"
)

// Encode encodes src as Webp into w using the options in o.
func Encode(w io.Writer, src image.Image, o options.EncodingOptions) error {
func Encode(w io.Writer, src image.Image, o webpoptions.EncodingOptions) error {
return libwebp.Encode(w, src, o)
}
10 changes: 5 additions & 5 deletions libwebp/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ import (

"github.com/bep/gowebp/internal/libwebp"

"github.com/bep/gowebp/libwebp/options"
"github.com/bep/gowebp/libwebp/webpoptions"
"golang.org/x/image/webp"
)

type testCase struct {
name string
inputFile string
opts options.EncodingOptions
opts webpoptions.EncodingOptions
}

var testCases = []testCase{
{"lossy", "source.jpg", options.EncodingOptions{Quality: 75, EncodingPreset: options.EncodingPresetPhoto, UseSharpYuv: true}},
{"lossless", "source.jpg", options.EncodingOptions{}},
{"bw", "bw-gopher.png", options.EncodingOptions{Quality: 75}},
{"lossy", "source.jpg", webpoptions.EncodingOptions{Quality: 75, EncodingPreset: webpoptions.EncodingPresetPhoto, UseSharpYuv: true}},
{"lossless", "source.jpg", webpoptions.EncodingOptions{}},
{"bw", "bw-gopher.png", webpoptions.EncodingOptions{Quality: 75}},
}

func TestEncode(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package options
package webpoptions

const (
EncodingPresetDefault EncodingPreset = iota
Expand Down

0 comments on commit 38d8f20

Please sign in to comment.