public function setRegion(int $left, int $top, int $width, int $height) : void
    {
        if ($top < 0 || $left < 0) {
            throw new InvalidArgumentException('Left and top must be non-negative');
        }

        if ($height < 1 || $width < 1) {
            throw new InvalidArgumentException('Width and height must be at least 1');
        }

        $right = $left + $width;
        $bottom = $top + $height;

        if ($bottom > $this->height || $right > $this->width) {
            throw new InvalidArgumentException('The region must fit inside the matrix');
        }

        for ($y = $top; $y < $bottom; ++$y) {
            $offset = $y * $this->rowSize;

            for ($x = $left; $x < $right; ++$x) {
                $index = $offset + ($x >> 5);
                $this->bits[$index] = $this->bits[$index] | (1 << ($x & 0x1f));
            }
        }
    }
public function setRegion(int $left, int $top, int $width, int $height) : void
    {
        if ($top < 0 || $left < 0) {
            throw new InvalidArgumentException('Left and top must be non-negative');
        }

        if ($height < 1 || $width < 1) {
            throw new InvalidArgumentException('Width and height must be at least 1');
        }

        $right = $left + $width;
        $bottom = $top + $height;

        if ($bottom > $this->height || $right > $this->width) {
            throw new InvalidArgumentException('The region must fit inside the matrix');
        }

        for ($y = $top; $y < $bottom; ++$y) {
            $offset = $y * $this->rowSize;

            for ($x = $left; $x < $right; ++$x) {
                $index = $offset + ($x >> 5);
                $this->bits[$index] = $this->bits[$index] | (1 << ($x & 0x1f));
            }
        }
    }
public function setRegion ( int $ left , int $ top , int $ width , int $ height ) : void { if ( $ top < 0 || $ left < 0 ) { throw new InvalidArgumentException ( 'Left and top must be non-negative' ) ; } if ( $ height < 1 || $ width < 1 ) { throw new InvalidArgumentException ( 'Width and height must be at least 1' ) ; } $ right = $ left + $ width ; $ bottom = $ top + $ height ; if ( $ bottom > $ this -> height || $ right > $ this -> width ) { throw new InvalidArgumentException ( 'The region must fit inside the matrix' ) ; } for ( $ y = $ top ; $ y < $ bottom ; ++ $ y ) { $ offset = $ y * $ this -> rowSize ; for ( $ x = $ left ; $ x < $ right ; ++ $ x ) { $ index = $ offset + ( $ x >> 5 ) ; $ this -> bits [ $ index ] = $ this -> bits [ $ index ] | ( 1 << ( $ x & 0x1f ) ) ; } } }
Sets a square region of the bit matrix to true.

@throws InvalidArgumentException if left or top are negative
@throws InvalidArgumentException if width or height are smaller than 1
@throws InvalidArgumentException if region does not fit into the matix
Sets a square region of the bit matrix to true .