Class Pen
اسم الفضاء : Aspose.Imaging تجميع: Aspose.Imaging.dll (25.4.0)
تعريف كائن يستخدم لصياغة الخطوط والمنحنيات والأرقام.
public class Pen : TransparencySupporter
Inheritance
object ← TransparencySupporter ← Pen
الأعضاء الموروثين
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
هذا المثال يظهر كيفية إنشاء واستخدام كائنات القلم.المثال يخلق صورة جديدة ويرسم الزوايا الخلفية على سطح الصورة.
//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 مع اللون المحدد.
public Pen(Color color)
Parameters
color
Color
هيكل Aspose.Imaging.Pen.Color الذي يشير إلى لون هذا Aspose.Imaging.Pen.
Pen(الألوان , float)
يبدأ مثالًا جديدًا من فئة Aspose.Imaging.Pen مع خصائص Aspose.Imaging.Pen.Color و Aspose.Imaging.Pen.Width المحددة.
public Pen(Color color, float width)
Parameters
color
Color
هيكل Aspose.Imaging.Pen.Color الذي يشير إلى لون هذا Aspose.Imaging.Pen.
width
float
قيمة تشير إلى عرض هذا Aspose.Imaging.Pen.
Examples
هذا المثال يظهر كيفية إنشاء واستخدام كائنات القلم.المثال يخلق صورة جديدة ويرسم الزوايا الخلفية على سطح الصورة.
//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 مع Aspose.Imaging.Pen.Brush المحدد.
public Pen(Brush brush)
Parameters
brush
Brush
A Aspose.Imaging.Pen.Brush الذي يحدد خصائص ملء هذا Aspose.Imaging.Pen.
Exceptions
brush’ is null.
Pen(الفراولة، float)
يبدأ مثال جديد من فئة Aspose.Imaging.Pen مع الفئة المحددة Aspose.Imaging.Pen.Brush و Aspose.Imaging.Pen.Width.
[JsonConstructor]
public Pen(Brush brush, float width)
Parameters
brush
Brush
A Aspose.Imaging.Pen.Brush الذي يحدد خصائص هذا Aspose.Imaging.Pen.
width
float
العرض الجديد Aspose.Imaging.Pen.
Exceptions
brush’ is null.
Properties
Alignment
يحصل أو يضع التوافق لهذا Aspose.Imaging.Pen.
public PenAlignment Alignment { get; set; }
قيمة الممتلكات
Exceptions
يتم وضع خصائص Aspose.Imaging.Pen.Alignment على Aspose.Imaging.Pen غير قابل للتغيير ، مثل تلك التي تعودها فئة Aspose.Imaging.Pen.
Brush
يحصل أو يضع Aspose.Imaging.Pen.Brush الذي يحدد خصائص هذا Aspose.Imaging.Pen.
public Brush Brush { get; set; }
قيمة الممتلكات
Exceptions
يتم وضع خصائص Aspose.Imaging.Pen.Brush على Aspose.Imaging.Pen غير قابل للتغيير ، مثل تلك التي تعودها فئة Aspose.Imaging.Pen.
Color
يحصل أو يضع لون هذا Aspose.Imaging.Pen.
public Color Color { get; set; }
قيمة الممتلكات
Exceptions
يتم وضع خصائص Aspose.Imaging.Pen.Color على Aspose.Imaging.Pen غير قابل للتغيير ، مثل تلك التي تعودها فئة Aspose.Imaging.Pen.
CompoundArray
يحصل أو يضع مجموعة من القيم التي تحدد قلم مركب.قلم مركب يجذب خط مركب يتكون من خطوط ومساحات متوازية.
public float[] CompoundArray { get; set; }
قيمة الممتلكات
float [ ]
Exceptions
يتم وضع خصائص Aspose.Imaging.Pen.CompoundArray على Aspose.Imaging.Pen غير قابل للتغيير ، مثل تلك التي تعود من قبل فئة Aspose.Imaging.Pen.
CustomEndCap
يحصل أو يضع مقصورة مخصصة لاستخدامها في نهاية الخطوط التي تم سحبها مع هذا Aspose.Imaging.Pen.
public CustomLineCap CustomEndCap { get; set; }
قيمة الممتلكات
Exceptions
الممتلكات Aspose.Imaging.Pen.CustomEndCap يتم وضعها على Aspose.Imaging.Pen غير قابلة للتغيير، مثل تلك التي تعود من قبل فئة Aspose.Imaging.Pen.
CustomStartCap
يحصل أو يضع مقصورة مخصصة لاستخدامها في بداية الخطوط التي تم سحبها مع هذا Aspose.Imaging.Pen.
public CustomLineCap CustomStartCap { get; set; }
قيمة الممتلكات
Exceptions
تم تعيين Aspose.Imaging.Pen.CustomStartCap على Aspose.Imaging.Pen غير قابلة للتغيير ، مثل تلك التي تعودها فئة Aspose.Imaging.Pen.
DashCap
يحصل أو يضع أسلوب القبعة المستخدمة في نهاية الألواح التي تشكل خطوط القبعة التي تم سحبها مع هذا Aspose.Imaging.Pen.
public DashCap DashCap { get; set; }
قيمة الممتلكات
Exceptions
الممتلكات Aspose.Imaging.Pen.DashCap يتم وضعها على Aspose.Imaging.Pen غير قابلة للتغيير، مثل تلك التي تعود من قبل فئة Aspose.Imaging.Pen.
DashOffset
يحصل أو يحدد المسافة من بداية الخط إلى بداية نموذج الحبل.
public float DashOffset { get; set; }
قيمة الممتلكات
DashPattern
يحصل أو يضع مجموعة من الأقواس والمساحات المخصصة.
public float[] DashPattern { get; set; }
قيمة الممتلكات
float [ ]
Exceptions
يتم وضع خصائص Aspose.Imaging.Pen.DashPattern على Aspose.Imaging.Pen غير قابل للتغيير ، مثل تلك التي تعودها فئة Aspose.Imaging.Pen.
DashStyle
يحصل أو يضع النمط المستخدم للخطوط المطاطية المطاطية مع هذا Aspose.Imaging.Pen.
public DashStyle DashStyle { get; set; }
قيمة الممتلكات
Exceptions
تم تعيين Aspose.Imaging.Pen.DashStyle على Aspose.Imaging.Pen غير قابل للتغيير، مثل تلك التي تعود من قبل Aspose.Imaging.Pen فئة.
EndCap
يحصل أو يضع أسلوب القبعة المستخدمة في نهاية الخطوط التي تم سحبها مع هذا Aspose.Imaging.Pen.
public LineCap EndCap { get; set; }
قيمة الممتلكات
Exceptions
يتم وضع ملكية Aspose.Imaging.Pen.EndCap على Aspose.Imaging.Pen غير قابلة للتغيير ، مثل تلك التي تعود من قبل فئة Aspose.Imaging.Pen.
LineJoin
يحصل أو يضع نمط الانضمام إلى نهايات خطين متتاليين تم سحبهما مع هذا Aspose.Imaging.Pen.
public LineJoin LineJoin { get; set; }
قيمة الممتلكات
Exceptions
الممتلكات Aspose.Imaging.Pen.LineJoin يتم وضعها على Aspose.Imaging.Pen غير قابلة للتغيير، مثل تلك التي تعود من قبل الفئة Aspose.Imaging.Pen.
MiterLimit
يحصل أو يحدد الحد من سمك المرفق على زاوية معتدلة.
public float MiterLimit { get; set; }
قيمة الممتلكات
Exceptions
الممتلكات Aspose.Imaging.Pen.MiterLimit يتم تعيينها على Aspose.Imaging.Pen غير قابلة للتغيير، مثل تلك التي تعودها الفئة Aspose.Imaging.Pen.
PenType
احصل على نمط الخطوط التي تم سحبها مع هذا Aspose.Imaging.Pen.
[JsonIgnore]
public PenType PenType { get; }
قيمة الممتلكات
StartCap
يحصل أو يضع أسلوب القبعة المستخدمة في بداية الخطوط التي تم سحبها مع هذا Aspose.Imaging.Pen.
public LineCap StartCap { get; set; }
قيمة الممتلكات
Exceptions
يتم وضع ملكية Aspose.Imaging.Pen.StartCap على Aspose.Imaging.Pen غير قابلة للتغيير ، مثل تلك التي تعودها فئة Aspose.Imaging.Pen.
Transform
يحصل أو يضع نسخة من التحول الهندسي لهذا Aspose.Imaging.Pen.
public Matrix Transform { get; set; }
قيمة الممتلكات
Exceptions
يتم وضع خصائص Aspose.Imaging.Pen.Transform على Aspose.Imaging.Pen غير قابلة للتغيير ، مثل تلك التي تعود من قبل فئة Aspose.Imaging.Pen.
Width
يحصل أو يضع عرض هذا Aspose.Imaging.Pen، في وحدات من الكائن الرسومات المستخدمة للرسم.
public float Width { get; set; }
قيمة الممتلكات
Exceptions
الممتلكات Aspose.Imaging.Pen.Width يتم تعيينها على Aspose.Imaging.Pen غير قابلة للتغيير، مثل تلك التي تعودها الفئة Aspose.Imaging.Pen.
Methods
Equals(الموضوع)
تحقق مما إذا كانت الأشياء متساوية.
public override bool Equals(object obj)
Parameters
obj
object
الموضوع الآخر .
Returns
نتيجة مقارنة المساواة.
Equals(Pen)
تحقق مما إذا كانت الأشياء متساوية.
protected bool Equals(Pen other)
Parameters
other
Pen
الموضوع الآخر .
Returns
نتيجة مقارنة المساواة.
GetHashCode()
احصل على رمز الهاش من الكائن الحالي.
public override int GetHashCode()
Returns
كود الهاش .
MultiplyTransform(Matrix)
يضاعف ماتريكس التحول لهذا Aspose.Imaging.Pen بواسطة Aspose.Imaging.Matrix المحدد.
public void MultiplyTransform(Matrix matrix)
Parameters
matrix
Matrix
الكائن Aspose.Imaging.Matrix من خلالها لتضاعف ماتريكس التحول.
MultiplyTransform(ماتريكس MatrixOrder)
يضاعف ماتريكس التحول لهذا Aspose.Imaging.Pen بواسطة Aspose.Imaging.Matrix المحدد في الترتيب المحدد.
public void MultiplyTransform(Matrix matrix, MatrixOrder order)
Parameters
matrix
Matrix
Aspose.Imaging.Matrix من خلالها لتضاعف ماتريكس التحول.
order
MatrixOrder
الأوامر التي يتم فيها تنفيذ عملية التكاثر.
ResetTransform()
إعادة تعيين ماتريكس التحول الجيومترية لهذا Aspose.Imaging.Pen إلى الهوية.
public void ResetTransform()
RotateTransform(السفينة)
يدور التحول الجيومترية المحلية من خلال الزاوية المحددة.هذه الطريقة ترتبط بالدوران إلى التحول.
public void RotateTransform(float angle)
Parameters
angle
float
زاوية الدوران .
RotateTransform(الطائرات، MatrixOrder)
يدور التحول الهندسي المحلي من خلال الزاوية المحددة في الترتيب المحدد.
public void RotateTransform(float angle, MatrixOrder order)
Parameters
angle
float
زاوية الدوران .
order
MatrixOrder
Aspose.Imaging.MatrixOrder الذي يحدد ما إذا كان لتوصيل أو توصيل المصفوفة الدوارة.
ScaleTransform(السفينة، السفينة)
تقسيم التحول الجيومترية المحلية من خلال العوامل المحددة.هذه الطريقة تفرق المصفوفة على التحول.
public void ScaleTransform(float sx, float sy)
Parameters
sx
float
العامل الذي يوسع التحول في اتجاه المحور X.
sy
float
العامل الذي يوسع التحول في اتجاه y-axis.
ScaleTransform(السفينة، السفينة، MatrixOrder)
مقياس التحول الجيومترية المحلية من خلال العوامل المحددة في الترتيب المحدد.
public void ScaleTransform(float sx, float sy, MatrixOrder order)
Parameters
sx
float
العامل الذي يوسع التحول في اتجاه المحور X.
sy
float
العامل الذي يوسع التحول في اتجاه y-axis.
order
MatrixOrder
A Aspose.Imaging.MatrixOrder الذي يحدد ما إذا كان لتوصيل أو توصيل المصفوفة.
SetLineCap(LineCap، LineCap، DashCap)
قم بتعيين القيم التي تحدد نمط القبعة المستخدمة في خطوط النهاية التي تم سحبتها بواسطة هذا Aspose.Imaging.Pen.
public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
Parameters
startCap
LineCap
Aspose.Imaging.LineCap الذي يمثل النمط القصير لاستخدامها في بداية الخطوط التي تم سحبها مع هذا Aspose.Imaging.Pen.
endCap
LineCap
Aspose.Imaging.LineCap الذي يمثل النمط القصير لاستخدامها في نهاية الخطوط التي تم سحبها مع هذا Aspose.Imaging.Pen.
dashCap
DashCap
Aspose.Imaging.LineCap الذي يمثل النمط القصير لاستخدامها في بداية أو نهاية الخطوط المطاطية المطاطية مع هذا Aspose.Imaging.Pen.
TranslateTransform(السفينة، السفينة)
يترجم التحول الجيومترية المحلية حسب الأبعاد المحددة.هذه الطريقة تفرض الترجمة على التحول.
public void TranslateTransform(float dx, float dy)
Parameters
dx
float
قيمة الترجمة في x.
dy
float
قيمة الترجمة في y.
TranslateTransform(السفينة، السفينة، MatrixOrder)
ترجمة التحول الجيومترية المحلية حسب الأبعاد المحددة في الترتيب المحدد.
public void TranslateTransform(float dx, float dy, MatrixOrder order)
Parameters
dx
float
قيمة الترجمة في x.
dy
float
قيمة الترجمة في y.
order
MatrixOrder
أوامر (مرفقة أو مرفقة) التي تطبق فيها الترجمة.