Class: Postsvg::Translation::Handlers::LineHandler

Inherits:
Object
  • Object
show all
Extended by:
Shared
Defined in:
lib/postsvg/translation/handlers/line_handler.rb

Class Method Summary collapse

Methods included from Shared

emit_fill, emit_paint, emit_paint_setup, emit_stroke, emit_transform, expand_bbox

Class Method Details

.call(element, context) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/postsvg/translation/handlers/line_handler.rb', line 9

def self.call(element, context)
  context.emitter.emit(Model::Operators::GraphicsState::Gsave.new)
  emit_transform(element, context)
  emit_stroke(element, context)
  context.emitter.emit(Model::Operators::Path::Newpath.new)
  context.emitter.emit(Model::Operators::Path::Moveto.new(x: element.x1, y: element.y1))
  context.emitter.emit(Model::Operators::Path::Lineto.new(x: element.x2, y: element.y2))
  context.emitter.emit(Model::Operators::Painting::Stroke.new)
  context.emitter.emit(Model::Operators::GraphicsState::Grestore.new)
  expand_bbox(context, element.x1, element.y1, element.x2, element.y2)
end