Class: CTioga2::Graphics::Styles::LineStyle

Inherits:
BasicStyle
  • Object
show all
Defined in:
lib/ctioga2/graphics/styles/drawable.rb

Overview

This class represents a plain line style.

Direct Known Subclasses

StrokeStyle

Constant Summary

Constants inherited from BasicStyle

BasicStyle::AllStyles, BasicStyle::OldAttrAccessor

Instance Method Summary collapse

Methods inherited from BasicStyle

alias_for, aliases, attr_accessor, attribute_type, attribute_types, attributes, convert_string_hash, defined_aliases, deprecated_attribute, from_hash, inherited, #instance_variable_defined?, normalize_hash, normalize_in, normalize_out, options_hash, #set_from_hash, sub_style, sub_styles, #to_hash, typed_attribute, #update_from_other, #use_defaults_from

Instance Method Details

#draw_line(t, x1, y1, x2, y2) ⇒ Object

Draws a line according with this style



40
41
42
43
44
45
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 40

def draw_line(t, x1, y1, x2, y2)
  t.context do 
    set_stroke_style(t)
    t.stroke_line(x1, y1, x2, y2)
  end
end

#set_stroke_style(t) ⇒ Object

Sets the stroke style to a FigureMaker object, t.



34
35
36
37
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 34

def set_stroke_style(t)
  t.line_type = @style if @style
  t.line_width = @width if @width
end