CalcParams calculates context image parameters based on the current image size. Some steps (like trim) must call this function when finished.
()
| 267 | // CalcParams calculates context image parameters based on the current image size. |
| 268 | // Some steps (like trim) must call this function when finished. |
| 269 | func (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 | } |
no test coverage detected