Class Pen
İsim alanı : Aspose.Imaging Toplantı: Aspose.Imaging.dll (25.4.0)
Bir nesneyi çizmek için kullanılan çizgiler, eğriler ve rakamlar tanımlar.
public class Pen : TransparencySupporter
Inheritance
object ← TransparencySupporter ← Pen
mirasçı üyeleri
TransparencySupporter.Equals(object) , TransparencySupporter.GetHashCode() , TransparencySupporter.Equals(TransparencySupporter) , TransparencySupporter.Opacity , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Bu örnek Pen nesnelerinin oluşturulmasını ve kullanıldığını gösterir. örnek yeni bir Görüntü oluşturur ve Görüntü yüzeyinde Rectangles çizir.
//Create an instance of BmpOptions and set its various properties
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;
//Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
//Second Boolean parameter determines if the file to be created IsTemporal or not
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);
//Create an instance of Image at specified Path
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//Create an instance of Graphics and initialize it with Image object
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear the Graphics sutface with White Color
graphics.Clear(Aspose.Imaging.Color.White);
//Create an instance of Pen with color Red and width 5
Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);
//Create an instance of HatchBrush and set its properties
Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
brush.ForegroundColor = Aspose.Imaging.Color.Red;
//Create an instance of Pen
//initialize it with HatchBrush object and width
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//Draw Rectangles by specifying Pen object
graphics.DrawRectangles(pen, new[]
{
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
});
//Draw Rectangles by specifying Pen object
graphics.DrawRectangles(brusedpen, new[]
{
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
});
// save all changes.
image.Save();
}
Constructors
Pen(Color)
Aspose.Imaging.Pen sınıfının yeni bir örneğini belirlenen renkle başlatır.
public Pen(Color color)
Parameters
color
Color
Bir Aspose.Imaging.Pen.Color yapısı bu Aspose.Imaging.Pen renk gösterir.
Pen(Renkler , Float)
Aspose.Imaging.Pen sınıfının yeni bir örneğini belirlenen Aspose.Imaging.Pen.Color ve Aspose.Imaging.Pen.Width özellikleri ile başlatır.
public Pen(Color color, float width)
Parameters
color
Color
Bir Aspose.Imaging.Pen.Color yapısı bu Aspose.Imaging.Pen renk gösterir.
width
float
Bu Aspose.Imaging.Pen genişliğini gösteren bir değer.
Examples
Bu örnek Pen nesnelerinin oluşturulmasını ve kullanıldığını gösterir. örnek yeni bir Görüntü oluşturur ve Görüntü yüzeyinde Rectangles çizir.
//Create an instance of BmpOptions and set its various properties
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;
//Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
//Second Boolean parameter determines if the file to be created IsTemporal or not
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\sample.bmp", false);
//Create an instance of Image at specified Path
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
//Create an instance of Graphics and initialize it with Image object
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear the Graphics sutface with White Color
graphics.Clear(Aspose.Imaging.Color.White);
//Create an instance of Pen with color Red and width 5
Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 5f);
//Create an instance of HatchBrush and set its properties
Aspose.Imaging.Brushes.HatchBrush brush = new Aspose.Imaging.Brushes.HatchBrush();
brush.BackgroundColor = Aspose.Imaging.Color.Wheat;
brush.ForegroundColor = Aspose.Imaging.Color.Red;
//Create an instance of Pen
//initialize it with HatchBrush object and width
Aspose.Imaging.Pen brusedpen = new Pen(brush, 5);
//Draw Rectangles by specifying Pen object
graphics.DrawRectangles(pen, new[]
{
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(210, 210), new Aspose.Imaging.Size(100, 100)),
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 110), new Aspose.Imaging.Size(100, 100)),
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 310), new Aspose.Imaging.Size(100, 100))
});
//Draw Rectangles by specifying Pen object
graphics.DrawRectangles(brusedpen, new[]
{
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(310, 110), new Aspose.Imaging.Size(100, 100)),
new Aspose.Imaging.Rectangle(new Aspose.Imaging.Point(110, 310), new Aspose.Imaging.Size(100, 100))
});
// save all changes.
image.Save();
}
Pen(Brush)
Aspose.Imaging.Pen sınıfının yeni bir örneğini belirlenen Aspose.Imaging.Pen.Brush ile başlatır.
public Pen(Brush brush)
Parameters
brush
Brush
Aspose.Imaging.Pen.Brush, bu Aspose.Imaging.Pen’in doldurma özelliklerini belirler.
Exceptions
brush’ is null.
Pen(Sürücü , Float)
Aspose.Imaging.Pen sınıfının yeni bir örneğini belirlenen Aspose.Imaging.Pen.Brush ve Aspose.Imaging.Pen.Width ile başlatır.
[JsonConstructor]
public Pen(Brush brush, float width)
Parameters
brush
Brush
Aspose.Imaging.Pen.Brush bu Aspose.Imaging.Pen özelliklerini belirler.
width
float
Yeni Aspose.Imaging.Pen’in genişliği
Exceptions
brush’ is null.
Properties
Alignment
Bu Aspose.Imaging.Pen için uyum sağlar veya ayarlar.
public PenAlignment Alignment { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.Alignment mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
Brush
Bu Aspose.Imaging.Pen’in özelliklerini belirleyen Aspose.Imaging.Pen’i alır veya ayarlar.
public Brush Brush { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.Brush mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
Color
Bu Aspose.Imaging.Pen renkini alır veya ayarlar.
public Color Color { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.Color mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
CompoundArray
Bir bileşen kalemini belirleyen bir dizi değer alır veya ayarlar. bir bileşen kalem paralel çizgilerden ve alanlardan oluşan bir bileşen çizgisini çekir.
public float[] CompoundArray { get; set; }
Mülkiyet Değer
float […]
Exceptions
Aspose.Imaging.Pen.CompoundArray mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
CustomEndCap
Bu Aspose.Imaging.Pen ile çizilen çizgilerin sonunda kullanmak için özel bir kap alır veya ayarlar.
public CustomLineCap CustomEndCap { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.CustomEndCap mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
CustomStartCap
Bu Aspose.Imaging.Pen ile çizilen çizgilerin başlangıcında kullanmak için özel bir kap alır veya ayarlar.
public CustomLineCap CustomStartCap { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.CustomStartCap mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
DashCap
Bu Aspose.Imaging.Pen ile çizilmiş çizgili çizgiler oluşturan çizgilerin sonunda kullanılan kap tarzını alır veya ayarlar.
public DashCap DashCap { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.DashCap mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
DashOffset
Bir çizginin başlangıcından bir çerçeve örneğinin başlangıcına kadar olan mesafeyi alır veya ayarlar.
public float DashOffset { get; set; }
Mülkiyet Değer
DashPattern
Alın veya bir dizi özel çubuklar ve alanlar ayarlayın.
public float[] DashPattern { get; set; }
Mülkiyet Değer
float […]
Exceptions
Aspose.Imaging.Pen.DashPattern mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
DashStyle
Bu Aspose.Imaging.Pen ile çizilmiş çizgiler için kullanılan tarzı alır veya ayarlar.
public DashStyle DashStyle { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.DashStyle mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
EndCap
Bu Aspose.Imaging.Pen ile çizilen çizgilerin sonunda kullanılan kap stilini alır veya ayarlar.
public LineCap EndCap { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.EndCap mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
LineJoin
Bu Aspose.Imaging.Pen ile çizilen iki aralıklı çizginin sonları için birleşme tarzını alır veya ayarlar.
public LineJoin LineJoin { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.LineJoin mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
MiterLimit
Bir köşede birleşme kalınlığının sınırını alır veya ayarlar.
public float MiterLimit { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.MiterLimit mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
PenType
Bu Aspose.Imaging.Pen ile çizilen çizgilerin tarzını alır.
[JsonIgnore]
public PenType PenType { get; }
Mülkiyet Değer
StartCap
Bu Aspose.Imaging.Pen ile çizilen çizgilerin başlangıcında kullanılan kap stilini alır veya ayarlar.
public LineCap StartCap { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.StartCap mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
Transform
Bu Aspose.Imaging.Pen için geometrik dönüşümün bir kopyasını alır veya koyar.
public Matrix Transform { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.Transform mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
Width
Bu Aspose.Imaging.Pen genişliğini, çizim için kullanılan Grafik nesnesinin birimlerinde alır veya ayarlar.
public float Width { get; set; }
Mülkiyet Değer
Exceptions
Aspose.Imaging.Pen.Width mülkiyeti, Aspose.Imaging.Pen sınıfı tarafından iade edilenler gibi değişmez bir Aspose.Imaging.Pen’e yerleştirilir.
Methods
Equals(nesne)
nesnelerin eşit olup olmadığını kontrol edin.
public override bool Equals(object obj)
Parameters
obj
object
Diğer nesne ise.
Returns
Eşitlik karşılaştırma sonuçları.
Equals(Pen)
nesnelerin eşit olup olmadığını kontrol edin.
protected bool Equals(Pen other)
Parameters
other
Pen
Diğer nesne ise.
Returns
Eşitlik karşılaştırma sonuçları.
GetHashCode()
Mevcut nesnenin hash kodu alın.
public override int GetHashCode()
Returns
Hash kodu ile ilgili.
MultiplyTransform(Matrix)
Bu Aspose.Imaging.Pen için dönüşüm matrisini belirtilen Aspose.Imaging.Matrix ile çoğaltır.
public void MultiplyTransform(Matrix matrix)
Parameters
matrix
Matrix
Aspose.Imaging.Matrix nesne ile dönüşüm matrisini çoğaltmak için.
MultiplyTransform(Matrix ve MatrixOrder)
Bu Aspose.Imaging.Pen için dönüşüm matrisini belirlenen Aspose.Imaging.Matrix ile belirlenen sırada çoğaltır.
public void MultiplyTransform(Matrix matrix, MatrixOrder order)
Parameters
matrix
Matrix
Aspose.Imaging.Matrix ile dönüşüm matrisini çoğaltmak için.
order
MatrixOrder
Çoğaltma işlemi gerçekleştirmek için hangi sırada.
ResetTransform()
Bu Aspose.Imaging.Pen için geometrik dönüşüm matrisini yeniden ayarlayın.
public void ResetTransform()
RotateTransform(Floransa)
Yerel geometrik dönüşümü belirlenen açıdan döndürür.Bu yöntem dönüşümü dönüşümü önler.
public void RotateTransform(float angle)
Parameters
angle
float
Dönüşün açısıdır.
RotateTransform(Sürücü, MatrixOrder)
Yerel geometrik dönüşümünü belirlenen köşede belirlenen sırada döndürür.
public void RotateTransform(float angle, MatrixOrder order)
Parameters
angle
float
Dönüşün açısıdır.
order
MatrixOrder
Aspose.Imaging.MatrixOrder, rotasyon matrisini eklemek veya önlemek için gerekli olup olmadığını belirtir.
ScaleTransform(Yüzme , Yüzme)
Yerel geometrik dönüşümün belirlenmiş faktörlerle ölçülmesi.Bu yöntem, ölçekleme matrisini dönüşümüne bağlar.
public void ScaleTransform(float sx, float sy)
Parameters
sx
float
X-axis yönünde dönüşümün ölçeklenmesi için faktör.
sy
float
Y-axis yönünde dönüşümün ölçeklenmesi için faktör.
ScaleTransform(Sürücü, Sürücü, MatrixOrder)
Yerel geometrik dönüşümünü belirlenen sırada belirtilen faktörlerle ölçün.
public void ScaleTransform(float sx, float sy, MatrixOrder order)
Parameters
sx
float
X-axis yönünde dönüşümün ölçeklenmesi için faktör.
sy
float
Y-axis yönünde dönüşümün ölçeklenmesi için faktör.
order
MatrixOrder
Aspose.Imaging.MatrixOrder, ölçekleme matrisini eklemek veya önlemek için gerekli olup olmadığını belirtir.
SetLineCap(LineCap, LineCap ve DashCap)
Bu Aspose.Imaging.Pen tarafından çizilen son çizgiler için kullanılan kap tarzını belirleyen değerleri ayarlayın.
public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
Parameters
startCap
LineCap
Aspose.Imaging.LineCap bu Aspose.Imaging.Pen ile çizilen çizgilerin başlangıcında kullanılması gereken kap tarzını temsil eder.
endCap
LineCap
Aspose.Imaging.LineCap bu Aspose.Imaging.Pen ile çizilen çizgilerin sonunda kullanılması gereken kap tarzını temsil eder.
dashCap
DashCap
Aspose.Imaging.LineCap bu Aspose.Imaging.Pen ile çizilmiş çizgilerin başında veya sonunda kullanılması gereken kap tarzını temsil eder.
TranslateTransform(Yüzme , Yüzme)
Yerel geometrik dönüşümü belirlenen boyutlara göre çevirir.Bu yöntem çeviriyi dönüşümüne bağlar.
public void TranslateTransform(float dx, float dy)
Parameters
dx
float
Çeviri değeri x.
dy
float
Y’de çevirinin değeri.
TranslateTransform(Sürücü, Sürücü, MatrixOrder)
Yerel geometrik dönüşümünü belirli boyutlara göre belirli sırada çevirir.
public void TranslateTransform(float dx, float dy, MatrixOrder order)
Parameters
dx
float
Çeviri değeri x.
dy
float
Y’de çevirinin değeri.
order
MatrixOrder
Çeviri uygulayacak sipariş (prepend veya append)