Documentation ¶
Index ¶
- Constants
- type GioImg
- type ImageSource
- func (img *ImageSource) ImageOp(size image.Point) (paint.ImageOp, error)
- func (img *ImageSource) Save(out io.Writer, format string, size image.Point) error
- func (img *ImageSource) ScaleByRatio(ratio float32) (image.Image, error)
- func (img *ImageSource) ScaleBySize(size image.Point) (image.Image, error)
- func (img *ImageSource) Size() image.Point
Constants ¶
const (
MaxSize = 60
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GioImg ¶
Avatar is a widget displaying a square image. If radius is specified, the image is cropped with an outer rounded rectangle.
func NewGioImg ¶
func NewGioImg(src *ImageSource) *GioImg
type ImageSource ¶
type ImageSource struct {
// contains filtered or unexported fields
}
ImageSource wraps a local or remote image, and handle things like scaling and converting. Only jpeg and png format for the source image is supported.
func ImageFromFile ¶
func ImageFromFile(src string) (*ImageSource, error)
ImageFromFile load an image from local filesystem or from network.
func ImageFromReader ¶
func ImageFromReader(src []byte) (*ImageSource, error)
ImageFromReader loads an image from a io.Reader. Image bytes buffer can be wrapped using a bytes.Reader to get an ImageSource.
func (*ImageSource) ImageOp ¶
ImageOp scales the src image to make it fit within the constraint specified by size and convert it to Gio ImageOp. If size has zero value of image Point, image is not scaled.
func (*ImageSource) Save ¶
Save scale the image if required, and encode image.Image to PNG/JPEG image, finally write to the provided writer. Format must be value of "jpeg" or "png".
func (*ImageSource) ScaleByRatio ¶
func (img *ImageSource) ScaleByRatio(ratio float32) (image.Image, error)
func (*ImageSource) ScaleBySize ¶
func (*ImageSource) Size ¶
func (img *ImageSource) Size() image.Point