Sha256: 74eac2eeae8ca830ced5738b8fccb43962866a2757b6ac9d221300d9338e52e2

Contents?: true

Size: 957 Bytes

Versions: 2

Compression:

Stored size: 957 Bytes

Contents

module Savage
  module Directions
    class ArcTo < PointTarget
      attr_accessor :radius, :rotation, :large_arc, :sweep

      def initialize(radius_x, radius_y, rotation, large_arc, sweep, target_x, target_y, absolute=true)
        super(target_x, target_y, absolute)
        @radius = Point.new(radius_x, radius_y)
        @rotation = rotation
        @large_arc = large_arc.is_a?(Numeric) ? large_arc > 0 : large_arc
        @sweep = sweep.is_a?(Numeric) ? sweep > 0 : sweep
      end

      def to_a
        [command_code, @radius.x, @radius.y, @rotation, bool_to_int(@large_arc), bool_to_int(@sweep), target.x, target.y]
      end

      def command_code
        (absolute?) ? 'A' : 'a'
      end

      def transform(scale_x, skew_x, skew_y, scale_y, tx, ty)
        # relative arc_to dont't need to be tranlated
        tx = ty = 0 if relative?
        transform_dot( target,  scale_x, skew_x, skew_y, scale_y, tx, ty)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
text2path-0.0.2 lib/ext/savage/lib/savage/directions/arc_to.rb
text2path-0.0.1 lib/ext/savage/lib/savage/directions/arc_to.rb