Documentation ¶
Index ¶
- func Decode(r io.Reader) (image.Image, error)
- func DecodeAll(r io.Reader) (images []image.Image, err error)
- type Encoder
- type ErrImageTooSmall
- type IcnsHelper
- func (instance *IcnsHelper) Create(inputPath, outputPath string, optResizeAlgorithm int) (err error)
- func (instance *IcnsHelper) CreateBicubic(inputPath, outputPath string) (err error)
- func (instance *IcnsHelper) CreateBilinear(inputPath, outputPath string) (err error)
- func (instance *IcnsHelper) CreateLanczos2(inputPath, outputPath string) (err error)
- func (instance *IcnsHelper) CreateLanczos3(inputPath, outputPath string) (err error)
- func (instance *IcnsHelper) CreateMitchellNetravali(inputPath, outputPath string) (err error)
- func (instance *IcnsHelper) CreateNearestNeighbor(inputPath, outputPath string) (err error)
- func (instance *IcnsHelper) Encode(wr io.Writer, img image.Image) error
- func (instance *IcnsHelper) NewIconSet(img image.Image, interp InterpolationFunction) (*IconSet, error)
- type Icon
- type IconSet
- type InterpolationFunction
- type OsType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Encoder ¶
type Encoder struct { Wr io.Writer Algorithm InterpolationFunction }
Encoder encodes ICNS files from a source image.
func (*Encoder) WithAlgorithm ¶
func (instance *Encoder) WithAlgorithm(a InterpolationFunction) *Encoder
WithAlgorithm applies the interpolation function used to resize the image.
type ErrImageTooSmall ¶
type ErrImageTooSmall struct {
// contains filtered or unexported fields
}
ErrImageTooSmall is returned when the image is too small to process.
func (ErrImageTooSmall) Error ¶
func (err ErrImageTooSmall) Error() string
type IcnsHelper ¶
type IcnsHelper struct{}
var Icns *IcnsHelper
func (*IcnsHelper) Create ¶
func (instance *IcnsHelper) Create(inputPath, outputPath string, optResizeAlgorithm int) (err error)
func (*IcnsHelper) CreateBicubic ¶
func (instance *IcnsHelper) CreateBicubic(inputPath, outputPath string) (err error)
func (*IcnsHelper) CreateBilinear ¶
func (instance *IcnsHelper) CreateBilinear(inputPath, outputPath string) (err error)
func (*IcnsHelper) CreateLanczos2 ¶
func (instance *IcnsHelper) CreateLanczos2(inputPath, outputPath string) (err error)
func (*IcnsHelper) CreateLanczos3 ¶
func (instance *IcnsHelper) CreateLanczos3(inputPath, outputPath string) (err error)
func (*IcnsHelper) CreateMitchellNetravali ¶
func (instance *IcnsHelper) CreateMitchellNetravali(inputPath, outputPath string) (err error)
func (*IcnsHelper) CreateNearestNeighbor ¶
func (instance *IcnsHelper) CreateNearestNeighbor(inputPath, outputPath string) (err error)
func (*IcnsHelper) Encode ¶
Encode writes img to wr in ICNS format. img is assumed to be a rectangle; non-square dimensions will be squared without preserving the aspect ratio. Use the nearest neighbor as an interpolation algorithm.
func (*IcnsHelper) NewIconSet ¶
func (instance *IcnsHelper) NewIconSet(img image.Image, interp InterpolationFunction) (*IconSet, error)
NewIconSet uses the source image to create an IconSet. If width != height, the image will be resized using the largest side without preserving the aspect ratio.
type IconSet ¶
type IconSet struct { Icons []*Icon // contains filtered or unexported fields }
IconSet encodes a set of icons into an ICNS file.
type InterpolationFunction ¶
type InterpolationFunction = resize.InterpolationFunction
InterpolationFunction is the algorithm used to resize the image.
const ( // NearestNeighbor Nearest-neighbor interpolation NearestNeighbor InterpolationFunction = iota // Bilinear interpolation Bilinear // Bicubic interpolation (with cubic hermite spline) Bicubic // MitchellNetravali Mitchell-Netravali interpolation MitchellNetravali // Lanczos2 Lanczos interpolation (a=2) Lanczos2 // Lanczos3 Lanczos interpolation (a=3) Lanczos3 )
InterpolationFunction constants.