Class Graphics
Navne til: Aspose.Imaging Sammensætning: Aspose.Imaging.dll (25.5.0)
Det repræsenterer grafikken i henhold til den grafiske motor, der anvendes i den nuværende samling.
public sealed class GraphicsInheritance
De arvede medlemmer
object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Constructors
Graphics(Image)
Initialiserer en ny instans af Aspose.Imaging.Grafikklassen.
public Graphics(Image sourceImage)Parameters
sourceImage Image
Det kildebillede.
Properties
Clip
Få eller indsæt klipregionen.
public Region Clip { get; set; }Ejendomsværdi
CompositingQuality
Giver eller sætter kompositionskvaliteten.
public CompositingQuality CompositingQuality { get; set; }Ejendomsværdi
Dpix
Få den horisontale opløsning af denne Aspose.Imaging.Grafik.
public float DpiX { get; }Ejendomsværdi
Dpiy
Få den vertikale opløsning af denne Aspose.Imaging.Grafik.
public float DpiY { get; }Ejendomsværdi
Image
Gør billedet.
public Image Image { get; }Ejendomsværdi
InterpolationMode
Tag eller indsæt interpolationsmetoden.
public InterpolationMode InterpolationMode { get; set; }Ejendomsværdi
IsInBeginUpdateCall
Giver en værdi, der angiver, om grafikken er i BeginUpdate opkaldstilstand.
public bool IsInBeginUpdateCall { get; }Ejendomsværdi
PageScale
Få eller indstille skalaen mellem verdens enheder og sidelinjer for dette Aspose.Imaging.Grafik.
public float PageScale { get; set; }Ejendomsværdi
PageUnit
Få eller indstille enheden for måling, der bruges til side koordinater i denne Aspose.Imaging.Grafik.
public GraphicsUnit PageUnit { get; set; }Ejendomsværdi
PaintableImageOptions
Få eller indsætte billedmuligheder, der bruges til at skabe malerbare vactorbilleder til at tegne.
public ImageOptionsBase PaintableImageOptions { get; set; }Ejendomsværdi
SmoothingMode
Få eller indstille glatningsmodus.
public SmoothingMode SmoothingMode { get; set; }Ejendomsværdi
TextRenderingHint
Få eller indsætte tekst rendering hint.
public TextRenderingHint TextRenderingHint { get; set; }Ejendomsværdi
Transform
Få eller indsæt en kopi af den geometriske verden transformation for denne Aspose.Imaging.Grafik.
public Matrix Transform { get; set; }Ejendomsværdi
Methods
BeginUpdate()
De grafiske effekter, der anvendes senere, vil ikke anvendes umiddelbart i stedet for EndUpdate vil forårsage anvendelse af alle effekter på én gang.
public void BeginUpdate()Remarks
Bemærk de effekter, efter at BeginUpdate er opkaldt, vil ikke anvendes, hvis EndUpdate ikke er opkaldt.
Clear(Color)
Rengør grafisk overflade ved hjælp af den angivne farve.
public void Clear(Color color)Parameters
color Color
Den farve til at rydde grafik overfladen ved.
Examples
Disse eksempler gør brug af GraphicsPath og Grafikklasse til at oprette og manipulere Figurer på et billede overflade. Eksemplet skaber et nyt billede (type Tiff), renser overfladen og trækker veje ved hjælp af grafikklassen.
//Create an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create))
{
//Create an instance of TiffOptions and set its various properties
Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
//Set the source for the instance of ImageOptions
tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Color.Wheat);
//Create an instance of GraphicsPath class
Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();
//Create an instance of Figure class
Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();
//Add Shapes to Figure object
figure.AddShape(new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(10f, 10f, 300f, 300f)));
figure.AddShape(new Aspose.Imaging.Shapes.EllipseShape(new Aspose.Imaging.RectangleF(50f, 50f, 300f, 300f)));
figure.AddShape(new Aspose.Imaging.Shapes.PieShape(new Aspose.Imaging.RectangleF(new Aspose.Imaging.PointF(250f, 250f), new Aspose.Imaging.SizeF(200f, 200f)), 0f, 45f));
//Add Figure object to GraphicsPath
graphicspath.AddFigure(figure);
//Draw path with Pen object of color Black
graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);
// save all changes.
image.Save();
}
}For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}DrawArc(Flåder, flåder, flåder, flåder, flåder)
Drage en ark, der repræsenterer en del af en ellipse angivet af et par koordinater, en bredde og en højde.
public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af arken.
x float
X-koordinaten af den øverste venstre hjørne af rektanglen, der definerer ellipse.
y float
Den y-koordinat af den øverste venstre hjørne af rektanglen, der definerer ellipse.
width float
Omfanget af den rektangle, der definerer ellipse.
height float
Højden af rektanglen, der definerer ellipse.
startAngle float
Vinkel i grader målt klokkevis fra x-axis til udgangspunktet for ark.
sweepAngle float
Angle i grader målt klokkevis fra startAngle’ parameter til slutning point af arken.
Exceptions
pen’ is null.
DrawArc(Pæne, RectangleF, float, float)
Dræber en ark, der repræsenterer en del af en ellipse angivet ved en Aspose.Imaging.RectangleF struktur.
public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af arken.
rect RectangleF
Aspose.Imaging.RectangleF struktur, der definerer grænserne for ellipse.
startAngle float
Vinkel i grader målt klokkevis fra x-axis til udgangspunktet for ark.
sweepAngle float
Angle i grader målt klokkevis fra startAngle’ parameter til slutning point af arken.
Exceptions
pen’ is null
DrawArc(Tænk, int, int, int, int, int)
Drage en ark, der repræsenterer en del af en ellipse angivet af et par koordinater, en bredde og en højde.
public void DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af arken.
x int
X-koordinaten af den øverste venstre hjørne af rektanglen, der definerer ellipse.
y int
Den y-koordinat af den øverste venstre hjørne af rektanglen, der definerer ellipse.
width int
Omfanget af den rektangle, der definerer ellipse.
height int
Højden af rektanglen, der definerer ellipse.
startAngle int
Vinkel i grader målt klokkevis fra x-axis til udgangspunktet for ark.
sweepAngle int
Angle i grader målt klokkevis fra startAngle’ parameter til slutning point af arken.
Exceptions
pen’ is null.
DrawArc(Pæne, Rectangle, Float, Float)
Dræber en ark, der repræsenterer en del af en ellipse angivet ved en Aspose.Imaging.Rectangle struktur.
public void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af arken.
rect Rectangle
Aspose.Imaging.RectangleF struktur, der definerer grænserne for ellipse.
startAngle float
Vinkel i grader målt klokkevis fra x-axis til udgangspunktet for ark.
sweepAngle float
Angle i grader målt klokkevis fra startAngle’ parameter til slutning point af arken.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.
DrawBezier(Flåd, flåd, flåd, flåd, flåd, flåd, flåd, flåd, flåd)
Dræber en Bézier spline defineret af fire ordinerede par koordinater, der repræsenterer punkter.
public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af kurven.
x1 float
Den x-koordinate af udgangspunktet for kurven.
y1 float
Den y-koordinate af udgangspunktet for kurven.
x2 float
Den x-koordinate af den første kontrolpunkt i kurven.
y2 float
Den y-koordinate af den første kontrolpunkt i kurven.
x3 float
Den x-koordinate af den anden kontrolpunkt i kurven.
y3 float
Den y-koordinate af den anden kontrolpunkt af kurven.
x4 float
Den x-koordinate af slutpunktet i kurven.
y4 float
Den y-koordinate af slutpunktet i kurven.
Exceptions
pen’ is null.
DrawBezier(PointF, PointF, PointF og PointF)
Dræber en Bézier spline defineret af fire Aspose.Imaging.PointF strukturer.
public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af kurven.
pt1 PointF
Aspose.Imaging.PointF struktur, der repræsenterer udgangspunktet for kurven.
pt2 PointF
Aspose.Imaging.PointF struktur, der repræsenterer den første kontrolpunkt for kurven.
pt3 PointF
Aspose.Imaging.PointF struktur, der repræsenterer den anden kontrolpunkt for kurven.
pt4 PointF
Aspose.Imaging.PointF struktur, der repræsenterer slutpunktet for kurven.
Exceptions
pen’ is null.
DrawBezier(point, point, point, point og point)
Dræber en Bézier spline defineret af fire Aspose.Imaging.Point strukturer.
public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)Parameters
pen Pen
Aspose.Imaging.Pen struktur, der bestemmer farven, bredden og stilen af kurven.
pt1 Point
Aspose.Imaging.Point struktur, der repræsenterer udgangspunktet for kurven.
pt2 Point
Aspose.Imaging.Point struktur, der repræsenterer den første kontrolpunkt for kurven.
pt3 Point
Aspose.Imaging.Point struktur, der repræsenterer den anden kontrolpunkt for kurven.
pt4 Point
Aspose.Imaging.Points struktur, der repræsenterer slutpunktet for kurven.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.
DrawBeziers(Tænk, point[])
Drage en serie af Bézier splines fra en række Aspose.Imaging.Point strukturer.
public void DrawBeziers(Pen pen, Point[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af kurven.
points Point
[]
En række af Aspose.Imaging.Point-strukturer, der repræsenterer de punkter, som bestemmer kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawBeziers(Løgn, pointf[])
Drage en serie af Bézier splines fra en række Aspose.Imaging.PointF strukturer.
public void DrawBeziers(Pen pen, PointF[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af kurven.
points PointF
[]
En række Aspose.Imaging.PointF strukturer, som repræsenterer de punkter, der bestemmer kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawClosedCurve(Løgn, pointf[])
Dræber en lukket kardinal spline defineret af en række af Aspose.Imaging.PointF strukturer. Denne metode bruger en standard spænding på 0,5 og Opfyld-modus.
public void DrawClosedCurve(Pen pen, PointF[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
Exceptions
pen’ is null.-or-points’ is null.
DrawClosedCurve(Løgn, pointf[], Flåder)
Dræber en lukket kardinal spline defineret af en række af Aspose.Imaging.PointF strukturer ved hjælp af et angivet spændingsniveau. Denne metode anvender en standardfyldningsløsning Asposa.Imaging.FillMode.Alternate.
public void DrawClosedCurve(Pen pen, PointF[] points, float tension)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawClosedCurve(Tænk, point[])
Dræber en lukket kardinal spline defineret af en række af Aspose.Imaging.Point strukturer. Denne metode bruger en standard spænding på 0,5 og Asposa.FillMode.Alternate fylde tilstand.
public void DrawClosedCurve(Pen pen, Point[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
Exceptions
pen’ is null.-or-points’ is null.
DrawClosedCurve(Tænk, point[], Flåder)
Dræber en lukket kardinal spline defineret af en række af Aspose.Imaging.Point strukturer ved hjælp af et angivet spændingsniveau. Denne metode anvender en standardfyldningsløsning Asposa.FillMode.Alternate.
public void DrawClosedCurve(Pen pen, Point[] points, float tension)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawCurve(Løgn, pointf[])
Dræber en kardinal spline gennem en angivet række af Aspose.Imaging.PointF strukturer. Denne metode bruger en standard spænding på 0.5.
public void DrawCurve(Pen pen, PointF[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
Exceptions
pen’ is null.-or-points’ is null.
DrawCurve(Løgn, pointf[], Flåder)
Drage en kardinal spline gennem en specifik række af Aspose.Imaging.PointF strukturer ved hjælp af en bestemt spænding.
public void DrawCurve(Pen pen, PointF[] points, float tension)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points PointF
[]
En række Aspose.Imaging.PointF strukturer, som repræsenterer de punkter, der definerer kurven.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawCurve(Løgn, pointf[], Det er int, int)
Dræber en kardinal spline gennem en angivet række af Aspose.Imaging.PointF strukturer. tegningen begynder afset fra begyndelsen af rækkefølgen.Denne metode bruger en standardspænding på 0.5.
public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
offset int
Afset fra det første element i rækkefølgen af points’ parameter til udgangspunktet i kurven.
numberOfSegments int
Antallet af segmenter efter udgangspunktet skal inkluderes i kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawCurve(Løgn, pointf[], int, int, float)
Dræber en kardinal spline gennem en bestemt række af Aspose.Imaging.PointF strukturer ved hjælp af en specifik spænding.
public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments, float tension)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
offset int
Afset fra det første element i rækkefølgen af points’ parameter til udgangspunktet i kurven.
numberOfSegments int
Antallet af segmenter efter udgangspunktet skal inkluderes i kurven.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawCurve(Tænk, point[])
Drage en kardinal spline gennem en angivet række af Aspose.Imaging.Point strukturer.
public void DrawCurve(Pen pen, Point[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.-or-points’ is null.
DrawCurve(Tænk, point[], Flåder)
Drage en kardinal spline gennem en bestemt række af Aspose.Imaging.Point strukturer ved hjælp af en specifik spænding.
public void DrawCurve(Pen pen, Point[] points, float tension)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawCurve(Tænk, point[], int, int, float)
Drage en kardinal spline gennem en bestemt række af Aspose.Imaging.Point strukturer ved hjælp af en specifik spænding.
public void DrawCurve(Pen pen, Point[] points, int offset, int numberOfSegments, float tension)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farve, bredde og højde af kurven.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
offset int
Afset fra det første element i rækkefølgen af points’ parameter til udgangspunktet i kurven.
numberOfSegments int
Antallet af segmenter efter udgangspunktet skal inkluderes i kurven.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
pen’ is null.-or-points’ is null.
DrawEllipse(Pæn, RectangleF)
Dræber en ellipse defineret af en grænse Aspose.Imaging.RectangleF.
public void DrawEllipse(Pen pen, RectangleF rect)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af ellipsen.
rect RectangleF
Aspose.Imaging.RectangleF struktur, der definerer grænserne for ellipse.
Exceptions
pen’ is null.
DrawEllipse(Flåder, flåder, flåder, flåder)
Dræber en ellipse defineret af en grænse rektangle angivet af et par koordinater, en højde og en bredde.
public void DrawEllipse(Pen pen, float x, float y, float width, float height)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af ellipsen.
x float
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
y float
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
width float
bredden af den bundende rektangle, der definerer ellipsen.
height float
Højden af den bundende rektangle, der definerer ellipse.
Exceptions
pen’ is null.
DrawEllipse(Pæne, Rectangle)
Dræber en ellipse angivet af en grænse Aspose.Imaging.Rectangle struktur.
public void DrawEllipse(Pen pen, Rectangle rect)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af ellipsen.
rect Rectangle
Aspose.Imaging.Rectangle struktur, der definerer grænserne for ellipse.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.
DrawEllipse(Løgn, int, int, int)
Dræber en ellipse defineret af en grænse rektangle angivet af et par koordinater, en højde og en bredde.
public void DrawEllipse(Pen pen, int x, int y, int width, int height)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af ellipsen.
x int
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
y int
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
width int
bredden af den bundende rektangle, der definerer ellipsen.
height int
Højden af den bundende rektangle, der definerer ellipse.
Exceptions
pen’ is null.
DrawImage(Billeder af PointF)
Drage den angivne Aspose.Imaging.Graphics.Image, ved hjælp af dens oprindelige fysiske størrelse, på det angive sted.
public void DrawImage(Image sourceImage, PointF point)Parameters
sourceImage Image
Billedet til at drage med.
point PointF
Aspose.Imaging.PointF struktur, der repræsenterer den øverste venstre hjørne af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, flåder og flåder)
Drage den angivne Aspose.Imaging.Graphics.Image, ved hjælp af dens oprindelige fysiske størrelse, på det angive sted.
public void DrawImage(Image sourceImage, float x, float y)Parameters
sourceImage Image
Billedet til at drage med.
x float
X-koordinaten i den øverste venstre hjørne af det tegnede billede.
y float
Den y-koordinate af den øverste venstre hjørne af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, RectangleF)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, RectangleF rect)Parameters
sourceImage Image
Billedet til at drage med.
rect RectangleF
Aspose.Imaging.RectangleF struktur, der angiver placeringen og størrelsen af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, Rectangle og Graphics)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, Rectangle rectDestination, GraphicsUnit graphicsUnit)Parameters
sourceImage Image
Billedet til at drage med.
rectDestination Rectangle
Formålet er rektangle.
graphicsUnit GraphicsUnit
Den grafiske enhed.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, RectangleF, GraphicsUnit)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, RectangleF rectDestination, GraphicsUnit graphicsUnit)Parameters
sourceImage Image
Billedet til at drage med.
rectDestination RectangleF
Formålet er rektangle.
graphicsUnit GraphicsUnit
Den grafiske enhed.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, Rectangle, GraphicsUnit, ImageAttributer)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, Rectangle rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)Parameters
sourceImage Image
Billedet til at drage med.
rectDestination Rectangle
Formålet er rektangle.
graphicsUnit GraphicsUnit
Den grafiske enhed.
imageAttributes ImageAttributes
Billedet er atribut.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, RectangleF, GraphicsUnit, ImageAttributer)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, RectangleF rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)Parameters
sourceImage Image
Billedet til at drage med.
rectDestination RectangleF
Destination rektangle til at trække ind.
graphicsUnit GraphicsUnit
Den grafiske enhed.
imageAttributes ImageAttributes
Billedet er atribut.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, Rectangle, Rectangle og Graphics)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, Rectangle rectSource, Rectangle rectDestination, GraphicsUnit graphicsUnit)Parameters
sourceImage Image
Billedet til at drage med.
rectSource Rectangle
Den rette kilde.
rectDestination Rectangle
Den rette destination.
graphicsUnit GraphicsUnit
Den grafiske enhed.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, RectangleF, RectangleF, GraphicsUnit)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, RectangleF rectSource, RectangleF rectDestination, GraphicsUnit graphicsUnit)Parameters
sourceImage Image
Billedet til at drage med.
rectSource RectangleF
Den rette kilde.
rectDestination RectangleF
Den rette destination.
graphicsUnit GraphicsUnit
Den grafiske enhed.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, Rectangle, Rectangle, GraphicsUnit, ImageAttributes)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, Rectangle rectSource, Rectangle rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)Parameters
sourceImage Image
Billedet til at drage med.
rectSource Rectangle
Den rette kilde.
rectDestination Rectangle
Den rette destination.
graphicsUnit GraphicsUnit
Den grafiske enhed.
imageAttributes ImageAttributes
Billedet er atribut.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, RectangleF, RectangleF, GraphicsUnit, ImageAttributes)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, RectangleF rectSource, RectangleF rectDestination, GraphicsUnit graphicsUnit, ImageAttributes imageAttributes)Parameters
sourceImage Image
Billedet til at drage med.
rectSource RectangleF
Den kilde rektangle.
rectDestination RectangleF
Formålet er rektangle.
graphicsUnit GraphicsUnit
Den grafiske enhed til brug.
imageAttributes ImageAttributes
Billedet tiltrækker at bruge.
Exceptions
sourceImage’ is null.
DrawImage(Billeder og point[])
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, Point[] destPoints)Parameters
image Image
Billedet til at tegne.
destPoints Point
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
DrawImage(Billeder og point[], af Rectangle)
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect)Parameters
image Image
Billedet til at tegne.
destPoints Point
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
srcRect Rectangle
Den kilde rektangle.
DrawImage(Billeder og point[], Rectangle, GraphicsUnit)
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)Parameters
image Image
Billedet til at tegne.
destPoints Point
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
srcRect Rectangle
Den kilde rektangle.
srcUnit GraphicsUnit
Enhederne af måling.
DrawImage(Billeder og point[], Rectangle, GraphicsUnit, ImageAttributer)
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttributes)Parameters
image Image
Billedet til at tegne.
destPoints Point
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
srcRect Rectangle
Den kilde rektangle.
srcUnit GraphicsUnit
Enhederne af måling.
imageAttributes ImageAttributes
Billedet er atribut.
DrawImage(Billeder af PointF[])
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, PointF[] destPoints)Parameters
image Image
Billedet til at tegne.
destPoints PointF
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
Exceptions
Billeder
DrawImage(Billeder af PointF[], af RectangleF)
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect)Parameters
image Image
Billedet til at tegne.
destPoints PointF
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
srcRect RectangleF
Den kilde rektangle.
DrawImage(Billeder af PointF[], RectangleF, GraphicsUnit)
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)Parameters
image Image
Billedet til at tegne.
destPoints PointF
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
srcRect RectangleF
Den kilde rektangle.
srcUnit GraphicsUnit
Enhederne af måling.
DrawImage(Billeder af PointF[], RectangleF, GraphicsUnit, ImageAttributer)
Drage den angivne del af den angivne image’ på den angivne placering og med den angivne størrelse.
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttributes)Parameters
image Image
Billedet til at tegne.
destPoints PointF
[]
En række af tre PointF-strukturer, der definerer et parallelogram.
srcRect RectangleF
Den kilde rektangle.
srcUnit GraphicsUnit
Enhederne af måling.
imageAttributes ImageAttributes
Billedet er atribut.
DrawImage(Billede, flåde, flåde, flåde)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, float x, float y, float width, float height)Parameters
sourceImage Image
Billedet til at drage med.
x float
X-koordinaten i den øverste venstre hjørne af det tegnede billede.
y float
Den y-koordinate af den øverste venstre hjørne af det tegnede billede.
width float
Omfanget af det tegnede billede.
height float
Højden af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImage(Billeder og point)
Drage den angivne Aspose.Imaging.Graphics.Image, ved hjælp af dens oprindelige fysiske størrelse, på det angive sted.
public void DrawImage(Image sourceImage, Point point)Parameters
sourceImage Image
Billedet til at drage med.
point Point
Aspose.Imaging.Point struktur, der repræsenterer placeringen af den øverste venstre hjørne af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, int, int)
Drage det angivne billede, ved hjælp af dens oprindelige fysiske størrelse, på det sted, der er angivet af et koordinatpar.
public void DrawImage(Image sourceImage, int x, int y)Parameters
sourceImage Image
Billedet til at drage med.
x int
X-koordinaten i den øverste venstre hjørne af det tegnede billede.
y int
Den y-koordinate af den øverste venstre hjørne af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, Rectangle)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, Rectangle rect)Parameters
sourceImage Image
Billedet til at drage med.
rect Rectangle
Aspose.Imaging.Rectangle struktur, der angiver placeringen og størrelsen af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImage(Billeder, int, int, int, int)
Drage den angivne Aspose.Imaging.Graphics.Image på det angive placering og med en angiven størrelse.
public void DrawImage(Image sourceImage, int x, int y, int width, int height)Parameters
sourceImage Image
Billedet til at drage med.
x int
X-koordinaten i den øverste venstre hjørne af det tegnede billede.
y int
Den y-koordinate af den øverste venstre hjørne af det tegnede billede.
width int
Omfanget af det tegnede billede.
height int
Højden af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Billeder og point)
Drage et angivet billede ved hjælp af dens oprindelige fysiske størrelse på et angivet sted.
public void DrawImageUnscaled(Image sourceImage, Point point)Parameters
sourceImage Image
Billedet til at drage med.
point Point
Aspose.Imaging.Points struktur, der angiver den øverste venstre hjørne af det dragte billede.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Billeder, int, int)
Drage det angivne billede ved hjælp af dens oprindelige fysiske størrelse på det sted, der er angivet af et koordinater.
public void DrawImageUnscaled(Image sourceImage, int x, int y)Parameters
sourceImage Image
Billedet til at drage med.
x int
X-koordinaten i den øverste venstre hjørne af det tegnede billede.
y int
Den y-koordinate af den øverste venstre hjørne af det tegnede billede.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Billeder, Rectangle)
Drage et angivet billede ved hjælp af dens oprindelige fysiske størrelse på et angivet sted.
public void DrawImageUnscaled(Image sourceImage, Rectangle rect)Parameters
sourceImage Image
Billedet til at drage med.
rect Rectangle
Aspose.Imaging.Rectangle, der angiver den øverste venstre hjørne af det drage billede. X og Y egenskaber af rektanglen angivelse af øverst venstre.
Exceptions
sourceImage’ is null.
DrawImageUnscaled(Billeder, int, int, int, int)
Drage et angivet billede ved hjælp af dens oprindelige fysiske størrelse på et angivet sted.
public void DrawImageUnscaled(Image sourceImage, int x, int y, int width, int height)Parameters
sourceImage Image
Billedet til at drage med.
x int
X-koordinaten i den øverste venstre hjørne af det tegnede billede.
y int
Den y-koordinate af den øverste venstre hjørne af det tegnede billede.
width int
Parameteren anvendes ikke.
height int
Parameteren anvendes ikke.
Exceptions
sourceImage’ is null.
DrawImageUnscaledAndClipped(Billeder, Rectangle)
Drage det angivne billede uden skalering og klippe det, hvis det er nødvendigt, til at passe i den angivne rektangle.
public void DrawImageUnscaledAndClipped(Image sourceImage, Rectangle rect)Parameters
sourceImage Image
Billedet til at drage med.
rect Rectangle
Den Aspose.Imaging.Rectangle, hvor man skal tegne billedet.
Exceptions
sourceImage’ is null.
DrawLine(Størrelse, point og point)
Dræber en linje, der forbinder to Aspose.Imaging.Point strukturer.
public void DrawLine(Pen pen, Point point1, Point point2)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af linjen.
point1 Point
Aspose.Imaging.Point struktur, der repræsenterer det første punkt at forbinde.
point2 Point
Aspose.Imaging.Point struktur, der repræsenterer det andet punkt at forbinde.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.
DrawLine(Pæn, PointF og PointF)
Dræber en linje, der forbinder to Aspose.Imaging.PointF strukturer.
public void DrawLine(Pen pen, PointF point1, PointF point2)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af linjen.
point1 PointF
Aspose.Imaging.PointF struktur, der repræsenterer det første punkt at forbinde.
point2 PointF
Aspose.Imaging.PointF struktur, der repræsenterer det andet punkt at forbinde.
Exceptions
pen’ is null.
DrawLine(Løgn, int, int, int)
Trækker en linje, der forbinder de to punkter, der er angivet af koordinaterne.
public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af linjen.
x1 int
Den x-koordinate af det første punkt.
y1 int
Den y-koordinate af det første punkt.
x2 int
Den x-koordinate af det andet punkt.
y2 int
Y-koordinat af det andet punkt.
Exceptions
pen’ is null.
DrawLine(Flåder, flåder, flåder, flåder)
Trækker en linje, der forbinder de to punkter, der er angivet af koordinaterne.
public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af linjen.
x1 float
Den x-koordinate af det første punkt.
y1 float
Den y-koordinate af det første punkt.
x2 float
Den x-koordinate af det andet punkt.
y2 float
Y-koordinat af det andet punkt.
Exceptions
pen’ is null.
DrawLines(Tænk, point[])
Dræber en serie af linje segmenter, der forbinder en række af Aspose.Imaging.Point strukturer.
public void DrawLines(Pen pen, Point[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af linje segmenter.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der repræsenterer punkterne til at forbinde.
Exceptions
pen’ is null.-or-points’ is null.
Den points’ rækkefølge indeholder mindre end 2 point.
DrawLines(Løgn, pointf[])
Dræber en serie af linje segmenter, der forbinder en række af Aspose.Imaging.PointF strukturer.
public void DrawLines(Pen pen, PointF[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af linje segmenter.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der repræsenterer punkterne til at forbinde.
Exceptions
pen’ is null.-or-points’ is null.
Den points’ rækkefølge indeholder mindre end 2 point.
DrawPath(Pæne, GraphicsPath)
Dræber en Aspose.Imaging.GraphicsPath.
public void DrawPath(Pen pen, GraphicsPath path)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af vejen.
path GraphicsPath
Aspose.Imaging.GraphicsPath til at tegne.
Examples
Disse eksempler gør brug af GraphicsPath og Grafikklasse til at oprette og manipulere Figurer på et billede overflade. Eksemplet skaber et nyt billede (type Tiff), renser overfladen og trækker veje ved hjælp af grafikklassen.
//Create an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create))
{
//Create an instance of TiffOptions and set its various properties
Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
//Set the source for the instance of ImageOptions
tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Color.Wheat);
//Create an instance of GraphicsPath class
Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();
//Create an instance of Figure class
Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();
//Add Shapes to Figure object
figure.AddShape(new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(10f, 10f, 300f, 300f)));
figure.AddShape(new Aspose.Imaging.Shapes.EllipseShape(new Aspose.Imaging.RectangleF(50f, 50f, 300f, 300f)));
figure.AddShape(new Aspose.Imaging.Shapes.PieShape(new Aspose.Imaging.RectangleF(new Aspose.Imaging.PointF(250f, 250f), new Aspose.Imaging.SizeF(200f, 200f)), 0f, 45f));
//Add Figure object to GraphicsPath
graphicspath.AddFigure(figure);
//Draw path with Pen object of color Black
graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.-or-path’ is null.
DrawPie(Pæne, RectangleF, float, float)
Dræber en pie form defineret af en ellipse angivet ved en Aspose.Imaging.RectangleF struktur og to radiale linjer.
public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af pie form.
rect RectangleF
Aspose.Imaging.RectangleF struktur, der repræsenterer den bundende rektangel, som definerer den ellipse, hvorfra pieformen kommer.
startAngle float
Angle målt i grader klokkevis fra x-axis til den første side af pie form.
sweepAngle float
Angle målt i grader klokkevis fra startAngle’ parameter til den anden side af pie form.
Exceptions
pen’ is null.
DrawPie(Flåder, flåder, flåder, flåder, flåder)
Drage en pie form defineret af en ellipse angivet af et koordinat par, en bredde, en højde og to radiale linjer.
public void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af pie form.
x float
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pieformen kommer.
y float
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pieformen kommer.
width float
Width af den binde rektangle, der definerer den ellipse, hvorfra pie formen kommer.
height float
Højden af den bundende rektangle, der definerer den ellipse, hvorfra pieformen kommer.
startAngle float
Angle målt i grader klokkevis fra x-axis til den første side af pie form.
sweepAngle float
Angle målt i grader klokkevis fra startAngle’ parameter til den anden side af pie form.
Exceptions
pen’ is null.
DrawPie(Pæne, Rectangle, Float, Float)
Dræber en pie form defineret af en ellipse angivet ved en Aspose.Imaging.Rectangle struktur og to radiale linjer.
public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af pie form.
rect Rectangle
Aspose.Imaging.Rectangle struktur, der repræsenterer den bundende rektangel, som definerer den ellipse, hvorfra pie form kommer.
startAngle float
Angle målt i grader klokkevis fra x-axis til den første side af pie form.
sweepAngle float
Angle målt i grader klokkevis fra startAngle’ parameter til den anden side af pie form.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.
DrawPie(Tænk, int, int, int, int, int)
Drage en pie form defineret af en ellipse angivet af et koordinat par, en bredde, en højde og to radiale linjer.
public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af pie form.
x int
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pieformen kommer.
y int
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pieformen kommer.
width int
Width af den binde rektangle, der definerer den ellipse, hvorfra pie formen kommer.
height int
Højden af den bundende rektangle, der definerer den ellipse, hvorfra pieformen kommer.
startAngle int
Angle målt i grader klokkevis fra x-axis til den første side af pie form.
sweepAngle int
Angle målt i grader klokkevis fra startAngle’ parameter til den anden side af pie form.
Exceptions
pen’ is null.
DrawPolygon(Løgn, pointf[])
Dræber en polygon defineret af en række Aspose.Imaging.PointF strukturer.
public void DrawPolygon(Pen pen, PointF[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af polygonen.
points PointF
[]
En række Aspose.Imaging.PointF strukturer, der repræsenterer vertikalerne i polygonen.
Exceptions
pen’ is null.-or-points’ is null.
DrawPolygon(Tænk, point[])
Dræber en polygon defineret af en række Aspose.Imaging.Point strukturer.
public void DrawPolygon(Pen pen, Point[] points)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af polygonen.
points Point
[]
Array af Aspose.Imaging.Point strukturer, der repræsenterer vertikalerne i polygonen.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.
DrawRectangle(Pæn, RectangleF)
Dræber en rektangle, der er angivet af en Aspose.Imaging.RectangelF struktur.
public void DrawRectangle(Pen pen, RectangleF rect)Parameters
pen Pen
En Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af rektanglen.
rect RectangleF
En Aspose.Imaging.RectangleF struktur, der repræsenterer rektanglen til at tegne.
Exceptions
pen’ is null.
DrawRectangle(Pæne, Rectangle)
Trækker en rektangle, der er angivet af en Aspose.Imaging.Rectangles struktur.
public void DrawRectangle(Pen pen, Rectangle rect)Parameters
pen Pen
En Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af rektanglen.
rect Rectangle
En Aspose.Imaging.Rectangle struktur, der repræsenterer rektanglen til at tegne.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
pen’ is null.
DrawRectangle(Flåder, flåder, flåder, flåder)
Drage en rektangle angivet af et koordinatpar, en bredde og en højde.
public void DrawRectangle(Pen pen, float x, float y, float width, float height)Parameters
pen Pen
En Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af rektanglen.
x float
X-koordinaten af den øverste venstre hjørne af rektanglen til at tegne.
y float
Den y-koordinate af den øverste venstre hjørne af rektanglen til at tegne.
width float
Den bredde af rektanglen til at tegne.
height float
Højden af rektanglen til at tegne.
Exceptions
pen’ is null.
DrawRectangle(Løgn, int, int, int)
Drage en rektangle angivet af et koordinatpar, en bredde og en højde.
public void DrawRectangle(Pen pen, int x, int y, int width, int height)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af rektanglen.
x int
X-koordinaten af den øverste venstre hjørne af rektanglen til at tegne.
y int
Den y-koordinate af den øverste venstre hjørne af rektanglen til at tegne.
width int
Omfanget af rektanglen til at tegne.
height int
Højden af rektanglen til at tegne.
Exceptions
pen’ is null.
DrawRectangles(Pæn, RectangleF[])
Dræber en række rektangler angivet af Aspose.Imaging.RectangleF strukturer.
public void DrawRectangles(Pen pen, RectangleF[] rects)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af udledningen af rektanglerne.
rects RectangleF
[]
En række af Aspose.Imaging.RectangleF strukturer, der repræsenterer rektanglerne til at tegne.
Exceptions
pen’ is null.-or-rects’ is null.
DrawRectangles(Pæne, Rectangle[])
Dræber en række rektangler angivet af Aspose.Imaging.Rectangle strukturer.
public void DrawRectangles(Pen pen, Rectangle[] rects)Parameters
pen Pen
Aspose.Imaging.Pen, der bestemmer farven, bredden og stilen af udledningen af rektanglerne.
rects Rectangle
[]
Array af Aspose.Imaging.Rectangle strukturer, der repræsenterer rektanglerne til at tegne.
Examples
Dette eksempel viser skabelsen og brugen af Pen-objekter. eksemplet skaber et nyt billede og tegner Rectangles på billedets overflade.
//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();
}Exceptions
pen’ is null.-or-rects’ is null.
DrawString(String, Font, Brush, Float, Float)
Drage den angivne tekststring på det angive sted med de angiverne Aspose.Imaging.Brush og Asposa.Font objekter.
public void DrawString(string s, Font font, Brush brush, float x, float y)Parameters
s string
String til at drage.
font Font
Aspose.Imaging.Font, der definerer tekstformatet i ringen.
brush Brush
Aspose.Imaging.Brush, der bestemmer farven og teksturen af tegnet tekst.
x float
X-koordinaten i den øverste venstre hjørne af den trækte tekst.
y float
Den y-koordinate i den øverste venstre hjørne af den dragte tekst.
Exceptions
brush’ is null.-or-s’ is null.
DrawString(String, Font, Brush og PointF)
Drage den angivne tekststring på det angive sted med de angiverne Aspose.Imaging.Brush og Asposa.Font objekter.
public void DrawString(string s, Font font, Brush brush, PointF point)Parameters
s string
String til at drage.
font Font
Aspose.Imaging.Font, der definerer tekstformatet i ringen.
brush Brush
Aspose.Imaging.Brush, der bestemmer farven og teksturen af tegnet tekst.
point PointF
Aspose.Imaging.PointF struktur, der angiver den øverste venstre hjørne af dragen tekst.
Examples
For at demonstrere operationen skaber eksemplet et nyt billede i PNG-format og tegner primitive former på Image-overfladen ved hjælp af tegningsmetoder, der er udsat af Graphics-klassen.
//Creates an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.png", System.IO.FileMode.Create))
{
//Create an instance of PngOptions and set its various properties
Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
//Set the Source for PngOptions
pngOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(pngOptions, 500, 500))
{
//Create and initialize an instance of Graphics class
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);
//Clear Graphics surface
graphics.Clear(Aspose.Imaging.Color.Wheat);
//Draw an Arc by specifying the Pen object having Black color,
//a Rectangle surrounding the Arc, Start Angle and Sweep Angle
graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), new Aspose.Imaging.Rectangle(200, 200, 100, 200), 0, 300);
//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.
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));
//Draw a Curve by specifying the Pen object having Green color and an array of Points
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) });
//Draw an Ellipse using the Pen object and a surrounding Rectangle
graphics.DrawEllipse(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 2), new Aspose.Imaging.Rectangle(300, 300, 100, 100));
//Draw a Line
graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Violet, 2), new Aspose.Imaging.Point(100, 100), new Aspose.Imaging.Point(200, 200));
//Draw a Pie segment
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);
//Draw a Polygon by specifying the Pen object having Red color and an array of Points
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) });
//Draw a Rectangle
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)));
//Create a SolidBrush object and set its various properties
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Color.Purple;
brush.Opacity = 100;
//Draw a String using the SolidBrush object and Font, at specific Point
graphics.DrawString("This image is created by Aspose.Imaging API", new Aspose.Imaging.Font("Times New Roman", 16), brush, new Aspose.Imaging.PointF(50, 400));
// save all changes.
image.Save();
}
}Exceptions
brush’ is null.-or-s’ is null.
DrawString(String, Font, Brush, Float, Float, StringFormat)
Drage den angivne tekststrin på det angive sted med de angiverne Aspose.Imaging.Brush og Asposa.Imaging.Font objekter ved hjælp af formateringsattributterne af den Angiverede Aspos. Imaging .StringFormat.
public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format)Parameters
s string
String til at drage.
font Font
Aspose.Imaging.Font, der definerer tekstformatet i ringen.
brush Brush
Aspose.Imaging.Brush, der bestemmer farven og teksturen af tegnet tekst.
x float
X-koordinaten i den øverste venstre hjørne af den trækte tekst.
y float
Den y-koordinate i den øverste venstre hjørne af den dragte tekst.
format StringFormat
Aspose.Imaging.StringFormat, der angiver formatering attributter, såsom linjer spacing og alignment, som anvendes til tegnet tekst.
Exceptions
brush’ is null.-or-s’ is null.
DrawString(String, Font, Brush, PointF, StringFormat)
Drage den angivne tekststrin på det angive sted med de angiverne Aspose.Imaging.Brush og Asposa.Imaging.Font objekter ved hjælp af formateringsattributterne af den Angiverede Aspos. Imaging .StringFormat.
public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format)Parameters
s string
String til at drage.
font Font
Aspose.Imaging.Font, der definerer tekstformatet i ringen.
brush Brush
Aspose.Imaging.Brush, der bestemmer farven og teksturen af tegnet tekst.
point PointF
Aspose.Imaging.PointF struktur, der angiver den øverste venstre hjørne af dragen tekst.
format StringFormat
Aspose.Imaging.StringFormat, der angiver formatering attributter, såsom linjer spacing og alignment, som anvendes til tegnet tekst.
Exceptions
brush’ is null.-or-s’ is null.
DrawString(String, Font, Brush, RectangleF)
Dråber den angivne tekststrin i det angive rektangle med de angiverne Aspose.Imaging.Brush og Asposa.Font objekter.
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle)Parameters
s string
String til at drage.
font Font
Aspose.Imaging.Font, der definerer tekstformatet i ringen.
brush Brush
Aspose.Imaging.Brush, der bestemmer farven og teksturen af tegnet tekst.
layoutRectangle RectangleF
Aspose.Imaging.RectangleF struktur, der angiver placeringen af dragen tekst.
Exceptions
brush’ is null.-or-s’ is null.
DrawString(String, Font, Brush, RectangleF, StringFormat)
Drage den angivne tekststråle i det angive rektangle med de angiverne Aspose.Imaging.Brush og Asposa.Imaging.Font objekter ved hjælp af formateringsattributterne af den Angiverede Aspos. Imager.StringFormat.
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)Parameters
s string
String til at drage.
font Font
Aspose.Imaging.Font, der definerer tekstformatet i ringen.
brush Brush
Aspose.Imaging.Brush, der bestemmer farven og teksturen af tegnet tekst.
layoutRectangle RectangleF
Aspose.Imaging.RectangleF struktur, der angiver placeringen af dragen tekst.
format StringFormat
Aspose.Imaging.StringFormat, der angiver formatering attributter, såsom linjer spacing og alignment, som anvendes til tegnet tekst.
Exceptions
brush’ is null.-or-s’ is null.-or-brush’ is null.
EndUpdate()
Caching af de grafiske operationer startede efter BeginUpdate blev kaldt. De foregående grafiske operationer vil blive anvendt på samme tid, når du kalder denne metode.
public void EndUpdate()FillClosedCurve(Brush og PointF[])
Fyller indretningen af en lukket kardinal spline kurve defineret ved en række af Aspose.Imaging.PointF strukturer. Denne metode bruger en standard spænding på 0,5 og Asposa.FillMode.Alternate fylde tilstand.
public void FillClosedCurve(Brush brush, PointF[] points)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
Exceptions
brush’ is null.-or-points’ is null.
FillClosedCurve(Brush og PointF[], af FillMode)
Fyller indretningen af en lukket kardinal spline kurve defineret ved en række af Aspose.Imaging.PointF strukturer ved hjælp af det angivne fyldemodus.
public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillMode)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
fillMode FillMode
Medlem af Aspose.Imaging.FillMode fortegnelse, der bestemmer, hvordan kurven er fyldt.
Exceptions
brush’ is null.-or-points’ is null.
FillClosedCurve(Brush og PointF[], FillMode, Float)
Fyller indretningen af en lukket kardinal spline kurve defineret ved en række af Aspose.Imaging.PointF strukturer ved hjælp af den angivne fyldemodus og spænding.
public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, float tension)Parameters
brush Brush
En Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points PointF
[]
En række af Aspose.Imaging.PointF strukturer, der definerer spline.
fillmode FillMode
Medlem af Aspose.Imaging.FillMode fortegnelse, der bestemmer, hvordan kurven er fyldt.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
brush’ is null.-or-points’ is null.
FillClosedCurve(Brush og Point[])
Fyller indretningen af en lukket kardinal spline kurve defineret ved en række af Aspose.Imaging.Point strukturer. Denne metode bruger en standard spænding på 0,5 og Asposa.FillMode.Alternate fyld mode.
public void FillClosedCurve(Brush brush, Point[] points)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
Exceptions
brush’ is null.-or-points’ is null.
FillClosedCurve(Brush og Point[], af FillMode)
Fyller indretningen af en lukket kardinal spline kurve defineret ved en række af Aspose.Imaging.Point strukturer ved hjælp af den angivne fyldt modus. Denne metode bruger en standard spænding på 0.5.
public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
fillmode FillMode
Medlem af Aspose.Imaging.FillMode fortegnelse, der bestemmer, hvordan kurven er fyldt.
Exceptions
brush’ is null.-or-points’ is null.
FillClosedCurve(Brush og Point[], FillMode, Float)
Fyller indretningen af en lukket kardinal spline kurve defineret ved en række af Aspose.Imaging.Point strukturer ved hjælp af den angivne fyldemodus og spænding.
public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, float tension)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der definerer spline.
fillmode FillMode
Medlem af Aspose.Imaging.FillMode fortegnelse, der bestemmer, hvordan kurven er fyldt.
tension float
Værdi større end eller lig med 0,0F, der angiver spændingen af kurven.
Exceptions
brush’ is null.-or-points’ is null.
FillEllipse(Brush og RectangleF)
Fyller indersiden af en ellipse defineret af et bunden rektangle angivet ved en Aspose.Imaging.RectangelF struktur.
public void FillEllipse(Brush brush, RectangleF rect)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rect RectangleF
Aspose.Imaging.RectangleF struktur, der repræsenterer den bundende rektangel, som definerer ellipse.
Exceptions
brush’ is null.
FillEllipse(Flåder, flåder, flåder, flåder)
Fyller det indre af en ellipse defineret af en grænse rektangle angivet af et par koordinater, en bredde og en højde.
public void FillEllipse(Brush brush, float x, float y, float width, float height)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
x float
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
y float
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
width float
bredden af den bundende rektangle, der definerer ellipsen.
height float
Højden af den bundende rektangle, der definerer ellipse.
Exceptions
brush’ is null.
FillEllipse(Brush og Rectangle)
Fyller indersiden af en ellipse defineret af et bunden rektangle angivet ved en Aspose.Imaging.Rektangel struktur.
public void FillEllipse(Brush brush, Rectangle rect)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rect Rectangle
Aspose.Imaging.Rectangle struktur, der repræsenterer den bundende rektangel, som definerer ellipse.
Exceptions
brush’ is null.
FillEllipse(Brush, int, int, int og int)
Fyller det indre af en ellipse defineret af en grænse rektangle angivet af et par koordinater, en bredde og en højde.
public void FillEllipse(Brush brush, int x, int y, int width, int height)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
x int
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
y int
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer ellipse.
width int
bredden af den bundende rektangle, der definerer ellipsen.
height int
Højden af den bundende rektangle, der definerer ellipse.
Exceptions
brush’ is null.
FillPath(Brush og GraphicsPath)
Fyller indretningen af en Aspose.Imaging.GraphicsPath.
public void FillPath(Brush brush, GraphicsPath path)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
path GraphicsPath
Aspose.Imaging.GrafikPath, der repræsenterer vejen til at udfylde.
Exceptions
brush’ is null.-or-path’ is null.
FillPie(Brush, Rectangle, Float, Float)
Fyller indretningen af en pie sektion defineret af et ellipse angivet ved en Aspose.Imaging.RectangleF struktur og to radiale linjer.
public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rect Rectangle
Aspose.Imaging.Rectangle struktur, der repræsenterer den bundende rektangel, som definerer den ellipse, hvorfra pie sektionen kommer.
startAngle float
Vinkel i grader målt klokkevis fra x-axis til den første side af pie sektionen.
sweepAngle float
Angle i grader målt klokkevis fra startAngle’ parameter til den anden side af pie sektionen.
Examples
Følgende eksempel viser, hvordan man komponerer et animeret GIF-billede fra individuelle Gif-blocker.
string dir = "c:\\temp\\";
// Create a GIF image 100 x 100 px.
// The first block is fully black by default.
using (Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock firstBlock = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100))
using (Aspose.Imaging.FileFormats.Gif.GifImage gifImage = new Aspose.Imaging.FileFormats.Gif.GifImage(firstBlock))
{
// The first circle is red
Aspose.Imaging.Brushes.SolidBrush brush1 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
// The second circle is black
Aspose.Imaging.Brushes.SolidBrush brush2 = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Black);
// Gradually inscrease the angle of the red arc shape.
for (int angle = 10; angle <= 360; angle += 10)
{
Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
gr.FillPie(brush1, block.Bounds, 0, angle);
gifImage.AddBlock(block);
}
// Gradually inscrease the angle of the black arc and wipe out the red arc.
for (int angle = 10; angle <= 360; angle += 10)
{
Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock block = new Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock(100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(block);
gr.FillPie(brush2, block.Bounds, 0, angle);
gr.FillPie(brush1, block.Bounds, angle, 360 - angle);
gifImage.AddBlock(block);
}
gifImage.Save(dir + "animated_radar.gif");
}Exceptions
brush’ is null.
FillPie(Brush, RectangleF, float, float)
Fyller indretningen af en pie sektion defineret af et ellipse angivet ved en Aspose.Imaging.RectangleF struktur og to radiale linjer.
public void FillPie(Brush brush, RectangleF rect, float startAngle, float sweepAngle)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rect RectangleF
Aspose.Imaging.RectangleF struktur, der repræsenterer den bundende rektangel, som definerer den ellipse, hvorfra pie sektionen kommer.
startAngle float
Vinkel i grader målt klokkevis fra x-axis til den første side af pie sektionen.
sweepAngle float
Angle i grader målt klokkevis fra startAngle’ parameter til den anden side af pie sektionen.
Exceptions
brush’ is null.
FillPie(Flåde, flåde, flåde, flåde, flåde, flåde)
Fyller det indre af en pie sektion defineret af en ellipse angivet af et par koordinater, en bredde, en højde og to radiale linjer.
public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
x float
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
y float
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
width float
Width af den binde rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
height float
Højden af den bundende rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
startAngle float
Vinkel i grader målt klokkevis fra x-axis til den første side af pie sektionen.
sweepAngle float
Angle i grader målt klokkevis fra startAngle’ parameter til den anden side af pie sektionen.
Exceptions
brush’ is null.
FillPie(Brush, int, int, int, int, int, int, int)
Fyller det indre af en pie sektion defineret af en ellipse angivet af et par koordinater, en bredde, en højde og to radiale linjer.
public void FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
x int
X-koordinaten af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
y int
Den y-koordinat af det øverste venstre hjørne af den bundende rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
width int
Width af den binde rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
height int
Højden af den bundende rektangle, der definerer den ellipse, hvorfra pie sektionen kommer.
startAngle int
Vinkel i grader målt klokkevis fra x-axis til den første side af pie sektionen.
sweepAngle int
Angle i grader målt klokkevis fra startAngle’ parameter til den anden side af pie sektionen.
Exceptions
brush’ is null.
FillPolygon(Brush og PointF[])
Fyller indretningen af et polygon defineret af en række punkter, der er angivet af Aspose.Imaging.PointF strukturer og Asposa.Imaging.FillMode.Alternate.
public void FillPolygon(Brush brush, PointF[] points)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points PointF
[]
En række Aspose.Imaging.PointF strukturer, der repræsenterer vertikalerne i polygonen til at fylde.
Exceptions
brush’ is null.-or-points’ is null.
FillPolygon(Brush og PointF[], af FillMode)
Fyller indretningen af et polygon defineret af en række punkter, der er angivet af Aspose.Imaging.PointF strukturer ved hjælp af det angivne fyldemodus.
public void FillPolygon(Brush brush, PointF[] points, FillMode fillMode)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points PointF
[]
En række Aspose.Imaging.PointF strukturer, der repræsenterer vertikalerne i polygonen til at fylde.
fillMode FillMode
Medlem af Aspose.Imaging.FillMode-enumerationen, der bestemmer fyldets stil.
Exceptions
brush’ is null.-or-points’ is null.
FillPolygon(Brush og Point[])
Fyller indretningen af et polygon defineret af en række punkter, der er angivet af Aspose.Imaging.Point strukturer og Asposa.Imaging.FillMode.Alternate.
public void FillPolygon(Brush brush, Point[] points)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der repræsenterer vertikalerne i polygonen til at fylde.
Exceptions
brush’ is null.-or-points’ is null.
FillPolygon(Brush og Point[], af FillMode)
Fyller indretningen af en polygon defineret ved en række punkter, der er angivet af Aspose.Imaging.Point strukturer ved hjælp af det angivne fyldemodus.
public void FillPolygon(Brush brush, Point[] points, FillMode fillMode)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
points Point
[]
En række af Aspose.Imaging.Point strukturer, der repræsenterer vertikalerne i polygonen til at fylde.
fillMode FillMode
Medlem af Aspose.Imaging.FillMode-enumerationen, der bestemmer fyldets stil.
Exceptions
brush’ is null.-or-points’ is null.
FillRectangle(Brush og Rectangle)
Fyller det indre af en rektangle, der er angivet ved en Aspose.Imaging.Rektangel struktur.
public void FillRectangle(Brush brush, Rectangle rect)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rect Rectangle
Aspose.Imaging.Rectangle struktur, der repræsenterer rektanglen til at fylde.
Exceptions
brush’ is null.
FillRectangle(Brush og RectangleF)
Fyller det indre af en rektangle, der er angivet ved en Aspose.Imaging.RectangelF struktur.
public void FillRectangle(Brush brush, RectangleF rect)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rect RectangleF
Aspose.Imaging.RectangleF struktur, der repræsenterer rektanglen til at fylde.
Exceptions
brush’ is null.
FillRectangle(Flåder, flåder, flåder, flåder)
Fyller det indre af en rektangle angivet af et par koordinater, en bredde og en højde.
public void FillRectangle(Brush brush, float x, float y, float width, float height)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
x float
X-koordinaten af den øverste venstre hjørne af rektanglen til at fylde.
y float
Y-koordinaten af den øverste venstre hjørne af rektanglen til at fylde.
width float
Hvidden af rektanglen til at fylde.
height float
Højden af rektanglen til at fylde.
Exceptions
brush’ is null.
FillRectangle(Brush, int, int, int og int)
Fyller det indre af en rektangle angivet af et par koordinater, en bredde og en højde.
public void FillRectangle(Brush brush, int x, int y, int width, int height)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
x int
X-koordinaten af den øverste venstre hjørne af rektanglen til at fylde.
y int
Y-koordinaten af den øverste venstre hjørne af rektanglen til at fylde.
width int
Hvidden af rektanglen til at fylde.
height int
Højden af rektanglen til at fylde.
Exceptions
brush’ is null.
FillRectangles(Brush og Rectangle[])
Fyller indretningen af en række rektangler angivet af Aspose.Imaging.Rectangle strukturer.
public void FillRectangles(Brush brush, Rectangle[] rects)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rects Rectangle
[]
Array af Aspose.Imaging.Rectangle strukturer, der repræsenterer rektanglerne til at fylde.
Exceptions
brush’ is null or rects’ is null.
FillRectangles(Brush og RectangleF[])
Fyller indretningen af en række rektangler angivet af Aspose.Imaging.RectangleF strukturer.
public void FillRectangles(Brush brush, RectangleF[] rects)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
rects RectangleF
[]
Array af Aspose.Imaging.Rectangle strukturer, der repræsenterer rektanglerne til at fylde.
Exceptions
brush’ is null or rects’ is null.
FillRegion(Brush, Region)
Fyller indretningen af en Aspose.Imaging.region.
public void FillRegion(Brush brush, Region region)Parameters
brush Brush
Aspose.Imaging.Brush, der bestemmer fyldets egenskaber.
region Region
Aspose.Imaging.Region, der repræsenterer området til at udfylde.
Exceptions
brush’ is null.-or-region’ is null.
~Graphics()
protected ~Graphics()MeasureString(string, Font, SizeF, StringFormat)
Mæler den angivne tekststring med specifikke parametre
public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat)Parameters
text string
Tekst til måling.
font Font
Skemaet skal måles.
layoutArea SizeF
Det er layoutområdet.
stringFormat StringFormat
Det er string format.
Returns
Størrelse i pixels af målt tekststring
MultiplyTransform(Matrix)
Det multiplicerer Aspose.Imaging.Matrix, som repræsenterer den lokale geometriske transformation af denne Aspos.Image.Grafik ved det angivne Aspo.imager.Matrix ved at præpendere den angive Asposa.
public void MultiplyTransform(Matrix matrix)Parameters
matrix Matrix
Den Aspose.Imaging.Matrix, hvorved man må multiplicere den geometriske transformation.
MultiplyTransform(Matrix og MatrixOrder)
Det multiplicerer Aspose.Imaging.Matrix, som repræsenterer den lokale geometriske transformation af denne Aspos.Image.Grafik ved det angivne Asposa. Imaging.Matrix i den angive rækkefølge.
public void MultiplyTransform(Matrix matrix, MatrixOrder order)Parameters
matrix Matrix
Den Aspose.Imaging.Matrix, hvorved man må multiplicere den geometriske transformation.
order MatrixOrder
En Aspose.Imaging.MatrixOrder, der angiver i hvilket formål at multiplicere de to matrices.
ResetTransform()
Det genopretter Aspose.Imaging.Graphics.Transform ejendom til identitet.
public void ResetTransform()RotateTransform(Flåder)
Roterer den lokale geometriske transformation ved det angivne beløb. Denne metode forbinder rotationen til transformationen.
public void RotateTransform(float angle)Parameters
angle float
Det er hjørnet af rotation.
RotateTransform(Skærm, MatrixOrder)
Roterer den lokale geometriske transformation ved det angivne beløb i den angivne rækkefølge.
public void RotateTransform(float angle, MatrixOrder order)Parameters
angle float
Det er hjørnet af rotation.
order MatrixOrder
En Aspose.Imaging.MatrixOrder, der angiver, om man skal tilføje eller forbinde rotationsmatrisen.
ScaleTransform(Flåder, Flåder)
Skala den lokale geometriske transformation ved de angivne mængder. Denne metode forbinder skalaen matrix til transformationen.
public void ScaleTransform(float sx, float sy)Parameters
sx float
Den mængde, hvorpå man skalere transformationen i x-axis retning.
sy float
Den mængde, hvorpå man skalere transformationen i y-axis retning.
ScaleTransform(Flåder, Flåder, MatrixOrder)
Skala den lokale geometriske transformation ved de angivne mængder i den angivne rækkefølge.
public void ScaleTransform(float sx, float sy, MatrixOrder order)Parameters
sx float
Den mængde, hvorpå man skalere transformationen i x-axis retning.
sy float
Den mængde, hvorpå man skalere transformationen i y-axis retning.
order MatrixOrder
En Aspose.Imaging.MatrixOrder, der angiver, om man skal tilføje eller forbinde skalaen matrix.
TranslateTransform(Flåder, Flåder)
Oversætter den lokale geometriske transformation ved de angivne dimensioner. Denne metode forbinder oversættelsen til transformationen.
public void TranslateTransform(float dx, float dy)Parameters
dx float
Værdien af oversættelsen i x.
dy float
Værdien af oversættelsen i y.
TranslateTransform(Flåder, Flåder, MatrixOrder)
Oversætter den lokale geometriske transformation ved de angivne dimensioner i den angivne rækkefølge.
public void TranslateTransform(float dx, float dy, MatrixOrder order)Parameters
dx float
Værdien af oversættelsen i x.
dy float
Værdien af oversættelsen i y.
order MatrixOrder
Den ordre (prepend eller append) i hvilken oversættelsen skal anvendes.