Class: Emfsvg::Translation::Handlers::LineHandler

Inherits:
Object
  • Object
show all
Includes:
Emf::Emr::Binary::TypeCodes, SharedGdi
Defined in:
lib/emfsvg/translation/handlers/line_handler.rb

Overview

Translate to MoveToEx + LineTo.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SharedGdi

#clip_bounds_for, #emit_create_brush, #emit_create_pen, #emit_delete, #emit_restore_dc, #emit_save_dc, #with_gdi_state

Class Method Details

.call(element, context) ⇒ Object



13
14
15
# File 'lib/emfsvg/translation/handlers/line_handler.rb', line 13

def self.call(element, context)
  new.translate(element, context)
end

Instance Method Details

#translate(element, context) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/emfsvg/translation/handlers/line_handler.rb', line 17

def translate(element, context)
  with_gdi_state(element, context) do
    context.emit(Emf::Emr::Binary::Records::MoveToEx,
                 i_type: MOVETOEX,
                 origin: context.point_l(element.x1, element.y1))
    context.emit(Emf::Emr::Binary::Records::LineTo,
                 i_type: LINETO,
                 origin: context.point_l(element.x2, element.y2))
  end
end