Class Brush
Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)
Temel fırça sınıfı.
[JsonObject(MemberSerialization.OptIn)]
public abstract class Brush : DisposableObject, IDisposable
Miras
object ← DisposableObject ← Brush
Türemiş
HatchBrush, SolidBrush, TransformBrush
Uygular
Miras Alınan Üyeler
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()
Yapıcılar
Brush()
protected Brush()
Özellikler
Opacity
Fırça opaklığını alır veya ayarlar. Değer 0 ile 1 arasında olmalıdır. 0 değeri fırçanın tamamen görünür olduğunu, 1 değeri fırçanın tamamen opak olduğunu belirtir.
public float Opacity { get; set; }
Özellik Değeri
Örnekler
Bu örnek, Grafikler sınıfını kullanarak Resim yüzeyinde ilkel şekiller oluşturur. İşlemi göstermek için, örnek yeni bir PNG formatında Resim oluşturur ve Grafikler sınıfının sunduğu Çizim yöntemlerini kullanarak Resim yüzeyinde ilkel şekilleri çizer.```csharp [C#]
//FileStream'in bir örneğini oluşturur
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//PngOptions'in bir örneğini oluşturur ve çeşitli özelliklerini ayarlar
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//PngOptions için Kaynağı ayarlayın
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Resim'in bir örneğini oluşturun
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Grafikler sınıfının bir örneğini oluşturun ve başlatın
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Grafikler yüzeyini temizleyin
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Siyah renkli Kalem nesnesini belirterek bir Yay çizin,
//Yayın çevresindeki Dörtgen, Başlangıç Açısı ve Tarama Açısı
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Mavi renkli Kalem nesnesini ve koordinat noktalarını belirterek bir Bezier çizin.
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));
//Yeşil renkli Kalem nesnesini ve bir Dizi Noktayı belirterek bir Eğri çizin
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) });
//Kalem nesnesini ve çevresindeki Dörtgeni kullanarak bir Elips çizin
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Bir Çizgi çizin
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Bir Pasta dilimi çizin
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);
//Kırmızı renkli Kalem nesnesini ve bir Dizi Noktayı belirterek bir Çokgen çizin
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) });
//Bir Dörtgen çizin
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)));
//Bir SolidBrush nesnesi oluşturun ve çeşitli özelliklerini ayarlayın
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//SolidBrush nesnesi ve Font kullanarak, belirli bir Noktada bir Dize çizin
graphics.DrawString("Bu resim Aspose.Imaging API tarafından oluşturuldu", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
//tüm değişiklikleri kaydedin.
image.Save();
}
}
## Yöntemler
### <a id="Aspose_Imaging_Brush_DeepClone"></a> DeepClone\(\)
Mevcut Aspose.Imaging.Brush'ın yeni bir derin kopyasını oluşturur.
```csharp
public virtual Brush DeepClone()
Döner
Bu Aspose.Imaging.Brush örneğinin derin kopyası olan yeni bir Aspose.Imaging.Brush.
Equals(object)
Nesnelerin eşit olup olmadığını kontrol eder.
public override bool Equals(object obj)
Parametreler
obj
object
Diğer nesne.
Döner
Eşitlik karşılaştırma sonucu.
Equals(Brush)
Nesnelerin eşit olup olmadığını kontrol eder.
protected bool Equals(Brush other)
Parametreler
other
Brush
Diğer nesne.
Döner
Eşitlik karşılaştırma sonucu.
GetHashCode()
Mevcut nesnenin hash kodunu alır.
public override int GetHashCode()
Döner
Hash kodu.