emf 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +224 -19
- data/exe/emf +12 -0
- data/lib/emf/backend.rb +60 -0
- data/lib/emf/binary/class_field_accessors.rb +49 -0
- data/lib/emf/binary/float32_le.rb +54 -0
- data/lib/emf/binary/types.rb +40 -6
- data/lib/emf/conformance/context.rb +36 -0
- data/lib/emf/conformance/diagnostic.rb +18 -0
- data/lib/emf/conformance/manifest/emf_bitmap_misc.yml +622 -0
- data/lib/emf/conformance/manifest/emf_control_buffers.yml +61 -0
- data/lib/emf/conformance/manifest/emf_core.yml +117 -0
- data/lib/emf/conformance/manifest/emf_corpus_rules.yml +21 -0
- data/lib/emf/conformance/manifest/emf_objects_geometry.yml +229 -0
- data/lib/emf/conformance/manifest/emf_plus.yml +357 -0
- data/lib/emf/conformance/manifest/emf_plus_core.yml +33 -0
- data/lib/emf/conformance/manifest/emf_state_path.yml +403 -0
- data/lib/emf/conformance/manifest/emf_text.yml +97 -0
- data/lib/emf/conformance/manifest/wmf.yml +874 -0
- data/lib/emf/conformance/manifest.rb +79 -0
- data/lib/emf/conformance/profile.rb +35 -0
- data/lib/emf/conformance/record_types.rb +24 -0
- data/lib/emf/conformance/registry.rb +76 -0
- data/lib/emf/conformance/report.rb +83 -0
- data/lib/emf/conformance/rule.rb +16 -0
- data/lib/emf/conformance/rules/emf_bitmap.rb +357 -0
- data/lib/emf/conformance/rules/emf_comment_escape.rb +309 -0
- data/lib/emf/conformance/rules/emf_control_buffers.rb +137 -0
- data/lib/emf/conformance/rules/emf_corpus_named.rb +83 -0
- data/lib/emf/conformance/rules/emf_framing.rb +94 -0
- data/lib/emf/conformance/rules/emf_geometry.rb +282 -0
- data/lib/emf/conformance/rules/emf_header.rb +114 -0
- data/lib/emf/conformance/rules/emf_objects.rb +291 -0
- data/lib/emf/conformance/rules/emf_parse_recovery.rb +97 -0
- data/lib/emf/conformance/rules/emf_path_clip.rb +165 -0
- data/lib/emf/conformance/rules/emf_plus.rb +75 -0
- data/lib/emf/conformance/rules/emf_plus_common.rb +58 -0
- data/lib/emf/conformance/rules/emf_plus_drawing.rb +78 -0
- data/lib/emf/conformance/rules/emf_plus_effects.rb +104 -0
- data/lib/emf/conformance/rules/emf_plus_fields.rb +169 -0
- data/lib/emf/conformance/rules/emf_plus_fields_b.rb +102 -0
- data/lib/emf/conformance/rules/emf_plus_framing.rb +172 -0
- data/lib/emf/conformance/rules/emf_plus_objects.rb +97 -0
- data/lib/emf/conformance/rules/emf_plus_payloads.rb +320 -0
- data/lib/emf/conformance/rules/emf_plus_properties.rb +96 -0
- data/lib/emf/conformance/rules/emf_plus_state.rb +77 -0
- data/lib/emf/conformance/rules/emf_state.rb +244 -0
- data/lib/emf/conformance/rules/emf_text.rb +221 -0
- data/lib/emf/conformance/rules/emf_transform.rb +85 -0
- data/lib/emf/conformance/rules/wmf_buffers.rb +259 -0
- data/lib/emf/conformance/rules/wmf_framing.rb +146 -0
- data/lib/emf/conformance/rules/wmf_layout_records.rb +112 -0
- data/lib/emf/conformance/rules/wmf_objects.rb +168 -0
- data/lib/emf/conformance/rules/wmf_records.rb +191 -0
- data/lib/emf/conformance/rules/wmf_rejections.rb +184 -0
- data/lib/emf/conformance/runner.rb +61 -0
- data/lib/emf/conformance/ternary_raster_operations.rb +52 -0
- data/lib/emf/conformance.rb +31 -0
- data/lib/emf/emf_plus/effects/blur.rb +24 -0
- data/lib/emf/emf_plus/effects/brightness_contrast.rb +22 -0
- data/lib/emf/emf_plus/effects/color_balance.rb +24 -0
- data/lib/emf/emf_plus/effects/color_curve.rb +24 -0
- data/lib/emf/emf_plus/effects/color_lookup_table.rb +26 -0
- data/lib/emf/emf_plus/effects/color_matrix.rb +23 -0
- data/lib/emf/emf_plus/effects/effect.rb +50 -0
- data/lib/emf/emf_plus/effects/hue_saturation_lightness.rb +24 -0
- data/lib/emf/emf_plus/effects/levels.rb +24 -0
- data/lib/emf/emf_plus/effects/opaque.rb +19 -0
- data/lib/emf/emf_plus/effects/red_eye_correction.rb +35 -0
- data/lib/emf/emf_plus/effects/sharpen.rb +24 -0
- data/lib/emf/emf_plus/effects/tint.rb +22 -0
- data/lib/emf/emf_plus/effects.rb +45 -0
- data/lib/emf/emf_plus/frame.rb +41 -0
- data/lib/emf/emf_plus/links/effect_link.rb +16 -0
- data/lib/emf/emf_plus/links/get_dc_span.rb +18 -0
- data/lib/emf/emf_plus/links/link_error.rb +15 -0
- data/lib/emf/emf_plus/links.rb +77 -0
- data/lib/emf/emf_plus/object_chain.rb +108 -0
- data/lib/emf/emf_plus/object_table.rb +182 -0
- data/lib/emf/emf_plus/objects/brush.rb +296 -0
- data/lib/emf/emf_plus/objects/custom_line_cap.rb +106 -0
- data/lib/emf/emf_plus/objects/font.rb +47 -0
- data/lib/emf/emf_plus/objects/image.rb +68 -0
- data/lib/emf/emf_plus/objects/image_attributes.rb +28 -0
- data/lib/emf/emf_plus/objects/opaque.rb +19 -0
- data/lib/emf/emf_plus/objects/parts.rb +103 -0
- data/lib/emf/emf_plus/objects/path.rb +21 -0
- data/lib/emf/emf_plus/objects/pen.rb +132 -0
- data/lib/emf/emf_plus/objects/region.rb +39 -0
- data/lib/emf/emf_plus/objects/string_format.rb +55 -0
- data/lib/emf/emf_plus/objects/typed.rb +50 -0
- data/lib/emf/emf_plus/objects.rb +46 -0
- data/lib/emf/emf_plus/parser.rb +64 -2
- data/lib/emf/emf_plus/records/base.rb +107 -0
- data/lib/emf/emf_plus/records/begin_container.rb +31 -0
- data/lib/emf/emf_plus/records/begin_container_no_params.rb +20 -0
- data/lib/emf/emf_plus/records/body.rb +16 -0
- data/lib/emf/emf_plus/records/clear.rb +22 -0
- data/lib/emf/emf_plus/records/clip_transform_flags.rb +26 -0
- data/lib/emf/emf_plus/records/comment.rb +21 -0
- data/lib/emf/emf_plus/records/draw_arc.rb +33 -0
- data/lib/emf/emf_plus/records/draw_beziers.rb +31 -0
- data/lib/emf/emf_plus/records/draw_closed_curve.rb +34 -0
- data/lib/emf/emf_plus/records/draw_curve.rb +38 -0
- data/lib/emf/emf_plus/records/draw_driver_string.rb +61 -0
- data/lib/emf/emf_plus/records/draw_ellipse.rb +28 -0
- data/lib/emf/emf_plus/records/draw_image.rb +42 -0
- data/lib/emf/emf_plus/records/draw_image_points.rb +62 -0
- data/lib/emf/emf_plus/records/draw_lines.rb +34 -0
- data/lib/emf/emf_plus/records/draw_path.rb +23 -0
- data/lib/emf/emf_plus/records/draw_pie.rb +33 -0
- data/lib/emf/emf_plus/records/draw_rects.rb +30 -0
- data/lib/emf/emf_plus/records/draw_string.rb +41 -0
- data/lib/emf/emf_plus/records/end_container.rb +20 -0
- data/lib/emf/emf_plus/records/end_of_file.rb +17 -0
- data/lib/emf/emf_plus/records/fill_brush.rb +21 -0
- data/lib/emf/emf_plus/records/fill_closed_curve.rb +38 -0
- data/lib/emf/emf_plus/records/fill_ellipse.rb +29 -0
- data/lib/emf/emf_plus/records/fill_path.rb +23 -0
- data/lib/emf/emf_plus/records/fill_pie.rb +34 -0
- data/lib/emf/emf_plus/records/fill_polygon.rb +32 -0
- data/lib/emf/emf_plus/records/fill_rects.rb +31 -0
- data/lib/emf/emf_plus/records/fill_region.rb +23 -0
- data/lib/emf/emf_plus/records/get_dc.rb +18 -0
- data/lib/emf/emf_plus/records/header.rb +35 -0
- data/lib/emf/emf_plus/records/multiply_world_transform.rb +24 -0
- data/lib/emf/emf_plus/records/object.rb +32 -0
- data/lib/emf/emf_plus/records/offset_clip.rb +24 -0
- data/lib/emf/emf_plus/records/primitives/argb.rb +20 -0
- data/lib/emf/emf_plus/records/primitives/bitmap.rb +32 -0
- data/lib/emf/emf_plus/records/primitives/bitmap_data.rb +21 -0
- data/lib/emf/emf_plus/records/primitives/blend_colors.rb +22 -0
- data/lib/emf/emf_plus/records/primitives/blend_factors.rb +21 -0
- data/lib/emf/emf_plus/records/primitives/bounded_array.rb +38 -0
- data/lib/emf/emf_plus/records/primitives/byte_reader.rb +25 -0
- data/lib/emf/emf_plus/records/primitives/character_range.rb +20 -0
- data/lib/emf/emf_plus/records/primitives/compressed_image.rb +17 -0
- data/lib/emf/emf_plus/records/primitives/focus_scale_data.rb +20 -0
- data/lib/emf/emf_plus/records/primitives/graphics_version.rb +21 -0
- data/lib/emf/emf_plus/records/primitives/language_identifier.rb +22 -0
- data/lib/emf/emf_plus/records/primitives/metafile.rb +19 -0
- data/lib/emf/emf_plus/records/primitives/palette.rb +21 -0
- data/lib/emf/emf_plus/records/primitives/path.rb +89 -0
- data/lib/emf/emf_plus/records/primitives/path_point_type.rb +21 -0
- data/lib/emf/emf_plus/records/primitives/path_point_type_rle.rb +23 -0
- data/lib/emf/emf_plus/records/primitives/point.rb +18 -0
- data/lib/emf/emf_plus/records/primitives/point_array.rb +42 -0
- data/lib/emf/emf_plus/records/primitives/point_f.rb +19 -0
- data/lib/emf/emf_plus/records/primitives/point_r.rb +19 -0
- data/lib/emf/emf_plus/records/primitives/rect.rb +20 -0
- data/lib/emf/emf_plus/records/primitives/rect_array.rb +24 -0
- data/lib/emf/emf_plus/records/primitives/rect_f.rb +21 -0
- data/lib/emf/emf_plus/records/primitives/region_node.rb +68 -0
- data/lib/emf/emf_plus/records/primitives/region_node_child_nodes.rb +22 -0
- data/lib/emf/emf_plus/records/primitives/region_node_path.rb +37 -0
- data/lib/emf/emf_plus/records/primitives/relative_coordinate.rb +32 -0
- data/lib/emf/emf_plus/records/primitives/string_format_data.rb +23 -0
- data/lib/emf/emf_plus/records/primitives/transform_matrix.rb +23 -0
- data/lib/emf/emf_plus/records/primitives.rb +41 -0
- data/lib/emf/emf_plus/records/reset_clip.rb +17 -0
- data/lib/emf/emf_plus/records/reset_world_transform.rb +17 -0
- data/lib/emf/emf_plus/records/restore.rb +20 -0
- data/lib/emf/emf_plus/records/rotate_world_transform.rb +24 -0
- data/lib/emf/emf_plus/records/save.rb +20 -0
- data/lib/emf/emf_plus/records/scale_world_transform.rb +26 -0
- data/lib/emf/emf_plus/records/serializable_object.rb +32 -0
- data/lib/emf/emf_plus/records/set_anti_alias_mode.rb +25 -0
- data/lib/emf/emf_plus/records/set_clip_path.rb +20 -0
- data/lib/emf/emf_plus/records/set_clip_rect.rb +24 -0
- data/lib/emf/emf_plus/records/set_clip_region.rb +20 -0
- data/lib/emf/emf_plus/records/set_compositing_mode.rb +21 -0
- data/lib/emf/emf_plus/records/set_compositing_quality.rb +21 -0
- data/lib/emf/emf_plus/records/set_interpolation_mode.rb +21 -0
- data/lib/emf/emf_plus/records/set_page_transform.rb +25 -0
- data/lib/emf/emf_plus/records/set_pixel_offset_mode.rb +21 -0
- data/lib/emf/emf_plus/records/set_rendering_origin.rb +22 -0
- data/lib/emf/emf_plus/records/set_text_contrast.rb +24 -0
- data/lib/emf/emf_plus/records/set_text_rendering_hint.rb +21 -0
- data/lib/emf/emf_plus/records/set_ts_clip.rb +40 -0
- data/lib/emf/emf_plus/records/set_ts_graphics.rb +88 -0
- data/lib/emf/emf_plus/records/set_world_transform.rb +22 -0
- data/lib/emf/emf_plus/records/shape_flags.rb +23 -0
- data/lib/emf/emf_plus/records/translate_world_transform.rb +26 -0
- data/lib/emf/emf_plus/records/unknown.rb +20 -0
- data/lib/emf/emf_plus/records.rb +107 -0
- data/lib/emf/emf_plus/serializer.rb +9 -2
- data/lib/emf/emf_plus/stream/conformance.rb +68 -0
- data/lib/emf/emf_plus/stream/editor.rb +21 -0
- data/lib/emf/emf_plus/stream/emf_gap.rb +20 -0
- data/lib/emf/emf_plus/stream/link_index.rb +30 -0
- data/lib/emf/emf_plus/stream/rebuild.rb +47 -0
- data/lib/emf/emf_plus/stream/record_handle.rb +26 -0
- data/lib/emf/emf_plus/stream/segment.rb +70 -0
- data/lib/emf/emf_plus/stream.rb +153 -0
- data/lib/emf/emf_plus.rb +9 -0
- data/lib/emf/emr/binary/dib_header.rb +142 -0
- data/lib/emf/emr/binary/ext_text_out_fields.rb +43 -0
- data/lib/emf/emr/binary/extended_pen_buffers.rb +23 -0
- data/lib/emf/emr/binary/fast_fill.rb +1164 -0
- data/lib/emf/emr/binary/font.rb +159 -0
- data/lib/emf/emr/binary/lazy_utf16_array.rb +82 -0
- data/lib/emf/emr/binary/pack_plan.rb +144 -0
- data/lib/emf/emr/binary/pack_plan_check.rb +75 -0
- data/lib/emf/emr/binary/pack_plan_exact.rb +130 -0
- data/lib/emf/emr/binary/pack_plan_generate.rb +116 -0
- data/lib/emf/emr/binary/pack_plan_values.rb +92 -0
- data/lib/emf/emr/binary/palette_body.rb +19 -0
- data/lib/emf/emr/binary/palette_entry.rb +18 -0
- data/lib/emf/emr/binary/record.rb +33 -0
- data/lib/emf/emr/binary/records/alpha_blend.rb +43 -0
- data/lib/emf/emr/binary/records/angle_arc.rb +2 -2
- data/lib/emf/emr/binary/records/bit_blt.rb +14 -0
- data/lib/emf/emr/binary/records/color_correct_palette.rb +55 -1
- data/lib/emf/emr/binary/records/colormatch_to_target_w.rb +76 -1
- data/lib/emf/emr/binary/records/create_colorspace.rb +67 -1
- data/lib/emf/emr/binary/records/create_colorspace_w.rb +90 -1
- data/lib/emf/emr/binary/records/create_dib_pattern_brush_pt.rb +14 -0
- data/lib/emf/emr/binary/records/create_font_indirect_w.rb +6 -2
- data/lib/emf/emr/binary/records/create_mono_brush.rb +14 -0
- data/lib/emf/emr/binary/records/create_palette.rb +19 -1
- data/lib/emf/emr/binary/records/delete_colorspace.rb +22 -1
- data/lib/emf/emr/binary/records/draw_escape.rb +45 -1
- data/lib/emf/emr/binary/records/ellipse.rb +1 -1
- data/lib/emf/emr/binary/records/eof.rb +9 -0
- data/lib/emf/emr/binary/records/ext_create_pen.rb +80 -1
- data/lib/emf/emr/binary/records/ext_escape.rb +45 -1
- data/lib/emf/emr/binary/records/ext_flood_fill.rb +9 -2
- data/lib/emf/emr/binary/records/ext_select_clip_rgn.rb +9 -1
- data/lib/emf/emr/binary/records/ext_text_out_a.rb +16 -3
- data/lib/emf/emr/binary/records/ext_text_out_w.rb +14 -3
- data/lib/emf/emr/binary/records/fill_rgn.rb +11 -2
- data/lib/emf/emr/binary/records/force_ufi_mapping.rb +38 -1
- data/lib/emf/emr/binary/records/frame_rgn.rb +12 -2
- data/lib/emf/emr/binary/records/gls_bounded_record.rb +61 -1
- data/lib/emf/emr/binary/records/gls_record.rb +42 -1
- data/lib/emf/emr/binary/records/gradient_fill.rb +7 -0
- data/lib/emf/emr/binary/records/invert_rgn.rb +11 -3
- data/lib/emf/emr/binary/records/mask_blt.rb +66 -0
- data/lib/emf/emr/binary/records/named_escape.rb +78 -1
- data/lib/emf/emr/binary/records/paint_rgn.rb +11 -3
- data/lib/emf/emr/binary/records/pixel_format.rb +76 -1
- data/lib/emf/emr/binary/records/plg_blt.rb +66 -0
- data/lib/emf/emr/binary/records/poly_textout_a.rb +128 -1
- data/lib/emf/emr/binary/records/poly_textout_w.rb +128 -1
- data/lib/emf/emr/binary/records/raw.rb +3 -0
- data/lib/emf/emr/binary/records/realize_palette.rb +1 -0
- data/lib/emf/emr/binary/records/rectangle.rb +1 -1
- data/lib/emf/emr/binary/records/resize_palette.rb +16 -2
- data/lib/emf/emr/binary/records/round_rect.rb +2 -2
- data/lib/emf/emr/binary/records/select_palette.rb +1 -0
- data/lib/emf/emr/binary/records/set_color_adjustment.rb +136 -0
- data/lib/emf/emr/binary/records/set_colorspace.rb +22 -1
- data/lib/emf/emr/binary/records/set_dibits_to_device.rb +43 -0
- data/lib/emf/emr/binary/records/set_icm_profile_a.rb +71 -1
- data/lib/emf/emr/binary/records/set_icm_profile_w.rb +71 -1
- data/lib/emf/emr/binary/records/set_linked_ufis.rb +49 -1
- data/lib/emf/emr/binary/records/set_miter_limit.rb +1 -1
- data/lib/emf/emr/binary/records/set_palette_entries.rb +20 -2
- data/lib/emf/emr/binary/records/set_text_justification.rb +8 -2
- data/lib/emf/emr/binary/records/small_text_out.rb +55 -4
- data/lib/emf/emr/binary/records/stretch_blt.rb +14 -0
- data/lib/emf/emr/binary/records/stretch_dibits.rb +14 -0
- data/lib/emf/emr/binary/records/transparent_blt.rb +43 -0
- data/lib/emf/emr/binary/records.rb +4 -2
- data/lib/emf/emr/binary/region_data.rb +33 -0
- data/lib/emf/emr/binary/state_record_body.rb +33 -0
- data/lib/emf/emr/binary/thin_shell.rb +226 -0
- data/lib/emf/emr/binary/value_view/layout.rb +101 -0
- data/lib/emf/emr/binary/value_view/reader_source.rb +88 -0
- data/lib/emf/emr/binary/value_view.rb +173 -0
- data/lib/emf/emr/binary/variable_buffers.rb +87 -0
- data/lib/emf/emr/binary.rb +4 -0
- data/lib/emf/emr/filled_record.rb +77 -0
- data/lib/emf/emr/parser.rb +239 -50
- data/lib/emf/emr/serializer.rb +4 -5
- data/lib/emf/emr.rb +1 -0
- data/lib/emf/error.rb +24 -1
- data/lib/emf/model/diagnostic.rb +41 -0
- data/lib/emf/model/emr/header.rb +40 -1
- data/lib/emf/model/emr/records.rb +142 -6
- data/lib/emf/model/emr/wire_values.rb +43 -0
- data/lib/emf/model/emr.rb +1 -0
- data/lib/emf/model/geometry/color.rb +19 -1
- data/lib/emf/model/metafile.rb +22 -2
- data/lib/emf/model/wmf/bitmap_records.rb +155 -0
- data/lib/emf/model/wmf/brush_records.rb +45 -0
- data/lib/emf/model/wmf/dc_escape_records.rb +67 -0
- data/lib/emf/model/wmf/font_record.rb +40 -0
- data/lib/emf/model/wmf/geometry_records.rb +107 -0
- data/lib/emf/model/wmf/header.rb +36 -0
- data/lib/emf/model/wmf/object_records.rb +71 -0
- data/lib/emf/model/wmf/palette_records.rb +68 -0
- data/lib/emf/model/wmf/records.rb +247 -0
- data/lib/emf/model/wmf/region_records.rb +112 -0
- data/lib/emf/model/wmf/state_records.rb +188 -0
- data/lib/emf/model/wmf/text_records.rb +36 -0
- data/lib/emf/model/wmf.rb +11 -0
- data/lib/emf/model.rb +2 -0
- data/lib/emf/native/bitmap_fields.rb +58 -0
- data/lib/emf/native/diagnostic_contract.rb +39 -0
- data/lib/emf/native/diagnostics.rb +81 -0
- data/lib/emf/native/emf_plus_loader.rb +35 -0
- data/lib/emf/native/emf_plus_snapshot.rb +96 -0
- data/lib/emf/native/emf_plus_source.rb +20 -0
- data/lib/emf/native/emf_plus_stream.rb +150 -0
- data/lib/emf/native/fields.rb +369 -0
- data/lib/emf/native/font_fields.rb +87 -0
- data/lib/emf/native/gradient_fields.rb +23 -0
- data/lib/emf/native/header.rb +35 -0
- data/lib/emf/native/header_errors.rb +30 -0
- data/lib/emf/native/hydrator.rb +151 -0
- data/lib/emf/native/lazy_wire.rb +100 -0
- data/lib/emf/native/legacy_state_fields.rb +22 -0
- data/lib/emf/native/library_path.rb +68 -0
- data/lib/emf/native/loader.rb +120 -0
- data/lib/emf/native/palette_fields.rb +45 -0
- data/lib/emf/native/poly_text_fields.rb +116 -0
- data/lib/emf/native/resource_failure.rb +28 -0
- data/lib/emf/native/small_text_fields.rb +27 -0
- data/lib/emf/native/snapshot.rb +102 -0
- data/lib/emf/native/wmf_bitmap_fields.rb +58 -0
- data/lib/emf/native/wmf_brush_fields.rb +62 -0
- data/lib/emf/native/wmf_fields.rb +117 -0
- data/lib/emf/native/wmf_hydrator.rb +143 -0
- data/lib/emf/native/wmf_loading.rb +49 -0
- data/lib/emf/native/wmf_palette_fields.rb +60 -0
- data/lib/emf/native/wmf_region_fields.rb +92 -0
- data/lib/emf/native/wmf_rejection.rb +84 -0
- data/lib/emf/native/wmf_remaining_fields.rb +70 -0
- data/lib/emf/native/wmf_snapshot.rb +51 -0
- data/lib/emf/native/wmf_text_fields.rb +56 -0
- data/lib/emf/native.rb +61 -0
- data/lib/emf/parse_evidence.rb +57 -0
- data/lib/emf/resource_budget/bitmap.rb +66 -0
- data/lib/emf/resource_budget/gradient.rb +30 -0
- data/lib/emf/resource_budget/poly_text.rb +85 -0
- data/lib/emf/resource_budget.rb +382 -0
- data/lib/emf/resource_limits/emf_records.rb +130 -0
- data/lib/emf/resource_limits.rb +58 -0
- data/lib/emf/version.rb +1 -1
- data/lib/emf/visitors/dump.rb +4 -0
- data/lib/emf/visitors/stats.rb +6 -5
- data/lib/emf/wmf/binary.rb +150 -1
- data/lib/emf/wmf/bitmap_codec.rb +118 -0
- data/lib/emf/wmf/brush_codec.rb +102 -0
- data/lib/emf/wmf/dc_escape_codec.rb +75 -0
- data/lib/emf/wmf/dib.rb +187 -0
- data/lib/emf/wmf/embedded_emf.rb +137 -0
- data/lib/emf/wmf/escape_views.rb +89 -0
- data/lib/emf/wmf/evidence.rb +255 -0
- data/lib/emf/wmf/geometry_codec.rb +49 -0
- data/lib/emf/wmf/palette_codec.rb +85 -0
- data/lib/emf/wmf/parser.rb +147 -2
- data/lib/emf/wmf/recovery.rb +95 -0
- data/lib/emf/wmf/region_codec.rb +151 -0
- data/lib/emf/wmf/serializer.rb +164 -2
- data/lib/emf/wmf/text_codec.rb +123 -0
- data/lib/emf/wmf.rb +7 -0
- data/lib/emf.rb +13 -9
- metadata +287 -10
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bindata"
|
|
4
|
+
|
|
5
|
+
module Emf
|
|
6
|
+
module EmfPlus
|
|
7
|
+
module Records
|
|
8
|
+
module Primitives
|
|
9
|
+
# One EmfPlusInteger7 (2.2.2.21) or EmfPlusInteger15 (2.2.2.22). The
|
|
10
|
+
# first byte decides: high bit clear is a 7-bit value, set is a 15-bit
|
|
11
|
+
# value whose high byte comes first. The width is kept so it re-encodes.
|
|
12
|
+
class RelativeCoordinate < Body
|
|
13
|
+
endian :little
|
|
14
|
+
uint8 :lead
|
|
15
|
+
uint8 :low, onlyif: -> { lead.anybits?(0x80) }
|
|
16
|
+
|
|
17
|
+
def wide? = lead.anybits?(0x80)
|
|
18
|
+
|
|
19
|
+
def to_i
|
|
20
|
+
wide? ? sign_extend(((lead & 0x7F) << 8) | low, 15) : sign_extend(lead, 7)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def sign_extend(raw, bits)
|
|
26
|
+
raw.anybits?(1 << (bits - 1)) ? raw - (1 << bits) : raw
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bindata"
|
|
4
|
+
require "emf/binary/float32_le"
|
|
5
|
+
require "emf/emf_plus/records/primitives/bounded_array"
|
|
6
|
+
require "emf/emf_plus/records/primitives/character_range"
|
|
7
|
+
|
|
8
|
+
module Emf
|
|
9
|
+
module EmfPlus
|
|
10
|
+
module Records
|
|
11
|
+
module Primitives
|
|
12
|
+
# EmfPlusStringFormatData (2.2.2.44). Both arrays are sized by the
|
|
13
|
+
# parent EmfPlusStringFormat's TabStopCount and RangeCount.
|
|
14
|
+
class StringFormatData < Body
|
|
15
|
+
endian :little
|
|
16
|
+
mandatory_parameters :tab_stop_count, :range_count
|
|
17
|
+
bounded_array :tab_stops, type: :float32_le, element_size: 4, initial_length: :tab_stop_count
|
|
18
|
+
bounded_array :char_ranges, type: :character_range, element_size: 8, initial_length: :range_count
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bindata"
|
|
4
|
+
require "emf/binary/float32_le"
|
|
5
|
+
|
|
6
|
+
module Emf
|
|
7
|
+
module EmfPlus
|
|
8
|
+
module Records
|
|
9
|
+
module Primitives
|
|
10
|
+
# EmfPlusTransformMatrix (2.2.2.47): m11, m12, m21, m22, dx, dy.
|
|
11
|
+
class TransformMatrix < Body
|
|
12
|
+
endian :little
|
|
13
|
+
float32_le :m11
|
|
14
|
+
float32_le :m12
|
|
15
|
+
float32_le :m21
|
|
16
|
+
float32_le :m22
|
|
17
|
+
float32_le :dx
|
|
18
|
+
float32_le :dy
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# Shared EMF+ structures (MS-EMFPLUS 2.2.2). Record files require the ones
|
|
7
|
+
# they use; the autoloads let callers reach any of them directly.
|
|
8
|
+
module Primitives
|
|
9
|
+
autoload :ARGB, "emf/emf_plus/records/primitives/argb"
|
|
10
|
+
autoload :Bitmap, "emf/emf_plus/records/primitives/bitmap"
|
|
11
|
+
autoload :BitmapData, "emf/emf_plus/records/primitives/bitmap_data"
|
|
12
|
+
autoload :BlendColors, "emf/emf_plus/records/primitives/blend_colors"
|
|
13
|
+
autoload :BlendFactors, "emf/emf_plus/records/primitives/blend_factors"
|
|
14
|
+
autoload :ByteReader, "emf/emf_plus/records/primitives/byte_reader"
|
|
15
|
+
autoload :CharacterRange, "emf/emf_plus/records/primitives/character_range"
|
|
16
|
+
autoload :CompressedImage, "emf/emf_plus/records/primitives/compressed_image"
|
|
17
|
+
autoload :FocusScaleData, "emf/emf_plus/records/primitives/focus_scale_data"
|
|
18
|
+
autoload :GraphicsVersion, "emf/emf_plus/records/primitives/graphics_version"
|
|
19
|
+
autoload :LanguageIdentifier, "emf/emf_plus/records/primitives/language_identifier"
|
|
20
|
+
autoload :Metafile, "emf/emf_plus/records/primitives/metafile"
|
|
21
|
+
autoload :Palette, "emf/emf_plus/records/primitives/palette"
|
|
22
|
+
autoload :Path, "emf/emf_plus/records/primitives/path"
|
|
23
|
+
autoload :PathPointType, "emf/emf_plus/records/primitives/path_point_type"
|
|
24
|
+
autoload :PathPointTypeRLE, "emf/emf_plus/records/primitives/path_point_type_rle"
|
|
25
|
+
autoload :Point, "emf/emf_plus/records/primitives/point"
|
|
26
|
+
autoload :PointArray, "emf/emf_plus/records/primitives/point_array"
|
|
27
|
+
autoload :PointF, "emf/emf_plus/records/primitives/point_f"
|
|
28
|
+
autoload :PointR, "emf/emf_plus/records/primitives/point_r"
|
|
29
|
+
autoload :Rect, "emf/emf_plus/records/primitives/rect"
|
|
30
|
+
autoload :RectArray, "emf/emf_plus/records/primitives/rect_array"
|
|
31
|
+
autoload :RectF, "emf/emf_plus/records/primitives/rect_f"
|
|
32
|
+
autoload :RegionNode, "emf/emf_plus/records/primitives/region_node"
|
|
33
|
+
autoload :RegionNodeChildNodes, "emf/emf_plus/records/primitives/region_node_child_nodes"
|
|
34
|
+
autoload :RegionNodePath, "emf/emf_plus/records/primitives/region_node_path"
|
|
35
|
+
autoload :RelativeCoordinate, "emf/emf_plus/records/primitives/relative_coordinate"
|
|
36
|
+
autoload :StringFormatData, "emf/emf_plus/records/primitives/string_format_data"
|
|
37
|
+
autoload :TransformMatrix, "emf/emf_plus/records/primitives/transform_matrix"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusResetClip (2.3.1.2): no body; Flags are reserved.
|
|
7
|
+
class ResetClip < Base
|
|
8
|
+
TYPE = 0x4031
|
|
9
|
+
|
|
10
|
+
class ResetClipBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
end
|
|
13
|
+
BODY = ResetClipBody
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusResetWorldTransform (2.3.9.2): no body; Flags are unused.
|
|
7
|
+
class ResetWorldTransform < Base
|
|
8
|
+
TYPE = 0x402B
|
|
9
|
+
|
|
10
|
+
class ResetWorldTransformBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
end
|
|
13
|
+
BODY = ResetWorldTransformBody
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusRestore (2.3.7.4): restores the graphics state saved under StackIndex.
|
|
7
|
+
class Restore < Base
|
|
8
|
+
TYPE = 0x4026
|
|
9
|
+
|
|
10
|
+
class RestoreBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
uint32 :stack_index
|
|
13
|
+
end
|
|
14
|
+
BODY = RestoreBody
|
|
15
|
+
|
|
16
|
+
def stack_index = body.stack_index.to_i
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "emf/binary/float32_le"
|
|
4
|
+
|
|
5
|
+
module Emf
|
|
6
|
+
module EmfPlus
|
|
7
|
+
module Records
|
|
8
|
+
# EmfPlusRotateWorldTransform (2.3.9.3): rotation by angle degrees.
|
|
9
|
+
class RotateWorldTransform < Base
|
|
10
|
+
include PostMultiplyFlag
|
|
11
|
+
|
|
12
|
+
TYPE = 0x402F
|
|
13
|
+
|
|
14
|
+
class RotateWorldTransformBody < Body
|
|
15
|
+
endian :little
|
|
16
|
+
float32_le :angle
|
|
17
|
+
end
|
|
18
|
+
BODY = RotateWorldTransformBody
|
|
19
|
+
|
|
20
|
+
def angle = body.angle
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSave (2.3.7.5): saves the graphics state under StackIndex.
|
|
7
|
+
class Save < Base
|
|
8
|
+
TYPE = 0x4025
|
|
9
|
+
|
|
10
|
+
class SaveBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
uint32 :stack_index
|
|
13
|
+
end
|
|
14
|
+
BODY = SaveBody
|
|
15
|
+
|
|
16
|
+
def stack_index = body.stack_index.to_i
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "emf/binary/float32_le"
|
|
4
|
+
|
|
5
|
+
module Emf
|
|
6
|
+
module EmfPlus
|
|
7
|
+
module Records
|
|
8
|
+
# EmfPlusScaleWorldTransform (2.3.9.4): scaling by sx, sy.
|
|
9
|
+
class ScaleWorldTransform < Base
|
|
10
|
+
include PostMultiplyFlag
|
|
11
|
+
|
|
12
|
+
TYPE = 0x402E
|
|
13
|
+
|
|
14
|
+
class ScaleWorldTransformBody < Body
|
|
15
|
+
endian :little
|
|
16
|
+
float32_le :sx
|
|
17
|
+
float32_le :sy
|
|
18
|
+
end
|
|
19
|
+
BODY = ScaleWorldTransformBody
|
|
20
|
+
|
|
21
|
+
def sx = body.sx
|
|
22
|
+
def sy = body.sy
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSerializableObject (2.3.5.2): an image effect parameter block
|
|
7
|
+
# identified by GUID. Flags are unused.
|
|
8
|
+
class SerializableObject < Base
|
|
9
|
+
TYPE = 0x4038
|
|
10
|
+
|
|
11
|
+
class SerializableObjectBody < Body
|
|
12
|
+
endian :little
|
|
13
|
+
string :object_guid_bytes, length: 16
|
|
14
|
+
uint32 :buffer_size
|
|
15
|
+
string :buffer, read_length: :buffer_size
|
|
16
|
+
end
|
|
17
|
+
BODY = SerializableObjectBody
|
|
18
|
+
|
|
19
|
+
def buffer_size = body.buffer_size
|
|
20
|
+
def buffer = body.buffer.to_s
|
|
21
|
+
|
|
22
|
+
def effect = Effects.decode(self)
|
|
23
|
+
|
|
24
|
+
def object_guid
|
|
25
|
+
raw = body.object_guid_bytes.to_s
|
|
26
|
+
[raw[0, 4].reverse, raw[4, 2].reverse, raw[6, 2].reverse, raw[8, 2], raw[10, 6]]
|
|
27
|
+
.map { |part| part.unpack1("H*") }.join("-")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetAntiAliasMode (2.3.6.1): no body. Flags bit A turns
|
|
7
|
+
# anti-aliasing on; the next seven bits are the SmoothingMode value.
|
|
8
|
+
class SetAntiAliasMode < Base
|
|
9
|
+
TYPE = 0x401E
|
|
10
|
+
ANTI_ALIAS_FLAG = 0x0001
|
|
11
|
+
SMOOTHING_MODE_MASK = 0x00FE
|
|
12
|
+
|
|
13
|
+
class SetAntiAliasModeBody < Body
|
|
14
|
+
endian :little
|
|
15
|
+
end
|
|
16
|
+
BODY = SetAntiAliasModeBody
|
|
17
|
+
|
|
18
|
+
def flag_fields = { anti_alias: ANTI_ALIAS_FLAG, smoothing_mode: SMOOTHING_MODE_MASK }
|
|
19
|
+
|
|
20
|
+
def anti_alias? = flags.anybits?(ANTI_ALIAS_FLAG)
|
|
21
|
+
def smoothing_mode = (flags & SMOOTHING_MODE_MASK) >> 1
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetClipPath (2.3.1.3): combines the clip with the EmfPlusPath
|
|
7
|
+
# object named by the ObjectID flag byte. No body.
|
|
8
|
+
class SetClipPath < Base
|
|
9
|
+
include CombineModeFlags
|
|
10
|
+
|
|
11
|
+
TYPE = 0x4033
|
|
12
|
+
|
|
13
|
+
class SetClipPathBody < Body
|
|
14
|
+
endian :little
|
|
15
|
+
end
|
|
16
|
+
BODY = SetClipPathBody
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "emf/emf_plus/records/primitives/rect_f"
|
|
4
|
+
|
|
5
|
+
module Emf
|
|
6
|
+
module EmfPlus
|
|
7
|
+
module Records
|
|
8
|
+
# EmfPlusSetClipRect (2.3.1.4): combines the clip with ClipRect.
|
|
9
|
+
class SetClipRect < Base
|
|
10
|
+
include CombineModeFlags
|
|
11
|
+
|
|
12
|
+
TYPE = 0x4032
|
|
13
|
+
|
|
14
|
+
class SetClipRectBody < Body
|
|
15
|
+
endian :little
|
|
16
|
+
rect_f :clip_rect
|
|
17
|
+
end
|
|
18
|
+
BODY = SetClipRectBody
|
|
19
|
+
|
|
20
|
+
def clip_rect = body.clip_rect
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetClipRegion (2.3.1.5): combines the clip with the EmfPlusRegion
|
|
7
|
+
# object named by the ObjectID flag byte. No body.
|
|
8
|
+
class SetClipRegion < Base
|
|
9
|
+
include CombineModeFlags
|
|
10
|
+
|
|
11
|
+
TYPE = 0x4034
|
|
12
|
+
|
|
13
|
+
class SetClipRegionBody < Body
|
|
14
|
+
endian :little
|
|
15
|
+
end
|
|
16
|
+
BODY = SetClipRegionBody
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetCompositingMode (2.3.6.2): no body; the CompositingMode value is the low flag byte.
|
|
7
|
+
class SetCompositingMode < Base
|
|
8
|
+
TYPE = 0x4023
|
|
9
|
+
|
|
10
|
+
class SetCompositingModeBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
end
|
|
13
|
+
BODY = SetCompositingModeBody
|
|
14
|
+
|
|
15
|
+
def flag_fields = { compositing_mode: 0xFF }
|
|
16
|
+
|
|
17
|
+
def compositing_mode = flags & 0xFF
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetCompositingQuality (2.3.6.3): no body; the CompositingQuality value is the low flag byte.
|
|
7
|
+
class SetCompositingQuality < Base
|
|
8
|
+
TYPE = 0x4024
|
|
9
|
+
|
|
10
|
+
class SetCompositingQualityBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
end
|
|
13
|
+
BODY = SetCompositingQualityBody
|
|
14
|
+
|
|
15
|
+
def flag_fields = { compositing_quality: 0xFF }
|
|
16
|
+
|
|
17
|
+
def compositing_quality = flags & 0xFF
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetInterpolationMode (2.3.6.4): no body; the InterpolationMode value is the low flag byte.
|
|
7
|
+
class SetInterpolationMode < Base
|
|
8
|
+
TYPE = 0x4021
|
|
9
|
+
|
|
10
|
+
class SetInterpolationModeBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
end
|
|
13
|
+
BODY = SetInterpolationModeBody
|
|
14
|
+
|
|
15
|
+
def flag_fields = { interpolation_mode: 0xFF }
|
|
16
|
+
|
|
17
|
+
def interpolation_mode = flags & 0xFF
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "emf/binary/float32_le"
|
|
4
|
+
|
|
5
|
+
module Emf
|
|
6
|
+
module EmfPlus
|
|
7
|
+
module Records
|
|
8
|
+
# EmfPlusSetPageTransform (2.3.9.5): page_unit is the low Flags byte (UnitType).
|
|
9
|
+
class SetPageTransform < Base
|
|
10
|
+
TYPE = 0x4030
|
|
11
|
+
|
|
12
|
+
class SetPageTransformBody < Body
|
|
13
|
+
endian :little
|
|
14
|
+
float32_le :page_scale
|
|
15
|
+
end
|
|
16
|
+
BODY = SetPageTransformBody
|
|
17
|
+
|
|
18
|
+
def flag_fields = { page_unit: 0x00FF }
|
|
19
|
+
|
|
20
|
+
def page_unit = flags & 0x00FF
|
|
21
|
+
def page_scale = body.page_scale
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetPixelOffsetMode (2.3.6.5): no body; the PixelOffsetMode value is the low flag byte.
|
|
7
|
+
class SetPixelOffsetMode < Base
|
|
8
|
+
TYPE = 0x4022
|
|
9
|
+
|
|
10
|
+
class SetPixelOffsetModeBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
end
|
|
13
|
+
BODY = SetPixelOffsetModeBody
|
|
14
|
+
|
|
15
|
+
def flag_fields = { pixel_offset_mode: 0xFF }
|
|
16
|
+
|
|
17
|
+
def pixel_offset_mode = flags & 0xFF
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetRenderingOrigin (2.3.6.6). Flags are unused.
|
|
7
|
+
class SetRenderingOrigin < Base
|
|
8
|
+
TYPE = 0x401D
|
|
9
|
+
|
|
10
|
+
class SetRenderingOriginBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
int32 :x
|
|
13
|
+
int32 :y
|
|
14
|
+
end
|
|
15
|
+
BODY = SetRenderingOriginBody
|
|
16
|
+
|
|
17
|
+
def x = body.x.to_i
|
|
18
|
+
def y = body.y.to_i
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetTextContrast (2.3.6.7): no body. The low 12 flag bits hold
|
|
7
|
+
# the text gamma multiplied by 1000.
|
|
8
|
+
class SetTextContrast < Base
|
|
9
|
+
TYPE = 0x4020
|
|
10
|
+
CONTRAST_MASK = 0x0FFF
|
|
11
|
+
|
|
12
|
+
class SetTextContrastBody < Body
|
|
13
|
+
endian :little
|
|
14
|
+
end
|
|
15
|
+
BODY = SetTextContrastBody
|
|
16
|
+
|
|
17
|
+
def flag_fields = { text_contrast: CONTRAST_MASK }
|
|
18
|
+
|
|
19
|
+
def text_contrast = flags & CONTRAST_MASK
|
|
20
|
+
def gamma = text_contrast / 1000.0
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetTextRenderingHint (2.3.6.8): no body; the TextRenderingHint value is the low flag byte.
|
|
7
|
+
class SetTextRenderingHint < Base
|
|
8
|
+
TYPE = 0x401F
|
|
9
|
+
|
|
10
|
+
class SetTextRenderingHintBody < Body
|
|
11
|
+
endian :little
|
|
12
|
+
end
|
|
13
|
+
BODY = SetTextRenderingHintBody
|
|
14
|
+
|
|
15
|
+
def flag_fields = { text_rendering_hint: 0xFF }
|
|
16
|
+
|
|
17
|
+
def text_rendering_hint = flags & 0xFF
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Emf
|
|
4
|
+
module EmfPlus
|
|
5
|
+
module Records
|
|
6
|
+
# EmfPlusSetTSClip (2.3.8.1). Flag C selects 4-byte (compressed) or
|
|
7
|
+
# 8-byte rectangles. Only the 8-byte form (four INT16: x, y, width,
|
|
8
|
+
# height, the EmfPlusRect layout) is decoded into rectangles; the
|
|
9
|
+
# compressed byte stream stays raw in `rect_data`: the spec's scheme is
|
|
10
|
+
# 1-or-2 bytes per point, delta-coded against the previous rectangle,
|
|
11
|
+
# but it does not name the four coded values, the two-byte sign rule or
|
|
12
|
+
# the first rectangle's reference, and it contradicts itself by also
|
|
13
|
+
# fixing 4 bytes per rectangle.
|
|
14
|
+
class SetTSClip < Base
|
|
15
|
+
TYPE = 0x403A
|
|
16
|
+
COMPRESSED_FLAG = 0x8000
|
|
17
|
+
COUNT_MASK = 0x7FFF
|
|
18
|
+
|
|
19
|
+
class SetTSClipBody < Body
|
|
20
|
+
endian :little
|
|
21
|
+
mandatory_parameter :data_size
|
|
22
|
+
string :rect_data, read_length: :data_size
|
|
23
|
+
end
|
|
24
|
+
BODY = SetTSClipBody
|
|
25
|
+
|
|
26
|
+
def flag_fields = { compressed: COMPRESSED_FLAG, rect_count: COUNT_MASK }
|
|
27
|
+
|
|
28
|
+
def compressed? = flags.anybits?(COMPRESSED_FLAG)
|
|
29
|
+
def rect_count = flags & COUNT_MASK
|
|
30
|
+
def rect_data = body.rect_data.to_s
|
|
31
|
+
|
|
32
|
+
def rects
|
|
33
|
+
return [] if compressed?
|
|
34
|
+
|
|
35
|
+
rect_data.unpack("s<*").each_slice(4).first(rect_count)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|