Module: Prawn::Graphics::Transparency
- Included in:
- Prawn::Graphics
- Defined in:
- lib/prawn/graphics/transparency.rb
Overview
This module is used to place transparent content on the page. It has the capacity for separate transparency values for stroked content and all other content.
Stable API collapse
Instance Method Details
#transparent(opacity, stroke_opacity = opacity) { ... } ⇒ void
This method returns an undefined value.
Set opacity.
Source Code
lib/prawn/graphics/transparency.rb, line 30
30 | def transparent(opacity, stroke_opacity = opacity) |
31 | renderer.min_version(1.4) |
32 | |
33 | opacity = opacity.clamp(0.0, 1.0) |
34 | stroke_opacity = stroke_opacity.clamp(0.0, 1.0) |
35 | |
36 | save_graphics_state
|
37 | renderer.add_content( |
38 | "/#{opacity_dictionary_name(opacity, stroke_opacity)} gs", |
39 | )
|
40 | yield
|
41 | restore_graphics_state
|
42 | end
|