anthonynsimon / bild

Image processing algorithms in pure Go
MIT License
4.02k stars 214 forks source link

some of the function comment docs are out-of-date or incorrect #80

Closed rcoreilly closed 4 years ago

rcoreilly commented 4 years ago

Here's a few I noticed.

imgio/io.go:

// Open loads and decodes an image from a file and returns it.
//
// Usage example:
//      // Encode an image to a writer in PNG format,
//      // returns an error if something went wrong
//      img, err := Open("exampleName")
func Open(filename string) (image.Image, error) {

that comment describes Save, not Open..

transform/resize.go:

// Resize returns a new image with its size adjusted to the new width and height. The filter
// param corresponds to the Resampling Filter to be used when interpolating between the sample points.
//
//
// Usage example:
//
//      result := bild.Resize(img, 800, 600, bild.Linear)
//
func Resize(img image.Image, width, height int, filter ResampleFilter) *image.RGBA {

usage should be s/bild/transform/g

transform/rotate.go:

// Rotate returns a rotated image by the provided angle using the pivot as an anchor.
// Parameters angle is in degrees and it's applied clockwise.
// Default parameters are used if a nil *RotationOptions is passed.
//
// Usage example:
//
//      // Rotate 90.0 degrees clockwise, preserving the image size and the pivot point at the top left corner
//      result := bild.Rotate(img, 90.0, &bild.RotationOptions{PreserveSize: true, Pivot: &image.Point{0, 0}})
//
func Rotate(img image.Image, angle float64, options *RotationOptions) *image.RGBA {

same as above, and options now is ResizeBounds not PreserveSize