Rasterizer

Overview

Rasterizer is a class in Aspose.Font FOSS for Python.

Scanline rasterizer for GlyphPath outlines with pure-Python PNG export.

This class provides 5 methods for working with Rasterizer objects in Python programs. Available methods include: __init__, clear, close_contour, draw_path, to_png. All public members are accessible to any Python application after installing the Aspose.Font FOSS for Python package. Properties: curve_tolerance, height, width.

Properties

NameTypeAccessDescription
curve_tolerancefloatReadGets the curve tolerance.
width``ReadGets the width.
height``ReadGets the height.

Methods

SignatureDescription
__init__(width: int, height: int, background: tuple[int, int, int])Calls init on this Rasterizer instance.
clear(color: tuple[int, int, int] | None)Fill entire buffer with background (or provided) color.
draw_path(path: GlyphPath, color: tuple[int, int, int], transform: tuple[float, ...] | None)Rasterize one path into the current RGB buffer.
to_png()bytesEncode current RGB buffer as 8-bit PNG (IHDR+IDAT+IEND).
close_contour()Finalizes the current contour being rasterized

See Also