You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
557 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. package main
  2. import (
  3. log "github.com/sirupsen/logrus"
  4. )
  5. func getPart(pixelmatrix [][][4]uint32, partCount, partTotal, partBegin int) ([][][4]uint32, int, int) {
  6. xLength := len(pixelmatrix)
  7. if xLength < partTotal {
  8. log.Fatal("more parts then rows not possible")
  9. return nil, 0, 0
  10. }
  11. partStep := (xLength / partTotal)
  12. start := partBegin * partStep
  13. // last part should return last rows
  14. if partBegin + partCount == partTotal {
  15. return pixelmatrix[start: ], start, 0
  16. }
  17. return pixelmatrix[ start : (partBegin + partCount) * partStep], start, 0
  18. }