21 lines
520 B
Go
21 lines
520 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
log "github.com/sirupsen/logrus"
|
||
|
)
|
||
|
|
||
|
func getPart(pixelmatrix [][][4]uint32, partCount, partTotal, partBegin int) [][][4]uint32 {
|
||
|
xLength := len(pixelmatrix)
|
||
|
if xLength < partTotal {
|
||
|
log.Fatal("more parts then rows not possible")
|
||
|
return nil
|
||
|
}
|
||
|
partSize := (xLength / partTotal)
|
||
|
|
||
|
// last part should return last rows
|
||
|
if partBegin + partCount == partTotal {
|
||
|
return pixelmatrix[ partBegin * partSize : ]
|
||
|
}
|
||
|
return pixelmatrix[ partBegin * partSize : (partBegin + partCount) * partSize]
|
||
|
}
|