rotate_and_flip.go 384 B

1234567891011121314151617181920212223
  1. package processing
  2. func (p *Processor) rotateAndFlip(c *Context) error {
  3. if c.Angle%360 == 0 && c.PO.Rotate%360 == 0 && !c.Flip {
  4. return nil
  5. }
  6. if err := c.Img.CopyMemory(); err != nil {
  7. return err
  8. }
  9. if err := c.Img.Rotate(c.Angle); err != nil {
  10. return err
  11. }
  12. if c.Flip {
  13. if err := c.Img.Flip(); err != nil {
  14. return err
  15. }
  16. }
  17. return c.Img.Rotate(c.PO.Rotate)
  18. }