geometry Module#

Classes:

RawSize

The dimensions of a rectangular region.

Size

The dimensions of a rectangular region.

class term_image.geometry.RawSize(width, height)[source]#

Bases: NamedTuple

The dimensions of a rectangular region.

Parameters:
  • width (int) – The horizontal dimension

  • height (int) – The vertical dimension

Note

  • A dimension may be non-positive but the validity and meaning would be determined by the receiving interface.

  • This is a subclass of tuple. Hence, instances can be used anyway and anywhere tuples can.

Attributes:

width

The horizontal dimension

height

The vertical dimension

width: int#

The horizontal dimension

height: int#

The vertical dimension

class term_image.geometry.Size(width, height)[source]#

Bases: RawSize

The dimensions of a rectangular region.

Raises:

ValueError – Either dimension is non-positive.

Same as RawSize, except that both dimensions must be positive.

Important

In the case of multiple inheritance i.e if subclassing this class along with other classes, this class should appear last (i.e to the far right) in the base class list.