(c *Context, width, height int, gravity *GravityOptions)
| 1 | package processing |
| 2 | |
| 3 | func extendImage(c *Context, width, height int, gravity *GravityOptions) error { |
| 4 | imgWidth := c.Img.Width() |
| 5 | imgHeight := c.Img.Height() |
| 6 | |
| 7 | if width <= imgWidth && height <= imgHeight { |
| 8 | return nil |
| 9 | } |
| 10 | |
| 11 | if width <= 0 { |
| 12 | width = imgWidth |
| 13 | } |
| 14 | if height <= 0 { |
| 15 | height = imgHeight |
| 16 | } |
| 17 | |
| 18 | offX, offY := calcPosition(width, height, imgWidth, imgHeight, gravity, c.DprScale, false) |
| 19 | return c.Img.Embed(width, height, offX, offY) |
| 20 | } |
| 21 | |
| 22 | func (p *Processor) extend(c *Context) error { |
| 23 | if !c.PO.ExtendEnabled() { |
no test coverage detected