Class: Shoes::Swt::OvalPainter

Inherits:
Common::Painter show all
Defined in:
shoes-swt/lib/shoes/swt/oval_painter.rb

Constant Summary

Constants inherited from Common::Painter

Common::Painter::LINECAP

Constants included from Common::Resource

Common::Resource::OPAQUE

Instance Method Summary collapse

Methods inherited from Common::Painter

#after_painted, #before_painted, #draw_setup, #drawing_bottom, #drawing_top, #fill_and_draw, #fill_setup, #initialize, #paint_control, #paint_object, #reset_rotate, #set_rotate

Methods included from Common::Resource

#clip_context_to, #dispose_previous_contexts, #reset_graphics_context, #set_defaults_on_context, #track_graphics_context

Constructor Details

This class inherits a constructor from Shoes::Swt::Common::Painter

Instance Method Details

#clippingObject



6
7
8
9
10
11
# File 'shoes-swt/lib/shoes/swt/oval_painter.rb', line 6

def clipping
  clipping = ::Swt::Path.new(Shoes.display)
  clipping.add_arc(@obj.element_left, drawing_top,
                   @obj.element_width, @obj.element_height, 0, 360)
  clipping
end

#draw(graphics_context) ⇒ Object



20
21
22
23
24
25
26
# File 'shoes-swt/lib/shoes/swt/oval_painter.rb', line 20

def draw(graphics_context)
  sw = graphics_context.get_line_width
  graphics_context.draw_oval(@obj.translate_left + @obj.element_left + sw / 2,
                             @obj.translate_top + drawing_top + sw / 2,
                             @obj.element_width - sw,
                             @obj.element_height - sw)
end

#fill(graphics_context) ⇒ Object



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

def fill(graphics_context)
  graphics_context.fill_oval(@obj.translate_left + @obj.element_left,
                             @obj.translate_top + drawing_top,
                             @obj.element_width,
                             @obj.element_height)
end