You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: gradient.rb
    path of file: ./repos/shoes4/shoes-swt/lib/shoes/swt
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# Gradients are a little confusing, but don't let all the math below scare you.
# Here's the (relatively) simple explanation of what's going on.
#
# ::SWT::Pattern, the underlying class we use, defines a gradient by a starting
# and ending point. We account the angle into it by changing these points.
#
# To look right, the start/end points must be outside our shape! If not, then
# we get a hard line where the color resets without fading,
    
      def determine_args_based_on_angle(angle, left, top, width, height)
        x, y = calculate_x_and_y(angle, height, width)
        if angle >= 0 && angle < Math::PI * 0.5
          args = [left + width + x, top + height - y, left + width - x, top + height + y]
        elsif Math::PI * 0.5 <= angle && angle < Math::PI
          args = [left + width + y, top + height + x, left + width - y, top + height - x]
        elsif Math::PI <= angle && angle < Math::PI * 1.5
          args = [left + width - x, top + height + y, left + width + x, top + height - y]
        elsif Math::PI * 1.5 <= angle && angle < Math::PI * 2.0
          args = [left + width - y, top + height - x, left + width + y, top + height + x]
        end