Class SolidBrush
Namespace: Aspose.Imaging.Brushes
Assembly: Aspose.Imaging.dll (25.2.0)
מברשת סולידית מיועדת לציור מתמשך בצבע ספציפי. מחלקה זו אינה ניתנת להורשה.
public sealed class SolidBrush : Brush, IDisposable
ירושה
object ← DisposableObject ← Brush ← SolidBrush
מיישם
חברים מורשים
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()
דוגמאות
דוגמה זו משתמשת במחלקת Graphics כדי ליצור צורות פרימיטיביות על פני התמונה. כדי להדגים את הפעולה, הדוגמה יוצרת תמונה חדשה בפורמט PNG ומציירת צורות פרימיטיביות על פני התמונה באמצעות שיטות הציור המוצגות על ידי מחלקת 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.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);
//צייר בזר על ידי ציון האובייקט 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_Brushes_SolidBrush__ctor"></a> SolidBrush\(\)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.SolidBrush.
```csharp
public SolidBrush()
דוגמאות
דוגמה זו משתמשת במחלקת Graphics כדי ליצור צורות פרימיטיביות על פני התמונה. כדי להדגים את הפעולה, הדוגמה יוצרת תמונה חדשה בפורמט PNG ומציירת צורות פרימיטיביות על פני התמונה באמצעות שיטות הציור המוצגות על ידי מחלקת 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.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);
//צייר בזר על ידי ציון האובייקט 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_Brushes_SolidBrush__ctor_Aspose_Imaging_Color_"></a> SolidBrush\(Color\)
מאתחל מופע חדש של מחלקת Aspose.Imaging.Brushes.SolidBrush.
```csharp
public SolidBrush(Color color)
פרמטרים
color
Color
צבע המברשת הסולידית.
מאפיינים
Color
מקבל או מגדיר את צבע המברשת.
[JsonProperty]
public Color Color { get; set; }
ערך המאפיין
דוגמאות
דוגמה זו משתמשת במחלקת Graphics כדי ליצור צורות פרימיטיביות על פני התמונה. כדי להדגים את הפעולה, הדוגמה יוצרת תמונה חדשה בפורמט PNG ומציירת צורות פרימיטיביות על פני התמונה באמצעות שיטות הציור המוצגות על ידי מחלקת 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.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);
//צייר בזר על ידי ציון האובייקט 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();
}
}