Sign in

    This version of the module is deprecated: Use moonbitlang/pdflite instead

    bobzhang/pdflite/shape does not have a README file

    PdfRectangle

    A normalized rectangle in PDF user-space coordinates.

    min_x and min_y are always the lower bounds, and max_x and max_y are always the upper bounds. Parsers normalize PDF rectangle arrays whose coordinates are written in the opposite order.

    Point2

    A two-dimensional point in PDF user-space coordinates.

    TransformMatrix

    A PDF affine transform matrix.

    The fields correspond to PDF's six-operand matrix [a b c d e f], where a point is transformed as x' = a*x + c*y + e and y' = b*x + d*y + f.

    PdfDrawnPath

    pub(all) struct PdfDrawnPath {
    stroked : Bool
    filled : Bool
    path : PdfPath
    } derive(Eq, ToJson,
    Debug
    )

    A cpdfcontent drawn path, pairing path geometry with paint flags.

    PdfDrawnPath::content_json

    fn PdfDrawnPath::content_json(self : PdfDrawnPath) -> Json

    Return cpdfcontent's JSON shape for a drawn path.

    PdfPath

    pub(all) struct PdfPath {
    winding_rule : PdfPathWindingRule
    subpaths : Array[PdfPathSubpath]
    } derive(Eq, ToJson,
    Debug
    )

    A cpdf-style path.

    PdfPath::bounds

    Return cpdfcontent's axis-aligned bounding box for a path.

    Empty paths return a zero rectangle, matching cpdfcontent.ml.

    PdfPath::pdf_path_bounds_optional

    Return the bounds of a path, or None when it has no drawable segments.

    PdfPath::transform

    Transform every point in a path.

    PdfPathClosure

    pub(all) enum PdfPathClosure {
    PdfPathClosed
    PdfPathOpen
    } derive(Eq, ToJson,
    Debug
    )

    Whether a subpath is open or closed.

    PdfPathHole

    pub(all) enum PdfPathHole {
    PdfPathHole
    PdfPathNotHole
    } derive(Eq, ToJson,
    Debug
    )

    Whether a subpath is a hole in the containing path.

    PdfPathSegment

    One straight or Bezier path segment.

    PdfPathSegment::bounds

    Return cpdfcontent's control-point bounding box for a path segment.

    Bezier bounds intentionally include the two control points rather than solving for curve extrema, matching cpdfcontent.ml's bbox_of_segment.

    PdfPathSegment::content_json

    fn PdfPathSegment::content_json(self : PdfPathSegment) -> Json

    Return cpdfcontent's JSON shape for one path segment.

    PdfPathSegment::transform

    Transform every point in a path segment.

    PdfPathSubpath

    pub(all) struct PdfPathSubpath {
    hole : PdfPathHole
    closure : PdfPathClosure
    segments : Array[PdfPathSegment]
    } derive(Eq, ToJson,
    Debug
    )

    A cpdf-style subpath.

    PdfPathSubpath::content_json

    fn PdfPathSubpath::content_json(self : PdfPathSubpath) -> Json

    Return cpdfcontent's JSON shape for one subpath.

    The hole flag is intentionally not emitted, matching cpdfcontent.ml.

    PdfPathWindingRule

    pub(all) enum PdfPathWindingRule {
    PdfPathEvenOdd
    PdfPathNonZero
    } derive(Eq, ToJson,
    Debug
    )

    Fill rule for a cpdf-style path.

    pdf_circle

    fn pdf_circle(center_x : Double, center_y : Double, radius : Double) -> PdfPath

    Source-spelled compatibility alias for cpdfshape's circle.

    pdf_drawn_path_content_json

    fn pdf_drawn_path_content_json(path : PdfDrawnPath) -> Json

    Compatibility wrapper for PdfDrawnPath::content_json.

    pdf_kappa

    let pdf_kappa : Double

    Source-spelled compatibility alias for cpdfshape's kappa.

    pdf_path_bounds

    Compatibility wrapper for PdfPath::bounds.

    pdf_path_segment_bounds

    Compatibility wrapper for PdfPathSegment::bounds.

    pdf_path_segment_content_json

    fn pdf_path_segment_content_json(segment : PdfPathSegment) -> Json

    Compatibility wrapper for PdfPathSegment::content_json.

    pdf_path_segment_transform

    Compatibility wrapper for PdfPathSegment::transform.

    pdf_path_subpath_content_json

    fn pdf_path_subpath_content_json(subpath : PdfPathSubpath) -> Json

    Compatibility wrapper for PdfPathSubpath::content_json.

    pdf_path_transform

    Compatibility wrapper for PdfPath::transform.

    pdf_rectangle

    fn pdf_rectangle(x : Double, y : Double, width : Double, height : Double) -> PdfPath

    Source-spelled compatibility alias for cpdfshape's rectangle.

    pdf_restrict_angle

    fn pdf_restrict_angle(step : Double, angle : Double) -> Double

    Restrict an angle to the closest multiple of step, modulo 2 * pi.

    pdf_shape_circle

    fn pdf_shape_circle(center_x : Double, center_y : Double, radius : Double) -> PdfPath

    Build a cpdf-style circular path from four Bezier quarter arcs.

    pdf_shape_kappa

    let pdf_shape_kappa : Double

    Bezier control-line factor used by cpdf for circular arcs.

    pdf_shape_rectangle

    fn pdf_shape_rectangle(x : Double, y : Double, width : Double, height : Double) -> PdfPath

    Build a cpdf-style rectangle path from a top-left point, width, and height.