Class: Prawn::SVG::Elements::Mask

Inherits:
Base
  • Object
show all
Defined in:
lib/prawn/svg/elements/mask.rb

Constant Summary

Constants inherited from Base

Base::COMMA_WSP_REGEXP, Base::MissingAttributesError, Base::PAINT_TYPES, Base::SVG_NAMESPACE, Base::SkipElementError, Base::SkipElementQuietly

Constants included from Attributes::Stroke

Attributes::Stroke::CAP_STYLE_TRANSLATIONS, Attributes::Stroke::JOIN_STYLE_TRANSLATIONS

Instance Attribute Summary

Attributes inherited from Base

#attributes, #base_calls, #calls, #document, #parent_calls, #properties, #source, #state

Instance Method Summary collapse

Methods inherited from Base

#initialize, #name, #parse_and_apply, #process

Methods included from TransformParser

#parse_transform_attribute

Methods included from PDFMatrix

#load_matrix, #matrix_for_pdf, #rotation_matrix, #scale_matrix, #translation_matrix

Methods included from Attributes::Space

#parse_xml_space_attribute

Methods included from Attributes::Stroke

#parse_stroke_attributes_and_call

Methods included from Attributes::Mask

#parse_mask_attribute_and_call

Methods included from Attributes::ClipPath

#parse_clip_path_attribute_and_call

Methods included from Attributes::Opacity

#parse_opacity_attributes_and_call

Methods included from Attributes::Transform

#parse_transform_attribute_and_call

Constructor Details

This class inherits a constructor from Prawn::SVG::Elements::Base

Instance Method Details

#build_mask_calls(element) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/prawn/svg/elements/mask.rb', line 10

def build_mask_calls(element)
  bbox = element.bounding_box
  mask_units = attributes['maskUnits'] || 'objectBoundingBox'
  content_units = attributes['maskContentUnits'] || 'userSpaceOnUse'

  if content_units == 'objectBoundingBox' && bbox.nil?
    document.warnings << 'mask with maskContentUnits="objectBoundingBox" requires element to have a bounding box'
    return []
  end

  calls = []

  calls.concat(build_clip_calls(bbox, mask_units)) if bbox || mask_units == 'userSpaceOnUse'

  if content_units == 'objectBoundingBox'
    calls.concat(build_object_bounding_box_calls(bbox))
  else
    calls.concat(duplicate_calls(base_calls))
  end

  calls
end

#container?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/prawn/svg/elements/mask.rb', line 6

def container?
  true
end

#parseObject



2
3
4
# File 'lib/prawn/svg/elements/mask.rb', line 2

def parse
  set_display_none
end