Clip further output to this rect.
329983
def clip_rect(self, x:float, y:float, w:float, h:float) -> None:
        """"""
        pass
330677
public void clip(final long pX0, final long pY0, final long pX1, final long pY1) {
        if (!mPathMode) {
            if (isOnTheSameSideOut(pX0, pY0, pX1, pY1)) {
                return;
            }
        }
        if (isInClipArea(pX0, pY0)) {
            if (isInClipArea(pX1, pY1)) {
                nextVertex(pX0, pY0);
                nextVertex(pX1, pY1);
                return;
            }
            if (intersection(pX0, pY0, pX1, pY1)) {
                nextVertex(pX0, pY0);
                nextVertex(mOptimIntersection.x, mOptimIntersection.y);
                if (mPathMode) {
                    nextVertex(clipX(pX1), clipY(pY1));
                }
                return;
            }
            throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
        }
        if (isInClipArea(pX1, pY1)) {
            if (intersection(pX0, pY0, pX1, pY1)) {
                if (mPathMode) {
                    nextVertex(clipX(pX0), clipY(pY0));
                }
                nextVertex(mOptimIntersection.x, mOptimIntersection.y);
                nextVertex(pX1, pY1);
                return;
            }
            throw new RuntimeException("Cannot find expected mOptimIntersection for " + new RectL(pX0, pY0, pX1, pY1));
        }
        // no point is on the screen
        int count = 0;
        if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMin, mYMax)) { // x mClipMin segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (intersection(pX0, pY0, pX1, pY1, mXMax, mYMin, mXMax, mYMax)) { // x mClipMax segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMin, mXMax, mYMin)) { // y mClipMin segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (intersection(pX0, pY0, pX1, pY1, mXMin, mYMax, mXMax, mYMax)) { // y mClipMax segment
            final PointL point = count ++ == 0 ? mOptimIntersection1 : mOptimIntersection2;
            point.set(mOptimIntersection);
        }
        if (count == 2) {
            final double distance1 = Distance.getSquaredDistanceToPoint(
                    mOptimIntersection1.x, mOptimIntersection1.y, pX0, pY0);
            final double distance2 = Distance.getSquaredDistanceToPoint(
                    mOptimIntersection2.x, mOptimIntersection2.y, pX0, pY0);
            final PointL start = distance1 < distance2 ? mOptimIntersection1 : mOptimIntersection2;
            final PointL end =  distance1 < distance2 ? mOptimIntersection2 : mOptimIntersection1;
            if (mPathMode) {
                nextVertex(clipX(pX0), clipY(pY0));
            }
            nextVertex(start.x, start.y);
            nextVertex(end.x, end.y);
            if (mPathMode) {
                nextVertex(clipX(pX1), clipY(pY1));
            }
            return;
        }
        if (count == 1) {
            if (mPathMode) {
                nextVertex(clipX(pX0), clipY(pY0));
                nextVertex(mOptimIntersection1.x, mOptimIntersection1.y);
                nextVertex(clipX(pX1), clipY(pY1));
            }
            return;
        }
        if (count == 0) {
            if (mPathMode) {
                nextVertex(clipX(pX0), clipY(pY0));
                final int corner = getClosestCorner(pX0, pY0, pX1, pY1);
                nextVertex(cornerX[corner], cornerY[corner]);
                nextVertex(clipX(pX1), clipY(pY1));
            }
            return;
        }
        throw new RuntimeException("Impossible mOptimIntersection count (" + count + ")");
    }
335693
def clip(self, x1, y1, x2, y2):
        

        self.__clip_stack.append(self.__clip_box)
        self.__clip_box = _intersect_box(self.__clip_box, (x1, y1, x2, y2))
        self.gsave()
        self.newpath()
        self.moveto(xscale(x1), yscale(y1))
        self.lineto(xscale(x1), yscale(y2))
        self.lineto(xscale(x2), yscale(y2))
        self.lineto(xscale(x2), yscale(y1))
        self.closepath()
        self.clip_sub()
457926
function clippingRectangle($x1, $y1, $width, $height)
    {
        $this->save();
        $this->addContent(sprintf("\n%.3F %.3F %.3F %.3F re W n", $x1, $y1, $width, $height));
    }
606241
function(other) {
        return (other instanceof $.Rect) &&
            this.x === other.x &&
            this.y === other.y &&
            this.width === other.width &&
            this.height === other.height &&
            this.degrees === other.degrees;
    }
969304
def blend_rect(self, x0, y0, x1, y1, dx, dy, destination, alpha=0xff):
        """"""
        x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1)
        for x in range(x0, x1 + 1):
            for y in range(y0, y1 + 1):
                o = self._offset(x, y)
                rgba = self.canvas[o:o + 4]
                rgba[3] = alpha
                destination.point(dx + x - x0, dy + y - y0, rgba)
796978
public void clipAbsoluteBounds(Rectangle clip)
    {
        Rectangle inter = absbounds.intersection(clip);
        if (inter.width == 0 && inter.height == 0)
            displayed = false;
        else
            absbounds = inter;
    }
145398
def endclip(self):
        """"""
        self.__clip_box = self.__clip_stack[-1]
        del self.__clip_stack[-1]
        self.grestore()
1371859
def rectangle(self, rect, attr=None, fill=u' '):
        '''
        oldtop = self.WindowTop
        oldpos = self.pos()
        #raise NotImplementedError
        x0, y0, x1, y1 = rect
        if attr is None:
            attr = self.attr
        if fill:
            rowfill = fill[:1] * abs(x1 - x0)
        else:
            rowfill = u' ' * abs(x1 - x0)
        for y in range(y0, y1):
                System.Console.SetCursorPosition(x0, y)
                self.write_color(rowfill, attr)
        self.pos(*oldpos)
1164359
function copy(rect) {
         return this.setShape(rect.pos.x, rect.pos.y, rect._width, rect._height);
       }
1374952
def clip(self):
        

        self.output("Clipping", normal=True)

        # create new folder for clipped images
        path = check_create_folder(join(self.scene_path, 'clipped'))

        try:
            temp_bands = copy(self.bands)
            temp_bands.append('QA')
            for i, band in enumerate(temp_bands):
                band_name = self._get_full_filename(band)
                band_path = join(self.scene_path, band_name)

                self.output("Band %s" % band, normal=True, color='green', indent=1)
                with rasterio.open(band_path) as src:
                    bounds = transform_bounds(
                        {
                            'proj': 'longlat',
                            'ellps': 'WGS84',
                            'datum': 'WGS84',
                            'no_defs': True
                        },
                        src.crs,
                        *self.bounds
                    )

                    if disjoint_bounds(bounds, src.bounds):
                        bounds = adjust_bounding_box(src.bounds, bounds)

                    window = src.window(*bounds)

                    out_kwargs = src.meta.copy()
                    out_kwargs.update({
                        'driver': 'GTiff',
                        'height': window[0][1] - window[0][0],
                        'width': window[1][1] - window[1][0],
                        'transform': src.window_transform(window)
                    })

                    with rasterio.open(join(path, band_name), 'w', **out_kwargs) as out:
                        out.write(src.read(window=window))

            # Copy MTL to the clipped folder
            copyfile(join(self.scene_path, self.scene + '_MTL.txt'), join(path, self.scene + '_MTL.txt'))

            return path

        except IOError as e:
            exit(e.message, 1)
1117381
def padRect(rect, padTop, padBottom, padLeft, padRight, bounds, clipExcess = True):
	
	
	# Unpack the rectangle
	x, y, w, h = rect
	
	# Pad by the specified value
	x -= padLeft
	y -= padTop
	w += (padLeft + padRight)
	h += (padTop + padBottom)
	
	# Determine if we are clipping overflows/underflows or
	# shifting the centre of the rectangle to compensate
	if clipExcess == True:
		
		# Clip any underflows
		x = max(0, x)
		y = max(0, y)
		
		# Clip any overflows
		overflowY = max(0, (y + h) - bounds[0])
		overflowX = max(0, (x + w) - bounds[1])
		h -= overflowY
		w -= overflowX
		
	else:
		
		# Compensate for any underflows
		underflowX = max(0, 0 - x)
		underflowY = max(0, 0 - y)
		x += underflowX
		y += underflowY
		
		# Compensate for any overflows
		overflowY = max(0, (y + h) - bounds[0])
		overflowX = max(0, (x + w) - bounds[1])
		x -= overflowX
		w += overflowX
		y -= overflowY
		h += overflowY
		
		# If there are still overflows or underflows after our
		# modifications, we have no choice but to clip them
		x, y, w, h = padRect((x,y,w,h), 0, 0, 0, 0, bounds, True)
	
	# Re-pack the padded rect
	return (x,y,w,h)
891743
def print_descr(rect, annot):
    """"""
    annot.parent.insertText(rect.br + (10, 0),
                    "'%s' annotation" % annot.type[1], color = red)
723157
def fill_rect(self, x, y, width, height, color):
        """"""
        # pylint: disable=too-many-arguments, too-many-boolean-expressions
        self.rect(x, y, width, height, color, fill=True)
1211680
def rectified(self):
        
        return Rect(np.minimum(self.mins, self.maxes),
                    np.maximum(self.maxes, self.mins))
1172867
def includePoint(self, p):
        """"""
        if not len(p) == 2:
            raise ValueError("bad sequ. length")
        self.x0, self.y0, self.x1, self.y1 = TOOLS._include_point_in_rect(self, p)
        return self
524414
def fill_rect(framebuf, x, y, width, height, color):
        """"""
        # pylint: disable=too-many-arguments
        for _x in range(x, x+width):
            offset = 7 - _x & 0x07
            for _y in range(y, y+height):
                index = (_y * framebuf.stride + _x) // 8
                framebuf.buf[index] = (framebuf.buf[index] & ~(0x01 << offset)) \
                                      | ((color != 0) << offset)