Module: Emf
- Defined in:
- lib/emf/wmf/binary.rb,
lib/emf.rb,
lib/emf/emr.rb,
lib/emf/wmf.rb,
lib/emf/error.rb,
lib/emf/model.rb,
lib/emf/binary.rb,
lib/emf/version.rb,
lib/emf/detector.rb,
lib/emf/emf_plus.rb,
lib/emf/visitors.rb,
lib/emf/model/emr.rb,
lib/emf/emr/binary.rb,
lib/emf/emr/parser.rb,
lib/emf/wmf/parser.rb,
lib/emf/binary/codec.rb,
lib/emf/binary/types.rb,
lib/emf/model/record.rb,
lib/emf/model/visitor.rb,
lib/emf/visitors/dump.rb,
lib/emf/emr/serializer.rb,
lib/emf/model/geometry.rb,
lib/emf/model/metafile.rb,
lib/emf/visitors/stats.rb,
lib/emf/wmf/serializer.rb,
lib/emf/emf_plus/binary.rb,
lib/emf/emf_plus/parser.rb,
lib/emf/model/emr/header.rb,
lib/emf/emr/binary/header.rb,
lib/emf/emr/binary/record.rb,
lib/emf/model/emr/records.rb,
lib/emf/emr/binary/records.rb,
lib/emf/emf_plus/serializer.rb,
lib/emf/model/geometry/rect.rb,
lib/emf/model/geometry/size.rb,
lib/emf/emr/path_association.rb,
lib/emf/model/geometry/color.rb,
lib/emf/model/geometry/point.rb,
lib/emf/emr/binary/type_codes.rb,
lib/emf/model/geometry/matrix.rb,
lib/emf/model/geometry/rect_s.rb,
lib/emf/emr/binary/records/arc.rb,
lib/emf/emr/binary/records/eof.rb,
lib/emf/emr/binary/records/pie.rb,
lib/emf/emr/binary/records/raw.rb,
lib/emf/emr/binary/with_bounds.rb,
lib/emf/model/geometry/point_f.rb,
lib/emf/model/geometry/point_s.rb,
lib/emf/emr/binary/records/chord.rb,
lib/emf/emr/binary/records/arc_to.rb,
lib/emf/emr/binary/records/bit_blt.rb,
lib/emf/emr/binary/records/comment.rb,
lib/emf/emr/binary/records/ellipse.rb,
lib/emf/emr/binary/records/line_to.rb,
lib/emf/emr/binary/records/plg_blt.rb,
lib/emf/emr/binary/records/polygon.rb,
lib/emf/emr/binary/records/save_dc.rb,
lib/emf/emr/binary/records/end_path.rb,
lib/emf/emr/binary/records/fill_rgn.rb,
lib/emf/emr/binary/records/mask_blt.rb,
lib/emf/emr/binary/records/polyline.rb,
lib/emf/emr/binary/records/set_rop2.rb,
lib/emf/emr/binary/records/angle_arc.rb,
lib/emf/emr/binary/records/fill_path.rb,
lib/emf/emr/binary/records/frame_rgn.rb,
lib/emf/emr/binary/records/paint_rgn.rb,
lib/emf/emr/binary/records/poly_draw.rb,
lib/emf/emr/binary/records/polygon16.rb,
lib/emf/emr/binary/records/rectangle.rb,
lib/emf/emr/binary/records/abort_path.rb,
lib/emf/emr/binary/records/begin_path.rb,
lib/emf/emr/binary/records/create_pen.rb,
lib/emf/emr/binary/records/ext_escape.rb,
lib/emf/emr/binary/records/gls_record.rb,
lib/emf/emr/binary/records/invert_rgn.rb,
lib/emf/emr/binary/records/move_to_ex.rb,
lib/emf/emr/binary/records/polyline16.rb,
lib/emf/emr/binary/records/restore_dc.rb,
lib/emf/emr/binary/records/round_rect.rb,
lib/emf/emr/binary/records/set_layout.rb,
lib/emf/emr/binary/records/widen_path.rb,
lib/emf/emr/binary/records/alpha_blend.rb,
lib/emf/emr/binary/records/draw_escape.rb,
lib/emf/emr/binary/records/poly_bezier.rb,
lib/emf/emr/binary/records/poly_draw16.rb,
lib/emf/emr/binary/records/polyline_to.rb,
lib/emf/emr/binary/records/set_bk_mode.rb,
lib/emf/emr/binary/records/set_metargn.rb,
lib/emf/emr/binary/records/set_pixel_v.rb,
lib/emf/emr/binary/records/stretch_blt.rb,
lib/emf/emr/binary/records/stroke_path.rb,
lib/emf/emr/binary/records/close_figure.rb,
lib/emf/emr/binary/records/flatten_path.rb,
lib/emf/emr/binary/records/named_escape.rb,
lib/emf/emr/binary/records/pixel_format.rb,
lib/emf/emr/binary/records/poly_polygon.rb,
lib/emf/emr/binary/records/set_bk_color.rb,
lib/emf/emr/binary/records/set_icm_mode.rb,
lib/emf/emr/binary/records/set_map_mode.rb,
lib/emf/emr/binary/records/delete_object.rb,
lib/emf/emr/binary/records/gradient_fill.rb,
lib/emf/emr/binary/records/poly_bezier16.rb,
lib/emf/emr/binary/records/poly_polyline.rb,
lib/emf/emr/binary/records/polyline_to16.rb,
lib/emf/emr/binary/records/select_object.rb,
lib/emf/emr/binary/records/create_palette.rb,
lib/emf/emr/binary/records/ext_create_pen.rb,
lib/emf/emr/binary/records/ext_flood_fill.rb,
lib/emf/emr/binary/records/ext_text_out_a.rb,
lib/emf/emr/binary/records/ext_text_out_w.rb,
lib/emf/emr/binary/records/poly_bezier_to.rb,
lib/emf/emr/binary/records/poly_polygon16.rb,
lib/emf/emr/binary/records/poly_textout_a.rb,
lib/emf/emr/binary/records/poly_textout_w.rb,
lib/emf/emr/binary/records/resize_palette.rb,
lib/emf/emr/binary/records/select_palette.rb,
lib/emf/emr/binary/records/set_colorspace.rb,
lib/emf/emr/binary/records/set_text_align.rb,
lib/emf/emr/binary/records/set_text_color.rb,
lib/emf/emr/binary/records/small_text_out.rb,
lib/emf/emr/binary/records/stretch_dibits.rb,
lib/emf/emr/binary/records/offset_clip_rgn.rb,
lib/emf/emr/binary/records/poly_polyline16.rb,
lib/emf/emr/binary/records/realize_palette.rb,
lib/emf/emr/binary/records/set_linked_ufis.rb,
lib/emf/emr/binary/records/set_miter_limit.rb,
lib/emf/emr/binary/records/transparent_blt.rb,
lib/emf/emr/binary/records/poly_bezier_to16.rb,
lib/emf/emr/binary/records/select_clip_path.rb,
lib/emf/emr/binary/records/set_brush_org_ex.rb,
lib/emf/emr/binary/records/set_mapper_flags.rb,
lib/emf/emr/binary/records/create_colorspace.rb,
lib/emf/emr/binary/records/create_mono_brush.rb,
lib/emf/emr/binary/records/delete_colorspace.rb,
lib/emf/emr/binary/records/exclude_clip_rect.rb,
lib/emf/emr/binary/records/force_ufi_mapping.rb,
lib/emf/emr/binary/records/set_arc_direction.rb,
lib/emf/emr/binary/records/set_icm_profile_a.rb,
lib/emf/emr/binary/records/set_icm_profile_w.rb,
lib/emf/emr/binary/records/set_window_ext_ex.rb,
lib/emf/emr/binary/records/set_window_org_ex.rb,
lib/emf/emr/binary/records/gls_bounded_record.rb,
lib/emf/emr/binary/records/set_poly_fill_mode.rb,
lib/emf/emr/binary/records/create_colorspace_w.rb,
lib/emf/emr/binary/records/ext_select_clip_rgn.rb,
lib/emf/emr/binary/records/intersect_clip_rect.rb,
lib/emf/emr/binary/records/scale_window_ext_ex.rb,
lib/emf/emr/binary/records/set_palette_entries.rb,
lib/emf/emr/binary/records/set_viewport_ext_ex.rb,
lib/emf/emr/binary/records/set_viewport_org_ex.rb,
lib/emf/emr/binary/records/set_world_transform.rb,
lib/emf/emr/binary/records/set_dibits_to_device.rb,
lib/emf/emr/binary/records/set_stretch_blt_mode.rb,
lib/emf/emr/binary/records/stroke_and_fill_path.rb,
lib/emf/emr/binary/records/color_correct_palette.rb,
lib/emf/emr/binary/records/create_brush_indirect.rb,
lib/emf/emr/binary/records/scale_viewport_ext_ex.rb,
lib/emf/emr/binary/records/colormatch_to_target_w.rb,
lib/emf/emr/binary/records/create_font_indirect_w.rb,
lib/emf/emr/binary/records/modify_world_transform.rb,
lib/emf/emr/binary/records/set_text_justification.rb,
lib/emf/emr/binary/records/create_dib_pattern_brush_pt.rb
Overview
Placeholder for TODO.impl/11-emf-parser.md's path-association pass.
Defined Under Namespace
Modules: Binary, Detector, EmfPlus, Emr, Model, Visitors, Wmf
Classes: Error, FormatError, ParseError, SerializeError
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
43
44
45
46
47
48
|
# File 'lib/emf.rb', line 43
def detect_format(bytes)
case Detector.call(bytes)
when :wmf_apm, :wmf_standard then :wmf
when :emf then :emf
end
end
|
.parse(bytes) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/emf.rb', line 20
def parse(bytes)
case Detector.call(bytes)
when :wmf_apm, :wmf_standard then Wmf::Parser.call(bytes)
when :emf then Emr::Parser.call(bytes)
end
end
|
.parse_file(path) ⇒ Object
27
28
29
|
# File 'lib/emf.rb', line 27
def parse_file(path)
parse(File.read(path, mode: "rb"))
end
|
.serialize(metafile) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/emf.rb', line 31
def serialize(metafile)
case metafile.format
when :wmf then Wmf::Serializer.call(metafile)
when :emf, :emf_plus then Emr::Serializer.call(metafile)
else raise SerializeError, "unknown format: #{metafile.format.inspect}"
end
end
|
.serialize_file(metafile, path) ⇒ Object
39
40
41
|
# File 'lib/emf.rb', line 39
def serialize_file(metafile, path)
File.binwrite(path, serialize(metafile))
end
|