Class Brush
Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)
מחלקת הבסיס עבור מברשות.
[JsonObject(MemberSerialization.OptIn)]
public abstract class Brush : DisposableObject, IDisposable
ירושה
object ← DisposableObject ← Brush
נגזרות
HatchBrush, SolidBrush, TransformBrush
מיישם
חברים מורשים
DisposableObject.Dispose(), DisposableObject.ReleaseManagedResources(), DisposableObject.ReleaseUnmanagedResources(), DisposableObject.VerifyNotDisposed(), DisposableObject.Disposed, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
בוני
Brush()
protected Brush()
מאפיינים
שקיפות
מקבל או קובע את שקיפות המברשת. הערך צריך להיות בין 0 ל-1. ערך של 0 משמעו שהמברשת נראית לחלוטין, ערך של 1 משמעו שהמברשת אטומה לחלוטין.
public float Opacity { get; set; }
ערך המאפיין
דוגמאות
דוגמה זו משתמשת במחלקת Graphics כדי ליצור צורות פרימיטיביות על פני התמונה. כדי להדגים את הפעולה, הדוגמה יוצרת תמונה חדשה בפורמט PNG ומציירת צורות פרימיטיביות על פני התמונה באמצעות שיטות Draw המוצגות על ידי מחלקת Graphics```csharp [C#]
//יוצר מופע של FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//יוצר מופע של PngOptions ומגדיר את המאפיינים השונים שלו
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//מגדיר את המקור עבור PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//יוצר מופע של Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//יוצר ומאתחל מופע של מחלקת Graphics
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//מנקה את פני השטח של Graphics
graphics.Clear(Aspose.Imaging.Color.Wheat);
//מצייר קשת על ידי ציון אובייקט Pen בצבע שחור,
//מלבן המקיף את הקשת, זווית התחלה וזווית סיבוב
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//מצייר Bezier על ידי ציון אובייקט Pen בצבע כחול ונקודות קואורדינטות.
graphics.DrawBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Point(250, 100), new Aspose.Imaging.Point(300, 30), new Aspose.Imaging.Point(450, 100), new Aspose.Imaging.Point(235, 25));
//מצייר עקומה על ידי ציון אובייקט Pen בצבע ירוק ומערך של נקודות
graphics.DrawCurve(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new[] { new Aspose.Imaging.Point(100, 200), new Aspose.Imaging.Point(100, 350), new Aspose.Imaging.Point(200, 450) });
//מצייר אליפסה באמצעות אובייקט Pen ומלבן המקיף
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//מצייר קו
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//מצייר קטע פאי
graphics.DrawPie(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Silver, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(200, 20), new Aspose.Imaging.Size(200, 200)), 0, 45);
//מצייר פוליגון על ידי ציון אובייקט Pen בצבע אדום ומערך של נקודות
graphics.DrawPolygon(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new[] { new Aspose.Imaging.Point(20, 100), new Aspose.Imaging.Point(20, 200), new Aspose.Imaging.Point(220, 20) });
//מצייר מלבן
graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 2), new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(250, 250), new Aspose.Imaging.Size(100, 100)));
//יוצר אובייקט SolidBrush ומגדיר את המאפיינים השונים שלו
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//מצייר מיתר באמצעות אובייקט SolidBrush וגופן, בנקודה ספציפית
graphics.DrawString("תמונה זו נוצרה על ידי Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
//שומר את כל השינויים.
image.Save();
}
}
## שיטות
### <a id="Aspose_Imaging_Brush_DeepClone"></a> DeepClone\(\)
יוצר קלון עמוק חדש של Aspose.Imaging.Brush הנוכחי.
```csharp
public virtual Brush DeepClone()
מחזיר
Aspose.Imaging.Brush חדש שהוא קלון עמוק של מופע זה של Aspose.Imaging.Brush.
Equals(object)
בודק אם האובייקטים שווים.
public override bool Equals(object obj)
פרמטרים
obj
object
האובייקט השני.
מחזיר
תוצאת השוואת השוויון.
Equals(Brush)
בודק אם האובייקטים שווים.
protected bool Equals(Brush other)
פרמטרים
other
Brush
האובייקט השני.
מחזיר
תוצאת השוואת השוויון.
GetHashCode()
מקבל את קוד ההשגחה של האובייקט הנוכחי.
public override int GetHashCode()
מחזיר
קוד ההשגחה.