pixeldos/part.go

21 lines
520 B
Go
Raw Normal View History

2018-12-30 07:36:29 +01:00
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]
}