Class Pen
Název místa: Aspose.Imaging Shromáždění: Aspose.Imaging.dll (25.4.0)
Definuje objekt, který se používá k kreslení linií, obvodů a čísel.
public class Pen : TransparencySupporter
Inheritance
object ← TransparencySupporter ← Pen
Dědiční členové
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
Tento příklad ukazuje vytváření a používání penových objektů. Příklad vytváří nový obrázek a vytváří Rectangles na povrchu obrazu.
//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)
Začíná nový příklad třídy Aspose.Imaging.Pen s uvedenou barvou.
public Pen(Color color)
Parameters
color
Color
Aspose.Imaging.Pen.Color struktura, která naznačuje barvu tohoto Aspose.Imaging.Pen.
Pen(Barva a float)
Začíná nový příklad třídy Aspose.Imaging.Pen s specifikovanými vlastnostmi Aspose.Imaging.Pen.Color a Aspose.Imaging.Pen.Width.
public Pen(Color color, float width)
Parameters
color
Color
Aspose.Imaging.Pen.Color struktura, která naznačuje barvu tohoto Aspose.Imaging.Pen.
width
float
Hodnotu, která naznačuje šířku tohoto Aspose.Imaging.Pen.
Examples
Tento příklad ukazuje vytváření a používání penových objektů. Příklad vytváří nový obrázek a vytváří Rectangles na povrchu obrazu.
//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)
Začíná nový příklad třídy Aspose.Imaging.Pen s specifikovanou třídou Aspose.Imaging.Pen.Brush.
public Pen(Brush brush)
Parameters
brush
Brush
Aspose.Imaging.Pen.Brush, který určuje plné vlastnosti tohoto Aspose.Imaging.Pen.
Exceptions
brush’ is null.
Pen(Bruslík, float)
Začíná nový příklad třídy Aspose.Imaging.Pen s specifikovanou třídou Aspose.Imaging.Pen.Brush a Aspose.Imaging.Pen.Width.
[JsonConstructor]
public Pen(Brush brush, float width)
Parameters
brush
Brush
Aspose.Imaging.Pen.Brush, který určuje charakteristiky tohoto Aspose.Imaging.Pen.
width
float
Rozsah nového Aspose.Imaging.Pen.
Exceptions
brush’ is null.
Properties
Alignment
Získáte nebo nastavte přizpůsobení pro tento Aspose.Imaging.Pen.
public PenAlignment Alignment { get; set; }
Hodnota nemovitosti
Exceptions
Aspose.Imaging.Pen.Alignment vlastnost je nastaven na neměnný Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
Brush
Obdrží nebo nastaví Aspose.Imaging.Pen.Brush, který určuje atributy tohoto Aspose.Imaging.Pen.
public Brush Brush { get; set; }
Hodnota nemovitosti
Exceptions
Aspose.Imaging.Pen.Brush je umístěn na neměnné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
Color
Získáte nebo nastavte barvu tohoto Aspose.Imaging.Pen.
public Color Color { get; set; }
Hodnota nemovitosti
Exceptions
Aspose.Imaging.Pen.Color vlastnost je nastaven na neměnný Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
CompoundArray
Obdrží nebo nastaví řadu hodnot, které určují sloučeninu. sloučenina vytváří sloučeninu složenou z paralelních linií a prostor.
public float[] CompoundArray { get; set; }
Hodnota nemovitosti
float []a[]
Exceptions
Společnost Aspose.Imaging.Pen.CompoundArray je umístěna na neměnné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
CustomEndCap
Obdržíte nebo nastavíte přizpůsobený koberec k použití na konci řádků natáčených s tímto Aspose.Imaging.Pen.
public CustomLineCap CustomEndCap { get; set; }
Hodnota nemovitosti
Exceptions
Společnost Aspose.Imaging.Pen.CustomEndCap je umístěna na nezměnitelném Aspose.Imaging.Pen, jako jsou ty, které vrácí třída Aspose.Imaging.Pen.
CustomStartCap
Obdržíte nebo nastavíte přizpůsobený koberec k použití na začátku řádků vytištěných s tímto Aspose.Imaging.Pen.
public CustomLineCap CustomStartCap { get; set; }
Hodnota nemovitosti
Exceptions
Společnost Aspose.Imaging.Pen.CustomStartCap je umístěna na nezměnitelném Aspose.Imaging.Pen, jako jsou ty, které vrácí třída Aspose.Imaging.Pen.
DashCap
Obdržíte nebo nastavíte cap styl používaný na konci desek, které tvoří deskované linky vytištěné s tímto Aspose.Imaging.Pen.
public DashCap DashCap { get; set; }
Hodnota nemovitosti
Exceptions
Společnost Aspose.Imaging.Pen.DashCap je umístěna na neměnné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
DashOffset
Získáte nebo nastavíte vzdálenost od začátku řádku až po začátek pásku.
public float DashOffset { get; set; }
Hodnota nemovitosti
DashPattern
Obdrží nebo nastaví řadu přizpůsobených desek a prostor.
public float[] DashPattern { get; set; }
Hodnota nemovitosti
float []a[]
Exceptions
Aspose.Imaging.Pen.DashPattern vlastnost je nastaven na neměnný Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
DashStyle
Získáte nebo nastavíte styl používaný pro šroubované linky vytištěné s tímto Aspose.Imaging.Pen.
public DashStyle DashStyle { get; set; }
Hodnota nemovitosti
Exceptions
Aspose.Imaging.Pen.DashStyle vlastnost je nastaven na neměnné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
EndCap
Obdržíte nebo nastavíte cap styl používaný na konci řádků vytištěných s tímto Aspose.Imaging.Pen.
public LineCap EndCap { get; set; }
Hodnota nemovitosti
Exceptions
Vlastnictví Aspose.Imaging.Pen.EndCap je nastaveno na neměnné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
LineJoin
Získáte nebo nastavte styl připojení na konce dvou následujících řádků vytištěných s tímto Aspose.Imaging.Pen.
public LineJoin LineJoin { get; set; }
Hodnota nemovitosti
Exceptions
Společnost Aspose.Imaging.Pen.LineJoin je umístěna na nezměnitelné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
MiterLimit
Obdrží nebo stanoví hranici tloušťky spojení na měřeném rohu.
public float MiterLimit { get; set; }
Hodnota nemovitosti
Exceptions
Vlastnictví Aspose.Imaging.Pen.MiterLimit je nastaveno na neměnné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
PenType
Získejte styl řádků natáčených s tímto Aspose.Imaging.Pen.
[JsonIgnore]
public PenType PenType { get; }
Hodnota nemovitosti
StartCap
Obdržíte nebo nastavíte styl čepu použitý na začátku řádků vytištěných s tímto Aspose.Imaging.Pen.
public LineCap StartCap { get; set; }
Hodnota nemovitosti
Exceptions
Společnost Aspose.Imaging.Pen.StartCap je umístěna na nezměnitelné Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
Transform
Obdržíte nebo nastavíte kopii geometrické transformace pro tento Aspose.Imaging.Pen.
public Matrix Transform { get; set; }
Hodnota nemovitosti
Exceptions
Aspose.Imaging.Pen.Transform vlastnost je nastaven na neměnný Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
Width
Obdržíte nebo nastavíte šířku tohoto Aspose.Imaging.Pen, v jednotkách grafického objektu používaného k kreslen.
public float Width { get; set; }
Hodnota nemovitosti
Exceptions
Aspose.Imaging.Pen.Width vlastnost je nastaven na neměnný Aspose.Imaging.Pen, jako jsou ty, které jsou vráceny třídou Aspose.Imaging.Pen.
Methods
Equals(Objekt)
Zkontrolujte, zda jsou objekty stejn.
public override bool Equals(object obj)
Parameters
obj
object
Druhý objekt.
Returns
Výsledkem je srovnání rovnosti.
Equals(Pen)
Zkontrolujte, zda jsou objekty stejn.
protected bool Equals(Pen other)
Parameters
other
Pen
Druhý objekt.
Returns
Výsledkem je srovnání rovnosti.
GetHashCode()
Získejte hash kód aktuálního objektu.
public override int GetHashCode()
Returns
Kód pro hash.
MultiplyTransform(Matrix)
Množství transformace matriky pro tento Aspose.Imaging.Pen podle specifikovaného Aspose.Imaging.Matrix.
public void MultiplyTransform(Matrix matrix)
Parameters
matrix
Matrix
Aspose.Imaging.Matrix je objekt, kterým se rozmnožuje transformační matrice.
MultiplyTransform(Matrix a MatrixOrder)
Množství transformační matrice pro tento Aspose.Imaging.Pen podle specifikovaného Aspose.Imaging.Matrix v specifikovaném pořad.
public void MultiplyTransform(Matrix matrix, MatrixOrder order)
Parameters
matrix
Matrix
Aspose.Imaging.Matrix, kterým se rozmnožuje transformační matrice.
order
MatrixOrder
d, ve kterém provádět operaci rozmnožován.
ResetTransform()
Resetuje geometrickou transformací matice pro tento Aspose.Imaging.Pen k identit.
public void ResetTransform()
RotateTransform(flotila)
Rotuje lokální geometrickou transformaci podle určeného úhlu.Tato metoda předpovídá rotaci transformaci.
public void RotateTransform(float angle)
Parameters
angle
float
V úhlu rotace.
RotateTransform(Štěpán, MatrixOrder)
Otočí lokální geometrickou transformaci podle určeného úhlu ve stanoveném pořad.
public void RotateTransform(float angle, MatrixOrder order)
Parameters
angle
float
V úhlu rotace.
order
MatrixOrder
Aspose.Imaging.MatrixOrder, který specifikuje, zda doplnit nebo přepínat rotační matrice.
ScaleTransform(Plzeň, Plzeň)
Rozšířte místní geometrickou transformaci specifikovanými faktory.Tato metoda předpovídá skalovací matrice transformaci.
public void ScaleTransform(float sx, float sy)
Parameters
sx
float
faktorem, kterým se měří transformace v směru x-axis.
sy
float
faktorem, kterým se měří transformace ve směru y-axis.
ScaleTransform(plavba, plavba, MatrixOrder)
Rozšířte místní geometrickou transformaci specifikovanými faktory ve specifikovaném pořad.
public void ScaleTransform(float sx, float sy, MatrixOrder order)
Parameters
sx
float
faktorem, kterým se měří transformace v směru x-axis.
sy
float
faktorem, kterým se měří transformace ve směru y-axis.
order
MatrixOrder
Aspose.Imaging.MatrixOrder, který specifikuje, zda doplnit nebo přepínat skalovací matrice.
SetLineCap(LineCap, LineCap a DashCap)
Sestavte hodnoty, které určují styl kapy používané pro koncové linky vytištěné tímto Aspose.Imaging.Pen.
public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
Parameters
startCap
LineCap
Aspose.Imaging.LineCap, který představuje cap styl použít na začátku řádků natáčených s tímto Aspose.Imaging.Pen.
endCap
LineCap
Aspose.Imaging.LineCap, který představuje cap styl použít na konci řádků natáčených s tímto Aspose.Imaging.Pen.
dashCap
DashCap
Aspose.Imaging.LineCap, který představuje styl kapky k použití na začátku nebo na konci roztavených linek natáčených s tímto Aspose.Imaging.Pen.
TranslateTransform(Plzeň, Plzeň)
Překládá lokální geometrickou transformaci podle stanovených rozměrů.Tato metoda předpovídá překlad transformaci.
public void TranslateTransform(float dx, float dy)
Parameters
dx
float
hodnotu překladu v x.
dy
float
Význam překladu v Y.
TranslateTransform(plavba, plavba, MatrixOrder)
Překládá lokální geometrickou transformaci podle stanovených rozměrů ve stanoveném pořad.
public void TranslateTransform(float dx, float dy, MatrixOrder order)
Parameters
dx
float
hodnotu překladu v x.
dy
float
Význam překladu v Y.
order
MatrixOrder
Příkaz (prepend nebo append), ve kterém se použije překlad.