Class: Shoes::Swt::RectPainter
Constant Summary
Common::Painter::LINECAP
Common::Resource::OPAQUE
Instance Method Summary
collapse
#after_painted, #before_painted, #draw_setup, #drawing_bottom, #drawing_top, #fill_and_draw, #fill_setup, #initialize, #paint_control, #paint_object, #reset_rotate, #set_rotate
#clip_context_to, #dispose_previous_contexts, #reset_graphics_context, #set_defaults_on_context, #track_graphics_context
Instance Method Details
#draw(gc) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'shoes-swt/lib/shoes/swt/rect_painter.rb', line 15
def draw(gc)
stroke_width = gc.get_line_width
gc.draw_round_rectangle(@obj.translate_left + @obj.element_left + stroke_width / 2,
@obj.translate_top + drawing_top + stroke_width / 2,
@obj.element_width - stroke_width,
@obj.element_height - stroke_width,
@obj.corners * 2, @obj.corners * 2)
end
|
#fill(gc) ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'shoes-swt/lib/shoes/swt/rect_painter.rb', line 6
def fill(gc)
gc.fill_round_rectangle(@obj.translate_left + @obj.element_left + inset,
@obj.translate_top + drawing_top + inset,
@obj.element_width - inset * 2,
@obj.element_height - inset * 2,
@obj.corners * 2,
@obj.corners * 2)
end
|
#inset ⇒ Object
24
25
26
27
28
|
# File 'shoes-swt/lib/shoes/swt/rect_painter.rb', line 24
def inset
inset_fill? ? 1 : 0
end
|
#inset_fill? ⇒ Boolean
30
31
32
|
# File 'shoes-swt/lib/shoes/swt/rect_painter.rb', line 30
def inset_fill?
rounded? && strokewidth?
end
|
#rounded? ⇒ Boolean
34
35
36
|
# File 'shoes-swt/lib/shoes/swt/rect_painter.rb', line 34
def rounded?
(@obj.corners || 0).positive?
end
|
#strokewidth? ⇒ Boolean
38
39
40
|
# File 'shoes-swt/lib/shoes/swt/rect_painter.rb', line 38
def strokewidth?
(@obj.dsl.style[:strokewidth] || 0).positive?
end
|