Class

Gjsgjs/cairodefaultSurfaceAbstract

Base class for all Cairo surfaces

Hierarchy (View Summary)

Index

Constructors

Methods

  • Finishes the surface and drops all references to external resources

    Returns void

  • Performs all pending drawing operations

    Returns void

  • Returns user data attached to the surface (C API: cairo_surface_get_user_data)

    Parameters

    Returns unknown

    The attached data or null

  • Gets the device offset of the surface

    Returns [number, number]

    An array with [x, y] device offset

  • Gets the device scale of the surface

    Returns [number, number]

    An array with [x, y] device scale

  • Surface type (image, PDF, PostScript, SVG, …) — the runtime kind regardless of static class.

    Source: gjs/modules/cairo-surface.cpp getType_func.

    Returns SurfaceType

  • Attaches user data to the surface (C API: cairo_surface_set_user_data)

    Parameters

    • key: UserDataKey

      Key for the user data

    • userData: unknown

      Data to attach

    • Optionaldestroy: (data: unknown) => void

      Optional callback when the surface is destroyed or data is replaced

    Returns Status

  • Sets the device offset of the surface

    Parameters

    • x: number

      X offset

    • y: number

      Y offset

    Returns void

  • Sets the device scale of the surface

    Parameters

    • x: number

      X scale factor

    • y: number

      Y scale factor

    Returns void

  • Write the surface's contents out to a PNG file. Only meaningful for image-backed surfaces (returns CAIRO_STATUS_WRITE_ERROR on non-image surfaces).

    Source: gjs/modules/cairo-surface.cpp writeToPNG_func.

    Parameters

    • filename: string

      Output PNG path

    Returns void