Class: Vectory::Emf
Instance Attribute Summary
Attributes inherited from Vector
#initial_path
Attributes inherited from Image
#content
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Vector
#file_size, from_datauri, from_path, #initialize, #mime, #path, #size, #to_uri, #write
Methods inherited from Image
from_content, from_path, #initialize
Class Method Details
.all_mimetypes ⇒ Object
12
13
14
|
# File 'lib/vectory/emf.rb', line 12
def self.all_mimetypes
[mimetype] + alternative_mimetypes
end
|
.alternative_mimetypes ⇒ Object
20
21
22
|
# File 'lib/vectory/emf.rb', line 20
def self.alternative_mimetypes
["application/x-msmetafile"]
end
|
.default_extension ⇒ Object
8
9
10
|
# File 'lib/vectory/emf.rb', line 8
def self.default_extension
"emf"
end
|
.from_node(node) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/vectory/emf.rb', line 24
def self.from_node(node)
uri = node["src"]
return Vectory::Datauri.new(uri).to_vector if %r{^data:}.match?(uri)
from_path(uri)
end
|
.mimetype ⇒ Object
16
17
18
|
# File 'lib/vectory/emf.rb', line 16
def self.mimetype
"image/emf"
end
|
Instance Method Details
#height ⇒ Object
43
44
45
46
47
48
|
# File 'lib/vectory/emf.rb', line 43
def height
bounds =
return super unless bounds
bounds.bottom - bounds.top
end
|
#to_eps ⇒ Object
35
36
37
|
# File 'lib/vectory/emf.rb', line 35
def to_eps
to_svg.to_eps
end
|
#to_ps ⇒ Object
39
40
41
|
# File 'lib/vectory/emf.rb', line 39
def to_ps
to_svg.to_ps
end
|
#to_svg ⇒ Object
31
32
33
|
# File 'lib/vectory/emf.rb', line 31
def to_svg
Svg.from_content(Emfsvg.from_bytes(content))
end
|
#width ⇒ Object
50
51
52
53
54
55
|
# File 'lib/vectory/emf.rb', line 50
def width
bounds =
return super unless bounds
bounds.right - bounds.left
end
|