Module: Shoes::Swt::Common::Fill

Defined in:
shoes-swt/lib/shoes/swt/common/fill.rb

Overview

Note:

Including classes must provide ‘#dsl`

Methods for retrieving fill values from a Shoes DSL class

Instance Method Summary collapse

Instance Method Details

#angleInteger

Returns the angle to use when filling with a pattern.

Returns:

  • (Integer)

    the angle to use when filling with a pattern



28
29
30
# File 'shoes-swt/lib/shoes/swt/common/fill.rb', line 28

def angle
  dsl.angle || 0
end

#apply_fill(context) ⇒ Object



37
38
39
40
41
42
# File 'shoes-swt/lib/shoes/swt/common/fill.rb', line 37

def apply_fill(context)
  return unless fill

  fill.apply_as_fill(context, self)
  true
end

#fillSwt::Graphics::Color

This object’s fill color

Returns:

  • (Swt::Graphics::Color)

    The Swt representation of this object’s fill color



13
14
15
16
17
18
# File 'shoes-swt/lib/shoes/swt/common/fill.rb', line 13

def fill
  return @cached_swt_fill if @cached_swt_fill

  @color_factory ||= ::Shoes::Swt::ColorFactory.new
  @cached_swt_fill = @color_factory.create(dsl.fill)
end

#fill_alphaInteger

This object’s fill alpha value

Returns:

  • (Integer)

    The alpha value of this object’s fill color (0-255)



23
24
25
# File 'shoes-swt/lib/shoes/swt/common/fill.rb', line 23

def fill_alpha
  fill.alpha
end

#update_fillObject

Just clear it out and let next paint recreate and save our SWT color



33
34
35
# File 'shoes-swt/lib/shoes/swt/common/fill.rb', line 33

def update_fill
  @cached_swt_fill = nil
end