Class LinearGradientBrush
Именује се: Aspose.Imaging.Brushes Асамблеја: Aspose.Imaging.dll (25.4.0)
Инкапсулише Aspose.Imaging.Бруш са линеарним градиентом. Ова класа се не може наследити.
[JsonObject(MemberSerialization.OptIn)]
public sealed class LinearGradientBrush : LinearGradientBrushBase, IDisposable
Inheritance
object ← DisposableObject ← Brush ← TransformBrush ← LinearGradientBrushBase ← LinearGradientBrush
Implements
Наслеђени чланови
LinearGradientBrushBase.Rectangle , LinearGradientBrushBase.Angle , LinearGradientBrushBase.IsAngleScalable , LinearGradientBrushBase.GammaCorrection , TransformBrush.ResetTransform() , TransformBrush.MultiplyTransform(Matrix) , TransformBrush.MultiplyTransform(Matrix, MatrixOrder) , TransformBrush.TranslateTransform(float, float) , TransformBrush.TranslateTransform(float, float, MatrixOrder) , TransformBrush.ScaleTransform(float, float) , TransformBrush.ScaleTransform(float, float, MatrixOrder) , TransformBrush.RotateTransform(float) , TransformBrush.RotateTransform(float, MatrixOrder) , TransformBrush.WrapMode , TransformBrush.Transform , TransformBrush.IsTransformChanged , Brush.DeepClone() , Brush.Equals(object) , Brush.GetHashCode() , Brush.Opacity , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
LinearGradientBrush(RectangleF, Боја, Боја, Флоат, Боол)
Иницијалише нову инстанцију класе Aspose.Imaging.Brushes.LinearGradientБруш.
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle, bool isAngleScalable)
Parameters
rect
RectangleF
То је правоугао.
color1
Color
Боја 1
color2
Color
Боја 2
angle
float
Угао је
isAngleScalable
bool
Ako je reč istinita,
LinearGradientBrush(правоугао, боја, боја, флот, боол)
Иницијалише нову инстанцију класе Aspose.Imaging.Brushes.LinearGradientБруш.
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle, bool isAngleScalable)
Parameters
rect
Rectangle
То је правоугао.
color1
Color
Боја 1
color2
Color
Боја 2
angle
float
Угао је
isAngleScalable
bool
Ako je reč istinita,
LinearGradientBrush(RectangleF, Боја, Боја, Флоат)
Иницијалише нову инстанцију класе Aspose.Imaging.Brushes.LinearGradientБруш.
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle)
Parameters
rect
RectangleF
То је правоугао.
color1
Color
Боја 1
color2
Color
Боја 2
angle
float
Угао је
LinearGradientBrush(правоугао, боја, боја, плута)
Иницијалише нову инстанцију класе Aspose.Imaging.Brushes.LinearGradientБруш.
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle)
Parameters
rect
Rectangle
То је правоугао.
color1
Color
Боја 1
color2
Color
Боја 2
angle
float
Угао је
LinearGradientBrush(ПоинтФ, ПоинтФ, Боја, Боја)
Иницијалише нову инстанцију класе Aspose.Imaging.Brushes.LinearGradientБруш.
public LinearGradientBrush(PointF point1, PointF point2, Color color1, Color color2)
Parameters
point1
PointF
Точка 1
point2
PointF
Точка 2.
color1
Color
Боја 1
color2
Color
Боја 2
LinearGradientBrush(Точка, тачка, боја и боја)
Иницијалише нову инстанцију класе Aspose.Imaging.Brushes.LinearGradientБруш.
public LinearGradientBrush(Point point1, Point point2, Color color1, Color color2)
Parameters
point1
Point
Точка 1
point2
Point
Точка 2.
color1
Color
Боја 1
color2
Color
Боја 2
Examples
Следећи пример показује како да се креира граискална копија постојећег оквира и додати га на слику ТИФФ-а.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Create a permanent, not temporary file source.
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// The linear gradient from the left-top to the right-bottom corner of the image.
Aspose.Imaging.Brushes.LinearGradientBrush brush =
new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(tiffImage.Width, tiffImage.Height),
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green);
// Fill the active frame with a linear gradient brush.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
gr.FillRectangle(brush, tiffImage.Bounds);
// Grayscale options
Aspose.Imaging.ImageOptions.TiffOptions createTiffFrameOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffFrameOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
createTiffFrameOptions.Photometric = Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
createTiffFrameOptions.BitsPerSample = new ushort[] { 8 };
// Create a grayscale copy of the active frame.
// The pixel data is preserved but converted to the desired format.
Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);
// Add the newly created frame to the TIFF image.
tiffImage.AddFrame(grayscaleFrame);
tiffImage.Save();
}
LinearGradientBrush()
Иницијалише нову инстанцију класе Aspose.Imaging.Brushes.LinearGradientБруш са подразумеваним параметрима.Почетна боја је црна, завршна боја је бела, угао је 45 степени, а правоугао се налази у (0,0) са величином (1,1).
public LinearGradientBrush()
Properties
Blend
Добија или поставља Aspose.Imaging.Blend који одређује положаје и факторе који дефинишу прилагођену фалофф за градијента.
public Blend Blend { get; set; }
Вредност имовине
EndColor
Добије или поставља завршну градијентну боју.
public Color EndColor { get; set; }
Вредност имовине
InterpolationColors
Добија или поставља Aspose.Imaging.ColorBlend који дефинише мултицветни линеарни градијент.
[Obsolete("This property is not used anymore in this class. Use instance of the LinearMulticolorGradientBrush class instead.")]
[JsonIgnore]
public ColorBlend InterpolationColors { get; set; }
Вредност имовине
LinearColors
Добија или поставља почетну и завршну боју градијента.
[Obsolete("Use StartColor and EndColor properties instead.")]
[JsonIgnore]
public Color[] LinearColors { get; set; }
Вредност имовине
Color []
StartColor
Добије или поставља почетну боју градијента.
public Color StartColor { get; set; }
Вредност имовине
Methods
SetBlendTriangularShape(Флоат)
Креира линеарни градијент са централном бојом и линеарном фаллофом до једне боје на оба краја.
public void SetBlendTriangularShape(float focus)
Parameters
focus
float
Вредност од 0 до 1 која одређује центар градијента (точка у којој се градијент састоји само од завршне боје).
SetBlendTriangularShape(пловила, пловила)
Креира линеарни градијент са централном бојом и линеарном фаллофом до једне боје на оба краја.
public void SetBlendTriangularShape(float focus, float scale)
Parameters
focus
float
Вредност од 0 до 1 која одређује центар градијента (точка у којој се градијент састоји само од завршне боје).
scale
float
Вредност од 0 до 1 која одређује колико брзо боје падају од почетне боје до focus’ (крајна боја)
SetSigmaBellShape(Флоат)
Креира градијент фаллоф на основу кривине у облику звона.
public void SetSigmaBellShape(float focus)
Parameters
focus
float
Вредност од 0 до 1 која одређује центар градиента (точка у којој се почетна и завршна боја мешају једнако).
SetSigmaBellShape(пловила, пловила)
Креира градијент фаллоф на основу кривине у облику звона.
public void SetSigmaBellShape(float focus, float scale)
Parameters
focus
float
Вредност од 0 до 1 која одређује центар градијента (точка у којој се градијент састоји само од завршне боје).
scale
float
Вредност од 0 до 1 која одређује колико брзо боје падају из focus'.