MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / CalcParams

Method CalcParams

processing/prepare.go:269–281  ·  view source on GitHub ↗

CalcParams calculates context image parameters based on the current image size. Some steps (like trim) must call this function when finished.

()

Source from the content-addressed store, hash-verified

267// CalcParams calculates context image parameters based on the current image size.
268// Some steps (like trim) must call this function when finished.
269func (c *Context) CalcParams() {
270 c.SrcWidth, c.SrcHeight, c.Angle, c.Flip = ExtractGeometry(c.Img, c.PO.Rotate(), c.PO.AutoRotate())
271
272 c.CropWidth = CalcCropSize(c.SrcWidth, c.PO.CropWidth())
273 c.CropHeight = CalcCropSize(c.SrcHeight, c.PO.CropHeight())
274
275 widthToScale := imath.MinNonZero(c.CropWidth, c.SrcWidth)
276 heightToScale := imath.MinNonZero(c.CropHeight, c.SrcHeight)
277
278 c.calcScale(widthToScale, heightToScale, c.PO)
279 c.calcSizes(widthToScale, heightToScale, c.PO)
280 c.limitScale(widthToScale, heightToScale, c.PO)
281}

Callers 3

trimMethod · 0.80
RunMethod · 0.80
vectorGuardScaleMethod · 0.80

Calls 10

calcScaleMethod · 0.95
calcSizesMethod · 0.95
limitScaleMethod · 0.95
MinNonZeroFunction · 0.92
ExtractGeometryFunction · 0.85
CalcCropSizeFunction · 0.85
AutoRotateMethod · 0.80
CropWidthMethod · 0.80
CropHeightMethod · 0.80
RotateMethod · 0.45

Tested by

no test coverage detected