Skip to content

Pointer to image.Image interface #3

@diamondburned

Description

@diamondburned

This library has the Encode API take in a pointer to image.Image (*image.Image) instead of either the interface itself (which has an underlying value of a pointer) or a concrete struct such as *image.NRGBA. This is usually a bad idea.

The lines that use this "pointer to interface" seem to only dereference the interface and not change it:

https://github.com/buckket/go-blurhash/blob/master/encode.go#L110-L111

height := (*rgba).Bounds().Max.Y
width := (*rgba).Bounds().Max.X

https://github.com/buckket/go-blurhash/blob/master/encode.go#L131

rt, gt, bt, _ := (*rgba).At(x, y).RGBA()

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions