Class LinearGradientBrush
Namespace: Aspose.Imaging.Brushes
Assembly: Aspose.Imaging.dll (25.2.0)
מכיל את Aspose.Imaging.Brush עם גרדיאנט ליניארי. מחלקה זו אינה ניתנת להורשה.
[JsonObject(MemberSerialization.OptIn)]
public sealed class LinearGradientBrush : LinearGradientBrushBase, IDisposable
ירושה
object ← DisposableObject ← Brush ← TransformBrush ← LinearGradientBrushBase ← LinearGradientBrush
מיישם
חברים שהורשו
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()
קונסטרקטורים
LinearGradientBrush(RectangleF, Color, Color, float, bool)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.LinearGradientBrush.
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle, bool isAngleScalable)
פרמטרים
rect
RectangleF
המלבן.
color1
Color
הצבע1.
color2
Color
הצבע2.
angle
float
הזווית.
isAngleScalable
bool
אם מוגדר ל-```cstrue [האם הזווית ניתנת להרחבה].
LinearGradientBrush(Rectangle, Color, Color, float, bool)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.LinearGradientBrush.
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle, bool isAngleScalable)
פרמטרים
rect
Rectangle
המלבן.
color1
Color
הצבע1.
color2
Color
הצבע2.
angle
float
הזווית.
isAngleScalable
bool
אם מוגדר ל-```cstrue [האם הזווית ניתנת להרחבה].
LinearGradientBrush(RectangleF, Color, Color, float)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.LinearGradientBrush.
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle)
פרמטרים
rect
RectangleF
המלבן.
color1
Color
הצבע1.
color2
Color
הצבע2.
angle
float
הזווית.
LinearGradientBrush(Rectangle, Color, Color, float)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.LinearGradientBrush.
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle)
פרמטרים
rect
Rectangle
המלבן.
color1
Color
הצבע1.
color2
Color
הצבע2.
angle
float
הזווית.
LinearGradientBrush(PointF, PointF, Color, Color)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.LinearGradientBrush.
public LinearGradientBrush(PointF point1, PointF point2, Color color1, Color color2)
פרמטרים
point1
PointF
הנקודה1.
point2
PointF
הנקודה2.
color1
Color
הצבע1.
color2
Color
הצבע2.
LinearGradientBrush(Point, Point, Color, Color)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.LinearGradientBrush.
public LinearGradientBrush(Point point1, Point point2, Color color1, Color color2)
פרמטרים
point1
Point
הנקודה1.
point2
Point
הנקודה2.
color1
Color
הצבע1.
color2
Color
הצבע2.
דוגמאות
הדוגמה הבאה מראה כיצד ליצור העתק בגוון אפור של מסגרת קיימת ולהוסיף אותה לתמונה TIFF.```csharp [C#]
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// ליצור מקור קובץ קבוע, לא זמני.
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))
{
// הגרדיאנט הליניארי מהפינה השמאלית-עליון לפינה הימנית-תחתון של התמונה.
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);
// ממלא את המסגרת הפעילה עם מברשת גרדיאנט ליניארי.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
gr.FillRectangle(brush, tiffImage.Bounds);
// אפשרויות גוון אפור
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 };
// ליצור העתק בגוון אפור של המסגרת הפעילה.
// נתוני הפיקסל נשמרים אך מומרות לפורמט הרצוי.
Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);
// להוסיף את המסגרת החדשה שנוצרה לתמונה TIFF.
tiffImage.AddFrame(grayscaleFrame);
tiffImage.Save();
}
### <a id="Aspose_Imaging_Brushes_LinearGradientBrush__ctor"></a> LinearGradientBrush\(\)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.LinearGradientBrush עם פרמטרים ברירת מחדל.
הצבע ההתחלתי הוא שחור, הצבע הסופי הוא לבן, הזווית היא 45 מעלות והמלבן ממוקם ב-(0,0) בגודל (1,1).
```csharp
public LinearGradientBrush()
מאפיינים
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; }
ערך המאפיין
שיטות
SetBlendTriangularShape(float)
יוצר גרדיאנט ליניארי עם צבע מרכזי וירידה ליניארית לצבע יחיד בשני הקצוות.
public void SetBlendTriangularShape(float focus)
פרמטרים
focus
float
ערך בין 0 ל-1 שמפרט את מרכז הגרדיאנט (הנקודה שבה הגרדיאנט מורכב רק מהצבע הסופי).
SetBlendTriangularShape(float, float)
יוצר גרדיאנט ליניארי עם צבע מרכזי וירידה ליניארית לצבע יחיד בשני הקצוות.
public void SetBlendTriangularShape(float focus, float scale)
פרמטרים
focus
float
ערך בין 0 ל-1 שמפרט את מרכז הגרדיאנט (הנקודה שבה הגרדיאנט מורכב רק מהצבע הסופי).
scale
float
ערך בין 0 ל-1 שמפרט עד כמה מהר הצבעים יורדים מהצבע ההתחלתי ל-focus
(הצבע הסופי)
SetSigmaBellShape(float)
יוצר ירידת גרדיאנט בהתבסס על עקומת פעמון.
public void SetSigmaBellShape(float focus)
פרמטרים
focus
float
ערך בין 0 ל-1 שמפרט את מרכז הגרדיאנט (הנקודה שבה הצבע ההתחלתי והצבע הסופי מעורבים באופן שווה).
SetSigmaBellShape(float, float)
יוצר ירידת גרדיאנט בהתבסס על עקומת פעמון.
public void SetSigmaBellShape(float focus, float scale)
פרמטרים
focus
float
ערך בין 0 ל-1 שמפרט את מרכז הגרדיאנט (הנקודה שבה הגרדיאנט מורכב רק מהצבע הסופי).
scale
float
ערך בין 0 ל-1 שמפרט עד כמה מהר הצבעים יורדים מה-focus
.