# File lib/numru/nusdas.rb, line 1466
    def slice(str, x, nx, y, ny, size, byte)
      x = true if x==0 && nx==size[0]
      y = true if y==0 && ny==size[1]
      return str if x == true && y == true

      y = 0 if y == true

      if x == true
        if Array === y
          newstr = ""
          for j in y
            j0 = j*size[0]*byte
            newstr << str[j0, size[0]*byte]
          end
          return newstr
        else
          j0 = y*size[0]*byte
          return str[j0, size[0]*ny*byte]
        end
      else
        if y === true
          y = 0...size[1]
        elsif !(Array === y)
          y = y...(y+ny)
        end
        newstr = ""
        if Array === x
          for j in y
            i0 = j*size[0]*byte
            x.each{|i| newstr << str[i0+i*byte,byte] }
          end
          return newstr
        else
          for j in y
            i0 = (j*size[0] + x)*byte
            newstr << str[i0,nx*byte]
          end
          return newstr
        end
      end
    end