Class: Emfsvg::Translation::Handlers::EllipseHandler

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

Overview

Translate to EMR_ELLIPSE.

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/ellipse_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
# File 'lib/emfsvg/translation/handlers/ellipse_handler.rb', line 17

def translate(element, context)
  with_gdi_state(element, context) do
    box = context.rect_l(element.cx - element.rx, element.cy - element.ry,
                         element.cx + element.rx, element.cy + element.ry)
    context.emit(Emf::Emr::Binary::Records::Ellipse,
                 i_type: ELLIPSE, rcl_box: box)
  end
end