Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
octu0 committed Mar 31, 2021
1 parent 740e515 commit c5a9e13
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ import (
)

type RotationMode int16
const(
Rotate0 RotationMode = 0 // No rotation
Rotate90 RotationMode = 90 // Rotate 90 degrees clockwise
Rotate180 RotationMode = 180 // Rotate 180 degrees
Rotate270 RotationMode = 270 // Rotate 270 degrees clockwise

const (
Rotate0 RotationMode = 0 // No rotation
Rotate90 RotationMode = 90 // Rotate 90 degrees clockwise
Rotate180 RotationMode = 180 // Rotate 180 degrees
Rotate270 RotationMode = 270 // Rotate 270 degrees clockwise
)

var (
Expand All @@ -56,15 +57,15 @@ var (

func Rotate(img *image.RGBA, mode RotationMode) (*image.RGBA, error) {
width, height := wh(img)
var out *image.RGBA
switch mode {
case Rotate0, Rotate180:
out = GetRGBA(width, height)
case Rotate90, Rotate270:
out = GetRGBA(height, width)
default:
out = GetRGBA(width, height)
}
var out *image.RGBA
switch mode {
case Rotate0, Rotate180:
out = GetRGBA(width, height)
case Rotate90, Rotate270:
out = GetRGBA(height, width)
default:
out = GetRGBA(width, height)
}

ret := C.librotate(
(*C.uchar)(&img.Pix[0]),
Expand Down

0 comments on commit c5a9e13

Please sign in to comment.