class CTioga2::Graphics::Styles::FillStyle

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 – or more nicely use dimensions ? (which would allow to mix both to some extent ?)

todo more attributes ?

@todo This class should also provide image-based fills, with CSS-like capacities (scaling, tiling, centering, and so on…)

Public Instance Methods

do_fill(t) click to toggle source

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.

# File lib/ctioga2/graphics/styles/fill.rb, line 246
def do_fill(t)
  if @pattern  && @color
    t.clip
    @pattern.do(t, @color)
  else
    t.fill
  end
end
setup_fill(t) click to toggle source

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 !

# File lib/ctioga2/graphics/styles/fill.rb, line 236
def setup_fill(t)
  if ! @pattern
    t.fill_color = @color if @color
    t.fill_transparency = @transparency if @transparency
  end
end