neoscore.core.image

class neoscore.core.image.Image[source]

Bases: PositionedObject

An image which can be placed in the document.

Supported image extensions/formats include: BMP, GIF, JPG, JPEG, PNG, PBM, PGM, PPM, XBM, XPM, and SVG.

__init__(pos: PointDef, parent: Optional[PositionedObject], file_path: str | pathlib.Path, scale: float = 1, rotation: float = 0, z_index: int = 0)[source]
Parameters
  • pos – Position relative to the parent

  • parent – The parent object or None

  • file_path – Path to an image file to be used

  • scale – A scaling factor applied to the image.

  • rotation – Rotation angle in degrees.

  • z_index – Controls draw order with lower values drawn first.

property scale: float

A scaling factor.

Scaling always respects the image’s aspect ratio.

property rotation: float

An angle in degrees to rotate about the image origin

property z_index: int

Value controlling draw order with lower values being drawn first

property file_path: pathlib.Path

Path to an image file to be used

property breakable_length: Unit

The breakable length of the object.

This is always ZERO, meaning images cannot be broken across Flowable lines.

render_complete(pos: Point, flowable_line: Optional[NewLine] = None, flowable_x: Optional[Unit] = None)[source]

Render the entire object.

This is used to render all objects outside flowables, as well as those inside flowables when they fit completely in one line of the flowable.

By default, this is a no-op. Subclasses with rendered appearances should override this.

This and other render methods should generally not be called directly.

Parameters
  • pos – The rendering position in document space for drawing.

  • flowable_line – If in a Flowable, the line in which this object appears

  • flowable_x – If in a Flowable, the flowable x position of this render