Class: CTioga2::Graphics::Styles::FillStyle

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

Overview

A style that handles drawing a fill.

todo add ways to specify complex fills, such as patterned fills and so on. Those would use clipping the path and base themselves on the coordinates of the current frame.

todo more attributes ?

Direct Known Subclasses

CurveFillStyle

Constant Summary

Constants inherited from BasicStyle

BasicStyle::OldAttrAccessor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BasicStyle

attr_accessor, attributes, from_hash, #instance_variable_defined?, #set_from_hash, #to_hash, #update_from_other

Instance Attribute Details

#colorObject

The color.



106
107
108
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 106

def color
  @color
end

#transparencyObject

The transparency



109
110
111
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 109

def transparency
  @transparency
end

Instance Method Details

#do_fill(t) ⇒ Object

Does the actual filling step. Must be used within a context, as it quite messes up with many things. Must be called after a call to #setup_fill.



125
126
127
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 125

def do_fill(t)
  t.fill
end

#setup_fill(t) ⇒ Object

Sets up the parameters for the fill. Must be called before any path drawing.

warning You must call FillStyle#do_fill for filling. Directly calling FigureMaker#fill is not a good idea, as you lose all ‘hand-crafted’ fills !



117
118
119
120
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 117

def setup_fill(t)
  t.fill_color = @color if @color
  t.fill_transparency = @transparency if @transparency
end