Area and clipping
Source snapshot: df47b3926b7c52e7f62eddbbf9dc618d6bbd6b6a.
Rectangle geometry, scoped clip contexts, and clipped canvas operations.
Every entry below is generated from a public binding table or header declaration and links to its immutable source line.
graphics.Area
class Area(x=0, y=0, w=0, h=0)Immutable rectangle geometry used for bounds, clipping, and draw results.
View the pinned source declaration
graphics.Area.contains
Area.contains(point_or_x, y=None)Test whether the area contains a point.
View the pinned source declaration
graphics.Area.contains_area
Area.contains_area(other)Test whether another Area is fully contained.
View the pinned source declaration
graphics.Area.intersects
Area.intersects(other)Test whether two areas overlap.
View the pinned source declaration
graphics.Area.touches_or_intersects
Area.touches_or_intersects(other)Test whether two areas overlap or share an edge.
View the pinned source declaration
graphics.Area.shift
Area.shift(dx=0, dy=0)Return a copy translated by the requested offset.
View the pinned source declaration
graphics.Area.clip
Area.clip(other)Return the intersection with another Area.
View the pinned source declaration
graphics.Area.offset
Area.offset(left, top=None, right=None, bottom=None)Return an Area expanded independently on each edge.
View the pinned source declaration
graphics.Area.inset
Area.inset(left, top=None, right=None, bottom=None)Return an Area reduced independently on each edge.
View the pinned source declaration
graphics.Area.x
Area.xLeft coordinate.
View the pinned source declaration
graphics.Area.y
Area.yTop coordinate.
View the pinned source declaration
graphics.Area.w
Area.wWidth in pixels.
View the pinned source declaration
graphics.Area.h
Area.hHeight in pixels.
View the pinned source declaration
graphics.ClipContext
class ClipContext(draw, area)Context manager returned by Draw.clip() for scoped clipping.
View the pinned source declaration
graphics.ClipContext.__enter__
ClipContext.__enter__()Push the requested clipping area and return the effective clip.
View the pinned source declaration
graphics.ClipContext.__exit__
ClipContext.__exit__(exc_type, exc_value, traceback)Pop the clipping area when leaving the context.
View the pinned source declaration
graphics.ClippedCanvas
class ClippedCanvas(canvas, clip)Canvas proxy that intersects writes with a fixed Area.
View the pinned source declaration
graphics.ClippedCanvas.pixel
ClippedCanvas.pixel(x, y, color=None)Read or write one pixel, depending on whether a color is supplied.
View the pinned source declaration
graphics.ClippedCanvas.fill
ClippedCanvas.fill(color)Fill the target canvas with one color and return the affected Area.
View the pinned source declaration
graphics.ClippedCanvas.fill_rect
ClippedCanvas.fill_rect(x, y, width, height, color)Fill a rectangular region and return the clipped affected Area.
View the pinned source declaration
graphics.ClippedCanvas.hline
ClippedCanvas.hline(x, y, width, color)Draw a horizontal line.
View the pinned source declaration
graphics.ClippedCanvas.vline
ClippedCanvas.vline(x, y, height, color)Draw a vertical line.
View the pinned source declaration
graphics.ClippedCanvas.blit_rect
ClippedCanvas.blit_rect(buffer, x, y, width, height)Copy a packed RGB565 rectangle onto the target.
View the pinned source declaration
graphics.ClippedCanvas.blit_transparent
ClippedCanvas.blit_transparent(buffer, x, y, width, height, key)Copy a packed RGB565 rectangle while skipping the transparent key.
View the pinned source declaration
graphics.ClippedCanvas.width
ClippedCanvas.widthWidth in pixels.
View the pinned source declaration
graphics.ClippedCanvas.height
ClippedCanvas.heightHeight in pixels.
