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

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

Overview

TODO:

This class should also provide image-based fills, with

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 ?

CSS-like capacities (scaling, tiling, centering, and so on…)

Direct Known Subclasses

CurveFillStyle

Constant Summary

Constants inherited from BasicStyle

BasicStyle::AllStyles, BasicStyle::OldAttrAccessor

Instance Method Summary collapse

Methods inherited from BasicStyle

alias_for, attr_accessor, attribute_type, attribute_types, attributes, deprecated_attribute, from_hash, inherited, #instance_variable_defined?, options_hash, #set_from_hash, sub_style, sub_styles, #to_hash, typed_attribute, #update_from_other

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.



145
146
147
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 145

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 !



137
138
139
140
# File 'lib/ctioga2/graphics/styles/drawable.rb', line 137

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