Image

Overview

BaseImage.copy Copy this object into a new object of the same type.
BaseImage.glyph The image’s parent BaseGlyph.
BaseImage.layer The image’s parent BaseLayer.
BaseImage.font The image’s parent BaseFont.
BaseImage.data The image’s raw byte data.
BaseImage.color The image’s color.
BaseImage.transformation The image’s Transformation Matrix.
BaseImage.offset The image’s offset.
BaseImage.scale The image’s scale.
BaseImage.transformBy Transform the object.
BaseImage.moveBy Move the object.
BaseImage.scaleBy Scale the object.
BaseImage.rotateBy Rotate the object.
BaseImage.skewBy Skew the object.
BaseImage.round Round offset coordinates.
BaseImage.naked Return the environment’s native object that has been wrapped by this object.
BaseImage.changed Tell the environment that something has changed in the object.

Reference

class fontParts.base.BaseImage(*args, **kwargs)

Copy

BaseImage.copy()

Copy this object into a new object of the same type. The returned object will not have a parent object.

Parents

BaseImage.glyph

The image’s parent BaseGlyph.

BaseImage.layer

The image’s parent BaseLayer.

BaseImage.font

The image’s parent BaseFont.

Attributes

BaseImage.data

The image’s raw byte data. The possible formats are defined by each environment.

BaseImage.color

The image’s color. This will be a Color or None.

>>> image.color
None
>>> image.color = (1, 0, 0, 0.5)
BaseImage.transformation

The image’s Transformation Matrix. This defines the image’s position, scale, and rotation.

>>> image.transformation
(1, 0, 0, 1, 0, 0)
>>> image.transformation = (2, 0, 0, 2, 100, -50)
BaseImage.offset

The image’s offset. This is a shortcut to the offset values in transformation. This must be an iterable containing two Integer/Float values defining the x and y values to offset the image by.

>>> image.offset
(0, 0)
>>> image.offset = (100, -50)
BaseImage.scale

The image’s scale. This is a shortcut to the scale values in transformation. This must be an iterable containing two Integer/Float values defining the x and y values to scale the image by.

>>> image.scale
(1, 1)
>>> image.scale = (2, 2)

Transformations

BaseImage.transformBy(matrix, origin=None)

Transform the object.

>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))

matrix must be a Transformation Matrix. origin defines the point at with the transformation should originate. It must be a Coordinate or None. The default is (0, 0).

BaseImage.moveBy(value)

Move the object.

>>> obj.transformBy((10, 0))

value must be an iterable containing two Integer/Float values defining the x and y values to move the object by.

BaseImage.scaleBy(value, origin=None)

Scale the object.

>>> obj.transformBy(2.0)
>>> obj.transformBy((0.5, 2.0), origin=(500, 500))

value must be an iterable containing two Integer/Float values defining the x and y values to scale the object by. origin defines the point at with the scale should originate. It must be a Coordinate or None. The default is (0, 0).

BaseImage.rotateBy(value, origin=None)

Rotate the object.

>>> obj.transformBy(45)
>>> obj.transformBy(45, origin=(500, 500))

value must be a Integer/Float values defining the angle to rotate the object by. origin defines the point at with the rotation should originate. It must be a Coordinate or None. The default is (0, 0).

BaseImage.skewBy(value, origin=None)

Skew the object.

>>> obj.skewBy(11)
>>> obj.skewBy((25, 10), origin=(500, 500))

value must be rone of the following:

  • single Integer/Float indicating the value to skew the x direction by.
  • iterable cointaining type Integer/Float defining the values to skew the x and y directions by.

origin defines the point at with the skew should originate. It must be a Coordinate or None. The default is (0, 0).

Normalization

BaseImage.round()

Round offset coordinates.

Environment

BaseImage.naked()

Return the environment’s native object that has been wrapped by this object.

>>> loweLevelObj = obj.naked()
BaseImage.changed(*args, **kwargs)

Tell the environment that something has changed in the object. The behavior of this method will vary from environment to environment.

>>> obj.changed()