Skip to content

Latest commit

 

History

History
147 lines (94 loc) · 4.9 KB

masking.rst

File metadata and controls

147 lines (94 loc) · 4.9 KB

ClipPath

svgwrite.masking.ClipPath

Adding clipping elements to ClipPath:

dwg = svgwrite.Drawing()
clip_path = dwg.defs.add(dwg.clipPath())
clip_path.add(dwg.circle((100, 100), 50))

SVG Attributes

  • class -- string

    assigns one or more css-class-names to an element

  • style -- string

    allows per-element css-style rules to be specified directly on a given element

  • externalResourcesRequired -- bool

    False: if document rendering can proceed even if external resources are unavailable else: True

  • transform -- use svgwrite.mixins.Transform methods
  • clipPathUnits -- 'userSpaceOnUse | objectBoundingBox'

    Defines the coordinate system for the contents of the clipPath.

    If clipPathUnits = 'userSpaceOnUse' , the contents of the clipPath represent values in the current user coordinate system in place at the time when the clipPath element is referenced (i.e., the user coordinate system for the element referencing the clipPath element via the clip-path property).

    If clipPathUnits = 'objectBoundingBox' , then the user coordinate system for the contents of the clipPath element is established using the bounding box of the element to which the clipping path is applied.

    Default is 'userSpaceOnUse'

Standard SVG Attributes

  • Core Attributes </attributes/core>
  • Conditional Processing Attributes </attributes/conditional_processing>
  • Presentation Attributes </attributes/presentation>

Mask

svgwrite.masking.Mask

SVG Attributes

  • class -- string

    assigns one or more css-class-names to an element

  • style -- string

    allows per-element css-style rules to be specified directly on a given element

  • externalResourcesRequired -- bool

    `False`: if document rendering can proceed even if external resources are unavailable else: True

  • maskUnits -- 'userSpaceOnUse | objectBoundingBox'

    Defines the coordinate system for attributes x, y, width and height.

    If maskUnits = 'userSpaceOnUse' , x, y, width and height represent values in the current user coordinate system in place at the time when the mask element is referenced (i.e., the user coordinate system for the element referencing the mask element via the mask property).

    If maskUnits = 'objectBoundingBox' , x, y, width and height represent fractions or percentages of the bounding box of the element to which the mask is applied.

    Default is 'objectBoundingBox'.

  • maskContentUnits -- 'userSpaceOnUse | objectBoundingBox'

    Defines the coordinate system for the contents of the mask.

    If maskContentUnits = 'userSpaceOnUse' , the user coordinate system for the contents of the mask element is the current user coordinate system in place at the time when the mask element is referenced (i.e., the user coordinate system for the element referencing the mask element via the mask property).

    If maskContentUnits = 'objectBoundingBox' , the user coordinate system for the contents of the mask is established using the bounding box of the element to which the mask is applied.

    Default is 'userSpaceOnUse'.

  • x -- <coordinate> -- start parameter

    The x-axis coordinate of one corner of the rectangle for the largest possible offscreen buffer. Note that the clipping path used to render any graphics within the mask will consist of the intersection of the current clipping path associated with the given object and the rectangle defined by x, y, width and height.

    Default is '-10%'.

  • y -- <coordinate> -- start parameter

    The y-axis coordinate of one corner of the rectangle for the largest possible offscreen buffer.

    Default is '-10%'.

  • width -- <length> -- size parameter

    The width of the largest possible offscreen buffer. Note that the clipping path used to render any graphics within the mask will consist of the intersection of the current clipping path associated with the given object and the rectangle defined by x, y, width and height.

    Default is '120%'.

  • height -- <length> -- size parameter

    The height of the largest possible offscreen buffer.

    Default is '120%'.

Standard SVG Attributes

  • Core Attributes </attributes/core>
  • Conditional Processing Attributes </attributes/conditional_processing>
  • Presentation Attributes </attributes/presentation>