Documentation
¶
Overview ¶
Package image provides standalone image decoding helpers that can be adapted into Paper image components.
Index ¶
- Variables
- type Image
- func LoadGIF(path string) (*Image, error)
- func LoadJPEG(path string) (*Image, error)
- func LoadPNG(path string) (*Image, error)
- func LoadTIFF(path string) (*Image, error)
- func LoadWebP(path string) (*Image, error)
- func NewGIF(data []byte) (*Image, error)
- func NewJPEG(data []byte) (*Image, error)
- func NewPNG(data []byte) (*Image, error)
- func NewTIFF(data []byte) (*Image, error)
- func NewWebP(data []byte) (*Image, error)
- func (img *Image) AutoRow(rectProps ...props.Rect) core.Row
- func (img *Image) Bytes() []byte
- func (img *Image) Col(size int, rectProps ...props.Rect) core.Col
- func (img *Image) Component(rectProps ...props.Rect) core.Component
- func (img *Image) Dimensions() *entity.Dimensions
- func (img *Image) Extension() extension.Type
- func (img *Image) Height() int
- func (img *Image) Row(height float64, rectProps ...props.Rect) core.Row
- func (img *Image) Width() int
Constants ¶
This section is empty.
Variables ¶
var ( ErrCannotReadFile = errors.New("image: cannot read file") ErrInvalidImage = errors.New("image: invalid image") ErrInvalidDimensions = errors.New("image: invalid dimensions") ErrUnexpectedImageType = errors.New("image: unexpected image type") ErrUnsupportedExtension = errors.New("image: unsupported extension") )
Errors reported when an image cannot be loaded or does not match the extension it was loaded as.
Functions ¶
This section is empty.
Types ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image is a decoded image together with its format and pixel size. Use the Component, Col, Row, and AutoRow methods to place it in a document.
func NewJPEG ¶
NewJPEG decodes JPEG data. It returns an error if the bytes are not a valid JPEG image.
func NewTIFF ¶
NewTIFF decodes TIFF data. It returns an error if the bytes are not a valid TIFF image.
func NewWebP ¶
NewWebP decodes WebP data. It returns an error if the bytes are not a valid WebP image.
func (*Image) Dimensions ¶
func (img *Image) Dimensions() *entity.Dimensions
Dimensions returns the pixel width and height as an entity.Dimensions.