Class: Okab::ZaniahVector
- Inherits:
-
Object
- Object
- Okab::ZaniahVector
- Defined in:
- lib/okab/zaniah_vector.rb,
sig/okab.rbs
Overview
Optional bridge: each display-list item remains a PDF path, glyph, or image. Only effects without an equivalent PDF page operation are rasterized locally.
Constant Summary collapse
- KAPPA =
0.5522847498307936
Class Method Summary collapse
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(page, vector_document) ⇒ ZaniahVector
constructor
A new instance of ZaniahVector.
Constructor Details
#initialize(page, vector_document) ⇒ ZaniahVector
Returns a new instance of ZaniahVector.
14 15 16 17 18 19 20 21 22 |
# File 'lib/okab/zaniah_vector.rb', line 14 def initialize(page, vector_document) unless page.is_a?(Page) && vector_document.is_a?(::Zaniah::Vector::Document) raise ArgumentError, "expected an Okab::Page and Zaniah::Vector::Document" end unless page.width == vector_document.width && page.height == vector_document.height raise ArgumentError, "PDF page and vector document dimensions must match" end @page, @vector, @fonts = page, vector_document, {}.compare_by_identity end |
Class Method Details
.draw(page, vector_document) ⇒ Page
12 |
# File 'lib/okab/zaniah_vector.rb', line 12 def self.draw(page, vector_document) = new(page, vector_document).draw |
Instance Method Details
#draw ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/okab/zaniah_vector.rb', line 24 def draw @vector.commands.each do |command| clipped(command) do transformed(command) { draw_command(command) } end end @page end |