LinearGradientBrush Class

Summary: Encapsulates a Brush with a linear gradient. This class cannot be inherited.

Module: aspose.psd.brushes

Full Name: aspose.psd.brushes.LinearGradientBrush

Inheritance: LinearGradientBrushBase

Aspose.PSD Version: 24.9.0

Constructors

NameDescription
LinearGradientBrush()Initializes a new instance of the LinearGradientBrush class with default parameters.
The starting color is black, the ending color is white, the angle is 45 degrees and the rectangle is located in (0,0) with size (1,1).
LinearGradientBrush(point1, point2, color1, color2)Initializes a new instance of the LinearGradientBrush class with the specified points and colors.
LinearGradientBrush(point1, point2, color1, color2)Initializes a new instance of the LinearGradientBrush class with the specified points and colors.
LinearGradientBrush(rect, color1, color2, angle)Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.
LinearGradientBrush(rect, color1, color2, angle)Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.
LinearGradientBrush(rect, color1, color2, angle, is_angle_scalable)Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.
LinearGradientBrush(rect, color1, color2, angle, is_angle_scalable)Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

Properties

NameTypeAccessDescription
anglefloatr/wGets or sets the gradient angle.
blendBlendr/wGets or sets a Blend that specifies positions and factors that define a custom falloff for the gradient.
disposedboolrGets a value indicating whether this instance is disposed.
end_colorColorr/wGets or sets the ending gradient color.
gamma_correctionboolr/wGets or sets a value indicating whether gamma correction is enabled for this LinearGradientBrushBase.
interpolation_colorsColorBlendr/wGets or sets a ColorBlend that defines a multicolor linear gradient.
is_angle_scalableboolr/wGets or sets a value indicating whether LinearGradientBrushBase.angle is changed during trasnformations with this LinearGradientBrushBase.
is_transform_changedboolrGets a value indicating whether transformations were changed in some way. For example setting the transformation matrix or
calling any of the methods altering the transformation matrix. The property is introduced for backward compatibility with GDI+.
linear_colorsColor[]r/wGets or sets the starting and ending colors of the gradient.
opacityfloatr/wGets or sets the brush opacity. The value should be between 0 and 1. Value of 0 means that brush is fully visible, value of 1 means the brush is fully opaque.
rectangleRectangleFr/wGets or sets a rectangular region that defines the starting and ending points of the gradient.
start_colorColorr/wGets or sets the starting gradient color.
transformMatrixr/wGets or sets a copy Matrix that defines a local geometric transform for this TransformBrush.
wrap_modeWrapModer/wGets or sets a WrapMode enumeration that indicates the wrap mode for this TransformBrush.

Methods

NameDescription
deep_clone()Creates a new deep clone of the current Brush.
multiply_transform(matrix)Multiplies the Matrix that represents the local geometric transform of this LinearGradientBrush by the specified Matrix by prepending the specified Matrix.
multiply_transform(matrix, order)Multiplies the Matrix that represents the local geometric transform of this LinearGradientBrush by the specified Matrix in the specified order.
reset_transform()Resets the TransformBrush.transform property to identity.
rotate_transform(angle)Rotates the local geometric transform by the specified amount. This method prepends the rotation to the transform.
rotate_transform(angle, order)Rotates the local geometric transform by the specified amount in the specified order.
scale_transform(sx, sy)Scales the local geometric transform by the specified amounts. This method prepends the scaling matrix to the transform.
scale_transform(sx, sy, order)Scales the local geometric transform by the specified amounts in the specified order.
set_blend_triangular_shape(focus)Creates a linear gradient with a center color and a linear falloff to a single color on both ends.
set_blend_triangular_shape(focus, scale)Creates a linear gradient with a center color and a linear falloff to a single color on both ends.
set_sigma_bell_shape(focus)Creates a gradient falloff based on a bell-shaped curve.
set_sigma_bell_shape(focus, scale)Creates a gradient falloff based on a bell-shaped curve.
translate_transform(dx, dy)Translates the local geometric transform by the specified dimensions. This method prepends the translation to the transform.
translate_transform(dx, dy, order)Translates the local geometric transform by the specified dimensions in the specified order.

Constructor: LinearGradientBrush()

 LinearGradientBrush() 

Initializes a new instance of the LinearGradientBrush class with default parameters.
The starting color is black, the ending color is white, the angle is 45 degrees and the rectangle is located in (0,0) with size (1,1).

Constructor: LinearGradientBrush(point1, point2, color1, color2)

 LinearGradientBrush(point1, point2, color1, color2) 

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

Parameters:

ParameterTypeDescription
point1PointA Point structure that represents the starting point of the linear gradient.
point2PointA Point structure that represents the endpoint of the linear gradient.
color1ColorA Color structure that represents the starting color of the linear gradient.
color2ColorA Color structure that represents the ending color of the linear gradient.

Constructor: LinearGradientBrush(point1, point2, color1, color2)

 LinearGradientBrush(point1, point2, color1, color2) 

Initializes a new instance of the LinearGradientBrush class with the specified points and colors.

Parameters:

ParameterTypeDescription
point1PointFA Point structure that represents the starting point of the linear gradient.
point2PointFA Point structure that represents the endpoint of the linear gradient.
color1ColorA Color structure that represents the starting color of the linear gradient.
color2ColorA Color structure that represents the ending color of the linear gradient.

Constructor: LinearGradientBrush(rect, color1, color2, angle)

 LinearGradientBrush(rect, color1, color2, angle) 

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

Parameters:

ParameterTypeDescription
rectRectangleA RectangleF structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
anglefloatThe angle, measured in degrees clockwise from the x-axis, of the gradient’s orientation line.

Constructor: LinearGradientBrush(rect, color1, color2, angle)

 LinearGradientBrush(rect, color1, color2, angle) 

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

Parameters:

ParameterTypeDescription
rectRectangleFA RectangleF structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
anglefloatThe angle, measured in degrees clockwise from the x-axis, of the gradient’s orientation line.

Constructor: LinearGradientBrush(rect, color1, color2, angle, is_angle_scalable)

 LinearGradientBrush(rect, color1, color2, angle, is_angle_scalable) 

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

Parameters:

ParameterTypeDescription
rectRectangleA RectangleF structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
anglefloatThe angle, measured in degrees clockwise from the x-axis, of the gradient’s orientation line.
is_angle_scalableboolif set to true the angle is changed during transformations with this LinearGradientBrush.

Constructor: LinearGradientBrush(rect, color1, color2, angle, is_angle_scalable)

 LinearGradientBrush(rect, color1, color2, angle, is_angle_scalable) 

Initializes a new instance of the LinearGradientBrush class based on a rectangle, starting and ending colors, and an orientation angle.

Parameters:

ParameterTypeDescription
rectRectangleFA RectangleF structure that specifies the bounds of the linear gradient.
color1ColorA Color structure that represents the starting color for the gradient.
color2ColorA Color structure that represents the ending color for the gradient.
anglefloatThe angle, measured in degrees clockwise from the x-axis, of the gradient’s orientation line.
is_angle_scalableboolif set to true the angle is changed during transformations with this LinearGradientBrush.

Method: deep_clone()

 deep_clone() 

Creates a new deep clone of the current Brush.

Returns

TypeDescription
BrushA new Brush which is the deep clone of this Brush instance.

Method: multiply_transform(matrix)

 multiply_transform(matrix) 

Multiplies the Matrix that represents the local geometric transform of this LinearGradientBrush by the specified Matrix by prepending the specified Matrix.

Parameters:

ParameterTypeDescription
matrixMatrixThe Matrix by which to multiply the geometric transform.

Method: multiply_transform(matrix, order)

 multiply_transform(matrix, order) 

Multiplies the Matrix that represents the local geometric transform of this LinearGradientBrush by the specified Matrix in the specified order.

Parameters:

ParameterTypeDescription
matrixMatrixThe Matrix by which to multiply the geometric transform.
orderMatrixOrderA MatrixOrder that specifies in which order to multiply the two matrices.

Method: rotate_transform(angle)

 rotate_transform(angle) 

Rotates the local geometric transform by the specified amount. This method prepends the rotation to the transform.

Parameters:

ParameterTypeDescription
anglefloatThe angle of rotation.

Method: rotate_transform(angle, order)

 rotate_transform(angle, order) 

Rotates the local geometric transform by the specified amount in the specified order.

Parameters:

ParameterTypeDescription
anglefloatThe angle of rotation.
orderMatrixOrderA MatrixOrder that specifies whether to append or prepend the rotation matrix.

Method: scale_transform(sx, sy)

 scale_transform(sx, sy) 

Scales the local geometric transform by the specified amounts. This method prepends the scaling matrix to the transform.

Parameters:

ParameterTypeDescription
sxfloatThe amount by which to scale the transform in the x-axis direction.
syfloatThe amount by which to scale the transform in the y-axis direction.

Method: scale_transform(sx, sy, order)

 scale_transform(sx, sy, order) 

Scales the local geometric transform by the specified amounts in the specified order.

Parameters:

ParameterTypeDescription
sxfloatThe amount by which to scale the transform in the x-axis direction.
syfloatThe amount by which to scale the transform in the y-axis direction.
orderMatrixOrderA MatrixOrder that specifies whether to append or prepend the scaling matrix.

Method: set_blend_triangular_shape(focus)

 set_blend_triangular_shape(focus) 

Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

Parameters:

ParameterTypeDescription
focusfloatA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).

Method: set_blend_triangular_shape(focus, scale)

 set_blend_triangular_shape(focus, scale) 

Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

Parameters:

ParameterTypeDescription
focusfloatA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
scalefloatA value from 0 through1 that specifies how fast the colors falloff from the starting color to (ending color)

Method: set_sigma_bell_shape(focus)

 set_sigma_bell_shape(focus) 

Creates a gradient falloff based on a bell-shaped curve.

Parameters:

ParameterTypeDescription
focusfloatA value from 0 through 1 that specifies the center of the gradient (the point where the starting color and ending color are blended equally).

Method: set_sigma_bell_shape(focus, scale)

 set_sigma_bell_shape(focus, scale) 

Creates a gradient falloff based on a bell-shaped curve.

Parameters:

ParameterTypeDescription
focusfloatA value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).
scalefloatA value from 0 through 1 that specifies how fast the colors falloff from the .

Method: translate_transform(dx, dy)

 translate_transform(dx, dy) 

Translates the local geometric transform by the specified dimensions. This method prepends the translation to the transform.

Parameters:

ParameterTypeDescription
dxfloatThe value of the translation in x.
dyfloatThe value of the translation in y.

Method: translate_transform(dx, dy, order)

 translate_transform(dx, dy, order) 

Translates the local geometric transform by the specified dimensions in the specified order.

Parameters:

ParameterTypeDescription
dxfloatThe value of the translation in x.
dyfloatThe value of the translation in y.
orderMatrixOrderThe order (prepend or append) in which to apply the translation.