In Files

Parent

PathGradientBrush

A PathGradientBrush defines a blend of colours that follow the outline of a path. A central colour within the path is blended with a colour for the outline, or even a set of colours defined for each of the vertices (corners) of the path.

This can be used to give the appearance of a curved surface (e.g. a painted circle that looks like a sphere), through to incredibly complex "psychedelic" fills.

Public Class Methods

new(GraphicsPath) click to toggle source
new(Array)

Creates a new PathGradientBrush and defines the path that should be followed by the colours. Passing a GraphicsPath object uses the outline of the given path. Alternatively an Array containing a series of points may be given, where each point is an Array of two Floats giving the X and Y positions respectively.

By default, the centre of the path will be painted white, blending to black along the path's outline.

# File GUI_Classes.rb, line 1815
def self.new
  #DUMMY
end

Public Instance Methods

interpolationColors(Array) click to toggle source

This method allows a gradient to be defined that has more than two colours, each positioned at any point between the centre and the outline of the path.

The Array elements should each be two element Arrays each containing two values, first a Color object, then a Float between 0.0 and 1.0 to define that Color's position - 0.0 being the centre and 1.0 being the outline.

For example...

col1 = Color.new(255, 0, 0)
col2 = Color.new(0, 255, 0)
col3 = Color.new(0, 0, 255)
@my_gradient.interpolationColors([ [co1, 0.0], [col2, 0.5], [col3, 1.0] ])
# File GUI_Classes.rb, line 1945
def interpolationColors
  #DUMMY
end
resetTransform click to toggle source

Cancels any transformations applied by the rotateTransform, translateTransform and scaleTransform methods, returning the gradient to its original form.

# File GUI_Classes.rb, line 2016
def resetTransform
  #DUMMY
end
rotateTransform(angle) click to toggle source

Takes a Float giving an angle in degrees, and rotates the whole gradient by this amount (in degrees, going clockwise for positive values.)

# File GUI_Classes.rb, line 1983
def rotateTransform
  #DUMMY
end
scaleTransform(x, y) click to toggle source

Scales the whole gradient relative to the centre point of the original gradient. Each value is a Float, where a value of 1.0 represents the original scale of the gradient. The gradient can be scaled independently in the X and Y dimensions if two different values are given.

# File GUI_Classes.rb, line 2006
def scaleTransform
  #DUMMY
end
setBlend(Array) click to toggle source

This method allows the two originally set colours to be blended in any proportion at any point between the centre and the edge. The Array elements should be two element arrays, each containing two Float values between 0.0 and 1.0.

Each pair of values gives, first, a mix amount where 0.0 = colour1 and 1.0 = colour2. The second of each pair defines the position between the centre (0.0) and edge (1.0). For example...

my_gradient.setBlend( [ [0.0, 0.0], [1.0, 0.25], [0.5, 0.75], [1.0, 0.0] ] )
# File GUI_Classes.rb, line 1924
def setBlend
  #DUMMY
end
setBlendBellShape(focus, scale) click to toggle source

This method changes the way that the two originally specified colours are blended. The original colour1 will become the colour at both the outline and the centre, with colour2 positioned at some point in between, blending towards the two edges as a smooth mix (somewhat like light hitting a curved surface).

The focus argument is a Float between 0.0 and 1.0, and sets the position where the second colour will be most intense - 0.0 being the centre, and 1.0 being the edge.

The scale argument is also a Float between 0.0 to 1.0, and sets the intensity of the second colour at the focus point. When zero, the second colour will not appear at all. When 1.0 the second colour appears in its pure form at the focus point.

# File GUI_Classes.rb, line 1908
def setBlendTBellShape
  #DUMMY
end
setBlendTriangularShape(focus, scale) click to toggle source

This method changes the way that the two originally specified colours are blended. The original colour1 will become the colour at both the outline and the centre, with colour2 positioned at some point in between, blending towards the two edges as a linear mix.

The focus argument is a Float between 0.0 and 1.0, and sets the position where the second colour will be most intense - 0.0 being the centre, and 1.0 being the edge.

The scale argument is also a Float between 0.0 to 1.0, and sets the intensity of the second colour at the focus point. When zero, the second colour will not appear at all. When 1.0 the second colour appears in its pure form at the focus point.

# File GUI_Classes.rb, line 1887
def setBlendTriangularShape
  #DUMMY
end
setCenterPoint(x, y) click to toggle source

By default the gradient's centre will be the centre of the bounding box that contains all of the path's points. Using the setCenterPoint method this can be changed to any position.

The x and y co-ordinates are both Float values measured in the current grid units.

(NB - If you hail from the UK, watch out for the US spelling!)

# File GUI_Classes.rb, line 1961
def setCenterPoint
  #DUMMY
end
setCentreColor(Color) click to toggle source

Sets a new colour to use at the centre of the path that will blend with the colour or colours defined for the outline (black by default).

# File GUI_Classes.rb, line 1825
def setCentreColor
  #DUMMY
end
setFocusScale(x_scale, y_scale) click to toggle source

By default, the gradient is a smooth blend between the centre and the edge of the path. Changing the focus scale magnifies the size of the central area of the blend. The X and Y scales are both Float values, where a value of 1.0 represents the original scale.

# File GUI_Classes.rb, line 1973
def setFocusScale
  #DUMMY
end
setSurroundColours(Array) click to toggle source

Sets new colours to use along the outline of the path. The Array should contain Color objects. These are assigned to each point along the outline in sequence. If too many colours are given, the surplus ones are discarded. If too few are given, unnassigned points receive the last colour in the Array. Hence, if you give only a single element array, the whole outline will be the same colour.

All of these outline colours will blend with their nearest neighbours along the outline between them, and all of the resulting outline colours will blend with the centre colour.

# File GUI_Classes.rb, line 1843
def setSurroundColors
  #DUMMY
end
setWrapMode(Integer/String) click to toggle source

If an object is painted which lies outside of the path used to define the PathGradientBrush, the effect will be somewhat unpredictable. By setting the wrap mode, the gradient can be made to tile so that it can cover a larger area.

The wrapping mode can be set to reverse alternate tiles horizontally, vertically or both to help cover the joins between tiles.

The mode is set using either an Integer index, or a short String descriptor chosen from the following list...

  • 0 or "tile" -> Normal tiling.

  • 0 or "flipx" -> Tiling with alternate horizontal tiles flipped.

  • 0 or "flipy" -> Tiling with alternate vertical tiles flipped.

  • 0 or "flipxy" -> Tiling with flipping in both dimensions.

  • 0 or "notile" -> No tiling - the default.

# File GUI_Classes.rb, line 1866
def setWrapMode
  #DUMMY
end
translateTransform(x, y) click to toggle source

Shifts the whole gradient without rotation. Both x and y are Float values, and shift the gradient by the given amount. measured in grid units, along the x-axis, and y-axis respectively.

# File GUI_Classes.rb, line 1994
def translateTransform
  #DUMMY
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.