Sha256: a2cc615ac0b160ab87ac6b041b1ca45e7c7713c3b365b4925c099d5cb7407885

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

class Shoes
  module Swt
    class ArcPainter < Common::Painter
      def fill(graphics_context)
        if @obj.wedge?
          graphics_context.fill_arc(@obj.translate_left + @obj.element_left,
                                    @obj.translate_top + @obj.element_top,
                                    @obj.element_width,
                                    @obj.element_height,
                                    @obj.angle1, @obj.angle2 * -1)
        else
          path = ::Swt::Path.new(::Swt.display)
          path.add_arc(@obj.translate_left + @obj.element_left,
                       @obj.translate_top + @obj.element_top,
                       @obj.element_width,
                       @obj.element_height,
                       @obj.angle1, @obj.angle2 * -1)
          graphics_context.fill_path(path)
        end
      end

      def draw(graphics_context)
        sw = graphics_context.get_line_width
        if @obj.element_left && @obj.element_top && @obj.element_width && @obj.element_height
          graphics_context.draw_arc(@obj.translate_left + @obj.element_left + sw / 2,
                                    @obj.translate_top + @obj.element_top + sw / 2,
                                    @obj.element_width - sw,
                                    @obj.element_height - sw,
                                    @obj.angle1, @obj.angle2 * -1)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre7 lib/shoes/swt/arc_painter.rb