Class: VectorSalad::StandardShapes::Difference

Inherits:
Clip show all
Defined in:
lib/vector_salad/standard_shapes/difference.rb

Overview

Subtract the contained shapes.

Instance Attribute Summary

Attributes inherited from BasicShape

#options

Instance Method Summary collapse

Methods inherited from Clip

#canvas, #to_path

Methods inherited from BasicShape

#flip, #flip_x, #flip_y, #jitter, #move, #rotate, #scale, #to_a, #to_bezier_path, #to_cubic_path, #to_multi_path, #to_path, #to_simple_path, #to_svg

Constructor Details

#initialize(**options, &block) ⇒ Difference

The first path is used as the subject, subsequent paths are subtracted from the first.

Examples:

Difference.new do
  canvas << Path.new([0,0], [90,90], [0,90])
  canvas << Path.new([50,0], [95,0], [50, 70])
end

Using DSL:

difference do
  path([0,0], [90,90], [0,90])
  path([50,0], [95,0], [50, 70])
end


22
23
24
# File 'lib/vector_salad/standard_shapes/difference.rb', line 22

def initialize(**options, &block)
  super(:difference, **options, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VectorSalad::DSL