Class: PSD::Renderer::VectorShape

Inherits:
Object
  • Object
show all
Includes:
CairoHelpers
Defined in:
lib/psd/renderer/vector_shape.rb

Constant Summary collapse

DPI =
72.0.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CairoHelpers

#cairo_image_surface, #cairo_path

Constructor Details

#initialize(canvas) ⇒ VectorShape

Returns a new instance of VectorShape.



14
15
16
17
18
19
20
21
22
23
# File 'lib/psd/renderer/vector_shape.rb', line 14

def initialize(canvas)
  @canvas = canvas
  @node = @canvas.node
  @path = @node.vector_mask.paths.map(&:to_hash)

  @stroke_data = @node.vector_stroke ? @node.vector_stroke.data : {}
  @fill_data = @node.vector_stroke_content ? @node.vector_stroke_content.data : {}

  @paths = []
end

Class Method Details

.can_render?(canvas) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/psd/renderer/vector_shape.rb', line 8

def self.can_render?(canvas)
  canvas.opts[:render_vectors] && !canvas.node.vector_mask.nil?
end

Instance Method Details

#render!Object



25
26
27
28
29
30
# File 'lib/psd/renderer/vector_shape.rb', line 25

def render!
  PSD.logger.debug "Beginning vector render for #{@node.name}"

  find_points
  render_shapes
end