Skip to content

Commit

Permalink
Move gradient render call into Prawn::SVG::Renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
tonymarklove committed Dec 23, 2024
1 parent d2b265a commit bf4fc0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/prawn/svg/elements/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def apply_colors
add_call "#{type}_color", result.value
true
when Prawn::SVG::Elements::Gradient
add_call "#{type}_svg_gradient", **result.gradient_arguments(self)
add_call 'svg:render_gradient', type.to_sym, **result.gradient_arguments(self)
true
end
end
Expand Down
8 changes: 0 additions & 8 deletions lib/prawn/svg/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ def svg(data, options = {}, &block)
{ warnings: svg.document.warnings, width: svg.document.sizing.output_width,
height: svg.document.sizing.output_height }
end

def fill_svg_gradient(**kwarguments)
Prawn::SVG::GradientRenderer.new(self, :fill, **kwarguments).draw
end

def stroke_svg_gradient(**kwarguments)
Prawn::SVG::GradientRenderer.new(self, :stroke, **kwarguments).draw
end
end
end
end
5 changes: 5 additions & 0 deletions lib/prawn/svg/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ def rewrite_call_arguments(prawn, call, arguments, kwarguments)
Renderer.new(prawn, sub_document, sub_options).draw
document.warnings.concat(sub_document.warnings)
yield

when 'svg:render_gradient'
type = arguments.first
GradientRenderer.new(prawn, type, **kwarguments).draw
yield
end
end

Expand Down

0 comments on commit bf4fc0f

Please sign in to comment.