Documentation ¶
Overview ¶
Package image contains functions for rotations of points in a 2-dimensional space.
Index ¶
- Constants
- Variables
- func ExampleRotate(data []uint8, w int, h int, angle Angle) []uint8
- func Invert180(x, y, _, h int) (int, int)
- func Resize(scaleType int, src *image.RGBA, out *image.RGBA)
- func Rotate0(x, y, _, _ int) (int, int)
- func Rotate180(x, y, w, h int) (int, int)
- func Rotate270(x, y, _, h int) (int, int)
- func Rotate90(x, y, w, _ int) (int, int)
- type Angle
- type Canvas
- type Frame
- type Rotate
Constants ¶
View Source
const ( BitFormatShort5551 = iota // BIT_FORMAT_SHORT_5_5_5_1 has 5 bits R, 5 bits G, 5 bits B, 1 bit alpha BitFormatInt8888Rev // BIT_FORMAT_INT_8_8_8_8_REV has 8 bits R, 8 bits G, 8 bits B, 8 bit alpha BitFormatShort565 // BIT_FORMAT_SHORT_5_6_5 has 5 bits R, 6 bits G, 5 bits )
View Source
const ( ScaleNot = iota // skips image interpolation ScaleNearestNeighbour // nearest neighbour interpolation ScaleBilinear // bilinear interpolation )
Variables ¶
View Source
var Angles = [5]Rotate{ Angle0: {Angle: Angle0, Call: Rotate0}, Angle90: {Angle: Angle90, Call: Rotate90, IsEven: true}, Angle180: {Angle: Angle180, Call: Rotate180}, Angle270: {Angle: Angle270, Call: Rotate270, IsEven: true}, Flip180: {Angle: Flip180, Call: Invert180}, }
Angles is a helper to choose appropriate rotation based on its angle.
Functions ¶
func ExampleRotate ¶
ExampleRotate is an example of rotation usage.
[1 2 3 4 5 6 7 8 9] [7 4 1 8 5 2 9 6 3]
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas is a stateful drawing surface, i.e. image.RGBA
type Rotate ¶
Rotate is an interface for rotation of a given point.
With the coordinates x, y in the matrix of w x h. Returns a pair of new coordinates x, y in the resulting matrix. Be aware that w / h values are 0 index-based, and it's meant to be used with h corresponded to matrix height and y coordinate, and with w to x coordinate.
func GetRotation ¶
Click to show internal directories.
Click to hide internal directories.