Class Pen
Pôvodný názov: Aspose.Imaging Zhromaždenie: Aspose.Imaging.dll (25.4.0)
Definuje objekt používaný na kreslenie línií, kriviek a čísel.
public class Pen : TransparencySupporter
Inheritance
object ← TransparencySupporter ← Pen
Z dedičných č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 príklad ukazuje vytvorenie a používanie Pen objektov. Príklad vytvára nový obrázok a kresli rektangly 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)
Iniciuje novú inštanciu triedy Aspose.Imaging.Pen so špecifikovanou farbou.
public Pen(Color color)
Parameters
color
Color
Aspose.Imaging.Pen.Color štruktúra, ktorá naznačuje farbu tohto Wl17.
Pen(farba, float)
Initalizuje novú inštanciu triedy Aspose.Imaging.Pen so špecifikovanými vlastnosťami Wl17.Peň.Color a _ www.pen.width .
public Pen(Color color, float width)
Parameters
color
Color
Aspose.Imaging.Pen.Color štruktúra, ktorá naznačuje farbu tohto Wl17.
width
float
Hodnotu, ktorá naznačuje šírku tohto Aspose.Imaging.Pen.
Examples
Tento príklad ukazuje vytvorenie a používanie Pen objektov. Príklad vytvára nový obrázok a kresli rektangly 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)
Initalizuje novú inštanciu triedy Aspose.Imaging.Pen so špecifikovanou Wl17.Pan.Brush.
public Pen(Brush brush)
Parameters
brush
Brush
A Aspose.Imaging.Pen.Brush, ktorý určuje vlastnosti plnenia tohto W L17.
Exceptions
brush’ is null.
Pen(Brúska, float)
Initalizuje novú inštanciu triedy Aspose.Imaging.Pen so špecifikovanou triedou W L 17.Pan.Brush a w L 18 .Pan .Width.
[JsonConstructor]
public Pen(Brush brush, float width)
Parameters
brush
Brush
A Aspose.Imaging.Pen.Brush, ktorý určuje charakteristiky tohto Wl17.Pan.
width
float
Šírka nového Aspose.Imaging.Pen.
Exceptions
brush’ is null.
Properties
Alignment
Získajte alebo nastavíte zosúladenie pre tento Aspose.Imaging.Pen.
public PenAlignment Alignment { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.Alignment je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda wl16.pen.
Brush
Získava alebo nastaví Aspose.Imaging.Pen.Brush, ktorý určuje atribúty tohto Wl17.
public Brush Brush { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.Brush je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda _www.
Color
Získať alebo nastaviť farbu tohto Aspose.Imaging.Pen.
public Color Color { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.Color je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda _www.
CompoundArray
Dostane alebo nastaví rad hodnôt, ktoré špecifikujú zlúčenú penu. zlúčená penu vytvára zlúčenú líniu pozostávajúcu z paralelných línií a priestorov.
public float[] CompoundArray { get; set; }
Hodnota nehnuteľnosti
float []
Exceptions
Prirodzenosť Aspose.Imaging.Pen.CompoundArray je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda wl16.pen.
CustomEndCap
Získajte alebo nastavíte vlastný kryt na použitie na konci riadkov vytiahnutých s týmto Aspose.Imaging.Pen.
public CustomLineCap CustomEndCap { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.CustomEndCap je nastavená na nezmeniteľný Wl17.Fen, ako sú tie, ktoré vráti trieda wl16 .FEN.
CustomStartCap
Získajte alebo nastavíte vlastný kryt na použitie na začiatku riadkov vytiahnutých s týmto Aspose.Imaging.Pen.
public CustomLineCap CustomStartCap { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.CustomStartCap je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda wl16.pén.
DashCap
Získajte alebo nastavíte štýl kapoty používaný na konci dosiek, ktoré tvoria doskové línie vytiahnuté týmto Aspose.Imaging.Pen.
public DashCap DashCap { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.DashCap je nastavená na nezmeniteľný Wl17.Pan, ako sú tie, ktoré sa vrátia z triedy _www.phen.
DashOffset
Získajte alebo nastavíte vzdialenosť od začiatku riadku až po začiatok priečinku.
public float DashOffset { get; set; }
Hodnota nehnuteľnosti
DashPattern
Získajte alebo nastavíte rad prispôsobených dosiek a priestorov.
public float[] DashPattern { get; set; }
Hodnota nehnuteľnosti
float []
Exceptions
Prirodzenosť Aspose.Imaging.Pen.DashPattern je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda wl16.pen.
DashStyle
Získajte alebo nastavíte štýl používaný pre štruktúrované línie vytiahnuté týmto Aspose.Imaging.Pen.
public DashStyle DashStyle { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.DashStyle je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda wl16.pen.
EndCap
Získajte alebo nastavíte štýl krytu použitý na konci riadkov vytiahnutých s týmto Aspose.Imaging.Pen.
public LineCap EndCap { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.EndCap je nastavená na nezmeniteľný Wl17.Pan, ako sú tie, ktoré vráti trieda _www.pan.
LineJoin
Získajte alebo nastavíte štýl pripojenia na konce dvoch po sebe nasledujúcich línií vytiahnutých týmto Aspose.Imaging.Pen.
public LineJoin LineJoin { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.LineJoin je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda wl16.
MiterLimit
Dostane alebo stanoví hranicu hrúbky spojenia na miernom rohu.
public float MiterLimit { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.MiterLimit je nastavená na nenahraditeľný Wl17.Pan, ako sú tie, ktoré vráti trieda _wl16_pen .
PenType
Získať štýl riadkov vytiahnutý s týmto Aspose.Imaging.Pen.
[JsonIgnore]
public PenType PenType { get; }
Hodnota nehnuteľnosti
StartCap
Získajte alebo nastavíte štýl čiapky používaný na začiatku riadkov vytiahnutých s týmto Aspose.Imaging.Pen.
public LineCap StartCap { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.StartCap je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda _www.
Transform
Získať alebo nastaviť kópiu geometrickej transformácie pre tento Aspose.Imaging.Pen.
public Matrix Transform { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.Transform je nastavená na nezmeniteľný _Wl17_pen, ako sú tie, ktoré vráti trieda _www.
Width
Dostane alebo nastaví šírku tohto Aspose.Imaging.Pen, v jednotkách grafického objektu používaného na kreslenie.
public float Width { get; set; }
Hodnota nehnuteľnosti
Exceptions
Vlastnosť Aspose.Imaging.Pen.Width je nastavená na nezmeniteľný Wl17.Pan, ako sú tie, ktoré vráti trieda wl16 .Pan.
Methods
Equals(objekty)
Skontrolujte, či sú objekty rovnaké.
public override bool Equals(object obj)
Parameters
obj
object
Druhý objekt
Returns
Výsledkom je porovnanie rovnosti.
Equals(Pen)
Skontrolujte, či sú objekty rovnaké.
protected bool Equals(Pen other)
Parameters
other
Pen
Druhý objekt
Returns
Výsledkom je porovnanie rovnosti.
GetHashCode()
Získajte hash kód aktuálneho objektu.
public override int GetHashCode()
Returns
Kód na hash.
MultiplyTransform(Matrix)
Množstvo transformácie matriky pre tento Aspose.Imaging.Pen podľa špecifikovaného Wl17.Matrix.
public void MultiplyTransform(Matrix matrix)
Parameters
matrix
Matrix
Aspose.Imaging.Matrix objekt, ktorým sa rozmnožuje transformácia matrix.
MultiplyTransform(Matrix a MatrixOrder)
Množstvo transformácie matriky pre tento Aspose.Imaging.Pen podľa špecifikovaného Wl17.Matrix v špecifickom poradí.
public void MultiplyTransform(Matrix matrix, MatrixOrder order)
Parameters
matrix
Matrix
Matrix Aspose.Imaging.Matrix, ktorým sa rozmnožuje transformácia matrix.
order
MatrixOrder
Nariadenie, v ktorom sa vykonáva operácia multiplikácie.
ResetTransform()
Obnovuje geometrickú transformáciu matriky pre tento Aspose.Imaging.Pen na identitu.
public void ResetTransform()
RotateTransform(flotila)
Rotuje lokálnu geometrickú transformáciu podľa určeného úhlu.Táto metóda prepája rotaciu na transformáciu.
public void RotateTransform(float angle)
Parameters
angle
float
Z hľadiska rotujúceho rohu.
RotateTransform(Námestie, MatrixOrder)
Rotuje lokálnu geometrickú transformáciu podľa určeného úhlu v určenom poradí.
public void RotateTransform(float angle, MatrixOrder order)
Parameters
angle
float
Z hľadiska rotujúceho rohu.
order
MatrixOrder
A Aspose.Imaging.MatrixOrder, ktorý špecifikuje, či doplniť alebo prepínať rotačnú matriu.
ScaleTransform(Pláž, Pláž)
Rozsahuje lokálnu geometrickú transformáciu špecifikovanými faktormi.Táto metóda predviaže skalnú matriu na transformáciu.
public void ScaleTransform(float sx, float sy)
Parameters
sx
float
Faktor, ktorým sa skaluje transformácia v x-axovom smere.
sy
float
Faktory, ktorými sa skaluje transformácia v smere y-axis.
ScaleTransform(plavba, plavba, MatrixOrder)
Rozsah lokálnej geometrickej transformácie podľa špecifikovaných faktorov v špecifikovanom poradí.
public void ScaleTransform(float sx, float sy, MatrixOrder order)
Parameters
sx
float
Faktor, ktorým sa skaluje transformácia v x-axovom smere.
sy
float
Faktory, ktorými sa skaluje transformácia v smere y-axis.
order
MatrixOrder
A Aspose.Imaging.MatrixOrder, ktorý špecifikuje, či rozšíriť alebo predĺžiť skalujúcu matriu.
SetLineCap(Spoločnosť LineCap, LineCap, DashCap)
Zadajte hodnoty, ktoré určujú štýl krytu použitý na koncové línie vytiahnuté týmto Aspose.Imaging.Pen.
public void SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
Parameters
startCap
LineCap
A Aspose.Imaging.LineCap, ktorý predstavuje štýl cap na použitie na začiatku riadkov vytiahnutých s týmto WR17.Pen.
endCap
LineCap
A Aspose.Imaging.LineCap, ktorý predstavuje štýl cap na použitie na konci riadkov vytiahnutých s týmto WR17.Pen.
dashCap
DashCap
A Aspose.Imaging.LineCap, ktorý predstavuje štýl kapoty na použitie na začiatku alebo konci príveskových línií vytiahnutých s týmto __ WL16__ .Pen.
TranslateTransform(Pláž, Pláž)
Preloží lokálnu geometrickú transformáciu podľa špecifikovaných rozmerov. Táto metóda prepája preklad na transformáciu.
public void TranslateTransform(float dx, float dy)
Parameters
dx
float
Hodnota prekladu v x.
dy
float
Hodnota prekladu v y.
TranslateTransform(plavba, plavba, MatrixOrder)
Preklad lokálnej geometrickej transformácie podľa špecifikovaných rozmerov v špecifikovanom poradí.
public void TranslateTransform(float dx, float dy, MatrixOrder order)
Parameters
dx
float
Hodnota prekladu v x.
dy
float
Hodnota prekladu v y.
order
MatrixOrder
Nariadenie (prepend alebo append), v ktorom sa uplatní preklad.