mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-10 12:12:40 +02:00
26 lines
415 B
Go
26 lines
415 B
Go
package processing
|
|
|
|
func (p *Processor) rotateAndFlip(c *Context) error {
|
|
rotateAngle := c.PO.Rotate()
|
|
|
|
if c.Angle%360 == 0 && rotateAngle%360 == 0 && !c.Flip {
|
|
return nil
|
|
}
|
|
|
|
if err := c.Img.CopyMemory(); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := c.Img.Rotate(c.Angle); err != nil {
|
|
return err
|
|
}
|
|
|
|
if c.Flip {
|
|
if err := c.Img.Flip(); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return c.Img.Rotate(rotateAngle)
|
|
}
|