Class LinearGradientBrush

Class LinearGradientBrush

اسم الفضاء : Aspose.Imaging.Brushes تجميع: Aspose.Imaging.dll (25.4.0)

يغطي Aspose.Imaging.Brush مع درجة خطية لا يمكن إرث هذه الفئة.

[JsonObject(MemberSerialization.OptIn)]
public sealed class LinearGradientBrush : LinearGradientBrushBase, IDisposable

Inheritance

object DisposableObject Brush TransformBrush LinearGradientBrushBase LinearGradientBrush

Implements

IDisposable

الأعضاء الموروثين

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.LinearGradientBrush.

public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle, bool isAngleScalable)

Parameters

rect RectangleF

من المستطيل .

color1 Color

الألوان 1

color2 Color

اللون الثاني

angle float

من زاوية

isAngleScalable bool

إذا قمت بتحديد “الحقيقة” [إنه زاوية قابلة للتوسع].

LinearGradientBrush(العمود الفقري، اللون، اللون، البول)

يبدأ مثالًا جديدًا من فئة Aspose.Imaging.Brushes.LinearGradientBrush.

public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle, bool isAngleScalable)

Parameters

rect Rectangle

من المستطيل .

color1 Color

الألوان 1

color2 Color

اللون الثاني

angle float

من زاوية

isAngleScalable bool

إذا قمت بتحديد “الحقيقة” [إنه زاوية قابلة للتوسع].

LinearGradientBrush(RectangleF، اللون، اللون، السفينة)

يبدأ مثالًا جديدًا من فئة Aspose.Imaging.Brushes.LinearGradientBrush.

public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle)

Parameters

rect RectangleF

من المستطيل .

color1 Color

الألوان 1

color2 Color

اللون الثاني

angle float

من زاوية

LinearGradientBrush(اللون، اللون، اللون، اللون)

يبدأ مثالًا جديدًا من فئة Aspose.Imaging.Brushes.LinearGradientBrush.

public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle)

Parameters

rect Rectangle

من المستطيل .

color1 Color

الألوان 1

color2 Color

اللون الثاني

angle float

من زاوية

LinearGradientBrush(PointF، PointF، اللون، اللون)

يبدأ مثالًا جديدًا من فئة Aspose.Imaging.Brushes.LinearGradientBrush.

public LinearGradientBrush(PointF point1, PointF point2, Color color1, Color color2)

Parameters

point1 PointF

نقطة 1

point2 PointF

نقطة 2

color1 Color

الألوان 1

color2 Color

اللون الثاني

LinearGradientBrush(نقطة، نقطة، اللون، اللون)

يبدأ مثالًا جديدًا من فئة Aspose.Imaging.Brushes.LinearGradientBrush.

public LinearGradientBrush(Point point1, Point point2, Color color1, Color color2)

Parameters

point1 Point

نقطة 1

point2 Point

نقطة 2

color1 Color

الألوان 1

color2 Color

اللون الثاني

Examples

يظهر المثال التالي كيفية إنشاء نسخة على نطاق خفيف من الإطار الحالي وإضافته إلى صورة TIFF.

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.LinearGradientBrush مع المعلمات الافتراضية.اللون الأولي هو الأسود، اللون النهائي هو الأبيض، الزاوية هي 45 درجة، والمستطيل يقع في (0،0) مع الحجم (1،1).

public LinearGradientBrush()

Properties

Blend

يحصل أو يضع Aspose.Imaging.Blend الذي يحدد المواقف والعوامل التي تحدد فالوف المخصص للدرجة.

public Blend Blend { get; set; }

قيمة الممتلكات

Blend

EndColor

يحصل أو يحدد اللون النهائي.

public Color EndColor { get; set; }

قيمة الممتلكات

Color

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; }

قيمة الممتلكات

ColorBlend

LinearColors

يحصل أو يضع ألوان البداية والنهاية للدرجة.

[Obsolete("Use StartColor and EndColor properties instead.")]
[JsonIgnore]
public Color[] LinearColors { get; set; }

قيمة الممتلكات

Color [ ]

StartColor

يحصل أو يضع لون البداية.

public Color StartColor { get; set; }

قيمة الممتلكات

Color

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'.

 عربي