Documentation ¶
Index ¶
- Constants
- Variables
- type Engine
- type FloatPoint
- type FloatingRect
- type Image
- type ImageInfo
- type Rect
- type Sizing
- func (sz *Sizing) CalcCropBox(srcSize *Rect) (cropBox *Rect, cropOrigin *image.Point, err error)
- func (sz *Sizing) CalcResizeRect(srcSize *Rect) (resizedRect *Rect, cropRect *Rect, cropOrigin *image.Point)
- func (sz *Sizing) GranularizedHeight() int
- func (sz *Sizing) GranularizedSize() *Rect
- func (sz *Sizing) GranularizedWidth() int
- func (sz *Sizing) SetFromQuery(q string) error
- func (sz *Sizing) ToQuery() url.Values
Constants ¶
View Source
const (
VERSION = "1.1.0"
)
Variables ¶
View Source
var ( ZeroSizing = &Sizing{} DefaultSizingGranularity = 10 )
View Source
var ( ZeroRect = &Rect{} ZeroFloatingRect = &FloatingRect{&FloatPoint{}, &FloatPoint{}} ZeroFloatPoint = &FloatPoint{} )
View Source
var (
ErrInvalidImageData = errors.New("invalid image data")
)
Functions ¶
This section is empty.
Types ¶
type FloatPoint ¶
type FloatPoint struct {
X, Y float64
}
func NewFloatPoint ¶
func NewFloatPoint(x, y float64) *FloatPoint
func NewFloatPointFromQuery ¶
func NewFloatPointFromQuery(q string) (*FloatPoint, error)
func (*FloatPoint) Equal ¶
func (f *FloatPoint) Equal(other *FloatPoint) bool
Returns whether the two FloatPoints have equal values
func (*FloatPoint) ToString ¶
func (f *FloatPoint) ToString() string
Returns a comma delimited string representing the point (ie. "0.1,0.2" or "100,150")
type FloatingRect ¶
type FloatingRect struct {
Min, Max *FloatPoint // can be whole or percentages
}
func NewFloatingRect ¶
func NewFloatingRect(x0, y0, x1, y2 float64) *FloatingRect
func NewFloatingRectFromQuery ¶
func NewFloatingRectFromQuery(q string) (*FloatingRect, error)
func (*FloatingRect) Equal ¶
func (f *FloatingRect) Equal(other *FloatingRect) bool
func (*FloatingRect) ToString ¶
func (f *FloatingRect) ToString() string
type Rect ¶
type Rect struct {
Width, Height int
}
func NewRectFromQuery ¶
func (*Rect) AspectRatio ¶
type Sizing ¶
type Sizing struct { Size *Rect // The asking image size CropBox *FloatingRect // The asking image crop box (as percentages) FocalPoint *FloatPoint // The asking image focal point (as percentages) Canvas *Rect Op string Format string Quality int Granularity int Flatten bool }
func NewSizingFromQuery ¶
func (*Sizing) CalcCropBox ¶
func (*Sizing) CalcResizeRect ¶
func (*Sizing) GranularizedHeight ¶
Returns the granularized asking height
func (*Sizing) GranularizedSize ¶
func (*Sizing) GranularizedWidth ¶
Returns the granularized width
func (*Sizing) SetFromQuery ¶
Click to show internal directories.
Click to hide internal directories.