Module: Emf2svg
- Extended by:
- FFI::Library
- Defined in:
- lib/emf2svg.rb,
lib/emf2svg/recipe.rb,
lib/emf2svg/version.rb
Defined Under Namespace
Classes: Error, GeneratorOptions, Recipe
Constant Summary
collapse
- VERSION =
"1.4.3"
- LIBEMF2SVG_VERSION =
"1.7.1"
Class Method Summary
collapse
Class Method Details
.from_binary_string(content, width = 0, height = 0) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/emf2svg.rb', line 47
def from_binary_string(content, width = 0, height = 0)
svg_out = FFI::MemoryPointer.new(:pointer)
svg_out_len = FFI::MemoryPointer.new(:pointer)
content_ptr = FFI::MemoryPointer.from_string(content)
opt = options(width, height)
ret = emf2svg(content_ptr, content.size, svg_out, svg_out_len, opt)
raise Error, "emf2svg failed with error code: #{ret}" unless ret == 1
svg_out.read_pointer.read_bytes(svg_out_len.read_int)
end
|
.from_file(path, width = 0, height = 0) ⇒ Object
42
43
44
45
|
# File 'lib/emf2svg.rb', line 42
def from_file(path, width = 0, height = 0)
content = File.read(path, mode: "rb")
from_binary_string(content, width, height)
end
|