Class: CTioga2::Graphics::Styles::MarkerStringStyle
- Inherits:
-
BasicStyle
- Object
- BasicStyle
- CTioga2::Graphics::Styles::MarkerStringStyle
- Defined in:
- lib/ctioga2/graphics/styles/texts.rb
Overview
The style for a string marker. Hmmm, this is somewhat redundant with TiogaPrimitiveCall::MarkerOptions and I don’t like that.
Constant Summary collapse
- MarkerOptions =
{ 'color' => 'color', 'stroke_color' => 'color', 'fill_color' => 'color', 'scale' => 'float', 'horizontal_scale' => 'float', 'vertical_scale' => 'float', 'angle' => 'float', 'justification' => 'justification', 'alignment' => 'alignment', }
Constants inherited from BasicStyle
Instance Attribute Summary collapse
-
#alignement ⇒ Object
The vertical alignment.
-
#angle ⇒ Object
The angle of the text.
-
#color ⇒ Object
Colors.
-
#fill_color ⇒ Object
Returns the value of attribute fill_color.
-
#font ⇒ Object
A number between 1 to 14 – a PDF font.
-
#horizontal_scale ⇒ Object
The horizontal scale of the text.
-
#justification ⇒ Object
The horizontal alignment.
-
#mode ⇒ Object
The rendering mode.
-
#scale ⇒ Object
The scale of the text.
-
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
-
#vertical_scale ⇒ Object
The vertical scale of the text.
Instance Method Summary collapse
-
#draw_string_marker(t, text, x, y) ⇒ Object
Draws the string marker at the given location.
-
#initialize ⇒ MarkerStringStyle
constructor
A new instance of MarkerStringStyle.
-
#real_vertical_scale ⇒ Object
Returns the true vertical scale of the marker.
Methods inherited from BasicStyle
attr_accessor, attributes, from_hash, #instance_variable_defined?, #set_from_hash, #to_hash, #update_from_other
Constructor Details
#initialize ⇒ MarkerStringStyle
Returns a new instance of MarkerStringStyle.
236 237 238 239 240 241 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 236 def initialize # It make sense to use both by default, as it would be # confusing to provide both fill_ and stroke_color that # don't have effects by default... @mode = Tioga::FigureConstants::FILL_AND_STROKE end |
Instance Attribute Details
#alignement ⇒ Object
The vertical alignment
220 221 222 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 220 def alignement @alignement end |
#angle ⇒ Object
The angle of the text
208 209 210 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 208 def angle @angle end |
#color ⇒ Object
Colors
226 227 228 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 226 def color @color end |
#fill_color ⇒ Object
Returns the value of attribute fill_color.
228 229 230 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 228 def fill_color @fill_color end |
#font ⇒ Object
A number between 1 to 14 – a PDF font
231 232 233 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 231 def font @font end |
#horizontal_scale ⇒ Object
The horizontal scale of the text
214 215 216 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 214 def horizontal_scale @horizontal_scale end |
#justification ⇒ Object
The horizontal alignment
223 224 225 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 223 def justification @justification end |
#mode ⇒ Object
The rendering mode.
234 235 236 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 234 def mode @mode end |
#scale ⇒ Object
The scale of the text
211 212 213 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 211 def scale @scale end |
#stroke_color ⇒ Object
Returns the value of attribute stroke_color.
227 228 229 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 227 def stroke_color @stroke_color end |
#vertical_scale ⇒ Object
The vertical scale of the text
217 218 219 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 217 def vertical_scale @vertical_scale end |
Instance Method Details
#draw_string_marker(t, text, x, y) ⇒ Object
Draws the string marker at the given location
245 246 247 248 249 250 251 252 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 245 def draw_string_marker(t, text, x, y) dict = self.to_hash dict['text'] = text dict['at'] = [x, y] # TODO ! dict['mode'] = t.show_marker(dict) end |
#real_vertical_scale ⇒ Object
Returns the true vertical scale of the marker
255 256 257 |
# File 'lib/ctioga2/graphics/styles/texts.rb', line 255 def real_vertical_scale return (@vertical_scale || 1.0) * (@scale || 1.0) end |