GraphicsPath.Warp 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。
重载
Warp(PointF[], RectangleF) |
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。 |
Warp(PointF[], RectangleF, Matrix) |
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。 |
Warp(PointF[], RectangleF, Matrix, WarpMode) |
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。 |
Warp(PointF[], RectangleF, Matrix, WarpMode, Single) |
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。 |
Warp(ReadOnlySpan<PointF>, RectangleF, Matrix, WarpMode, Single) |
Warp(PointF[], RectangleF)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。
public:
void Warp(cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect);
public void Warp (System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect);
member this.Warp : System.Drawing.PointF[] * System.Drawing.RectangleF -> unit
Public Sub Warp (destPoints As PointF(), srcRect As RectangleF)
参数
- destPoints
- PointF[]
一个由 PointF 结构构成的数组,该数组定义由 srcRect
定义的矩形转换到的平行四边形。 该数组可以包含三个或四个元素。 如果数组包含三个元素,则前三个点将隐含平行四边形的右下角。
- srcRect
- RectangleF
一个 RectangleF,表示转换为由 destPoints
定义的平行四边形的矩形。
示例
有关示例,请参阅 Warp(PointF[], RectangleF, Matrix, WarpMode, Single)。
适用于
Warp(PointF[], RectangleF, Matrix)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。
public:
void Warp(cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect, System::Drawing::Drawing2D::Matrix ^ matrix);
public void Warp (System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix? matrix);
public void Warp (System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix matrix);
member this.Warp : System.Drawing.PointF[] * System.Drawing.RectangleF * System.Drawing.Drawing2D.Matrix -> unit
Public Sub Warp (destPoints As PointF(), srcRect As RectangleF, matrix As Matrix)
参数
- destPoints
- PointF[]
一个由 PointF 结构构成的数组,该数组定义由 srcRect
定义的矩形转换到的平行四边形。 该数组可以包含三个或四个元素。 如果数组包含三个元素,则前三个点将隐含平行四边形的右下角。
- srcRect
- RectangleF
一个 RectangleF,表示转换为由 destPoints
定义的平行四边形的矩形。
示例
有关示例,请参阅 Warp(PointF[], RectangleF, Matrix, WarpMode, Single)。
适用于
Warp(PointF[], RectangleF, Matrix, WarpMode)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。
public:
void Warp(cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect, System::Drawing::Drawing2D::Matrix ^ matrix, System::Drawing::Drawing2D::WarpMode warpMode);
public void Warp (System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix? matrix, System.Drawing.Drawing2D.WarpMode warpMode);
public void Warp (System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.WarpMode warpMode);
member this.Warp : System.Drawing.PointF[] * System.Drawing.RectangleF * System.Drawing.Drawing2D.Matrix * System.Drawing.Drawing2D.WarpMode -> unit
Public Sub Warp (destPoints As PointF(), srcRect As RectangleF, matrix As Matrix, warpMode As WarpMode)
参数
- destPoints
- PointF[]
一个由 PointF 结构构成的数组,该数组定义由 srcRect
定义的矩形的平行四边形转换。 该数组可以包含三个或四个元素。 如果数组包含三个元素,则前三个点将隐含平行四边形的右下角。
- srcRect
- RectangleF
一个 RectangleF,表示转换为由 destPoints
定义的平行四边形的矩形。
示例
有关示例,请参阅 Warp(PointF[], RectangleF, Matrix, WarpMode, Single)。
适用于
Warp(PointF[], RectangleF, Matrix, WarpMode, Single)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
将此 GraphicsPath应用由矩形和平行四边形定义的扭曲转换。
public:
void Warp(cli::array <System::Drawing::PointF> ^ destPoints, System::Drawing::RectangleF srcRect, System::Drawing::Drawing2D::Matrix ^ matrix, System::Drawing::Drawing2D::WarpMode warpMode, float flatness);
public void Warp (System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix? matrix, System.Drawing.Drawing2D.WarpMode warpMode, float flatness);
public void Warp (System.Drawing.PointF[] destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Drawing2D.WarpMode warpMode, float flatness);
member this.Warp : System.Drawing.PointF[] * System.Drawing.RectangleF * System.Drawing.Drawing2D.Matrix * System.Drawing.Drawing2D.WarpMode * single -> unit
Public Sub Warp (destPoints As PointF(), srcRect As RectangleF, matrix As Matrix, warpMode As WarpMode, flatness As Single)
参数
- destPoints
- PointF[]
一个由 PointF 结构构成的数组,该数组定义由 srcRect
定义的矩形转换到的平行四边形。 该数组可以包含三个或四个元素。 如果数组包含三个元素,则前三个点将隐含平行四边形的右下角。
- srcRect
- RectangleF
一个 RectangleF,表示转换为由 destPoints
定义的平行四边形的矩形。
示例
下面的代码示例旨在与 Windows 窗体一起使用,它需要 PaintEventArgse
OnPaint 事件对象。 该代码执行以下操作:
创建路径并将一个矩形添加到路径。
将矩形绘制为黑色屏幕。
用透视扭曲来扭曲路径。
将扭曲的矩形(路径)绘制为红色的屏幕。
private:
void WarpExample( PaintEventArgs^ e )
{
// Create a path and add a rectangle.
GraphicsPath^ myPath = gcnew GraphicsPath;
RectangleF srcRect = RectangleF(0,0,100,200);
myPath->AddRectangle( srcRect );
// Draw the source path (rectangle)to the screen.
e->Graphics->DrawPath( Pens::Black, myPath );
// Create a destination for the warped rectangle.
PointF point1 = PointF(200,200);
PointF point2 = PointF(400,250);
PointF point3 = PointF(220,400);
array<PointF>^ destPoints = {point1,point2,point3};
// Create a translation matrix.
Matrix^ translateMatrix = gcnew Matrix;
translateMatrix->Translate( 100, 0 );
// Warp the source path (rectangle).
myPath->Warp( destPoints, srcRect, translateMatrix, WarpMode::Perspective, 0.5f );
// Draw the warped path (rectangle) to the screen.
e->Graphics->DrawPath( gcnew Pen( Color::Red ), myPath );
}
private void WarpExample(PaintEventArgs e)
{
// Create a path and add a rectangle.
GraphicsPath myPath = new GraphicsPath();
RectangleF srcRect = new RectangleF(0, 0, 100, 200);
myPath.AddRectangle(srcRect);
// Draw the source path (rectangle)to the screen.
e.Graphics.DrawPath(Pens.Black, myPath);
// Create a destination for the warped rectangle.
PointF point1 = new PointF(200, 200);
PointF point2 = new PointF(400, 250);
PointF point3 = new PointF(220, 400);
PointF[] destPoints = {point1, point2, point3};
// Create a translation matrix.
Matrix translateMatrix = new Matrix();
translateMatrix.Translate(100, 0);
// Warp the source path (rectangle).
myPath.Warp(destPoints, srcRect, translateMatrix,
WarpMode.Perspective, 0.5f);
// Draw the warped path (rectangle) to the screen.
e.Graphics.DrawPath(new Pen(Color.Red), myPath);
}
Public Sub WarpExample(ByVal e As PaintEventArgs)
' Create a path and add a rectangle.
Dim myPath As New GraphicsPath
Dim srcRect As New RectangleF(0, 0, 100, 200)
myPath.AddRectangle(srcRect)
' Draw the source path (rectangle)to the screen.
e.Graphics.DrawPath(Pens.Black, myPath)
' Create a destination for the warped rectangle.
Dim point1 As New PointF(200, 200)
Dim point2 As New PointF(400, 250)
Dim point3 As New PointF(220, 400)
Dim destPoints As PointF() = {point1, point2, point3}
' Create a translation matrix.
Dim translateMatrix As New Matrix
translateMatrix.Translate(100, 0)
' Warp the source path (rectangle).
myPath.Warp(destPoints, srcRect, translateMatrix, _
WarpMode.Perspective, 0.5F)
' Draw the warped path (rectangle) to the screen.
e.Graphics.DrawPath(New Pen(Color.Red), myPath)
End Sub
适用于
Warp(ReadOnlySpan<PointF>, RectangleF, Matrix, WarpMode, Single)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
public void Warp (ReadOnlySpan<System.Drawing.PointF> destPoints, System.Drawing.RectangleF srcRect, System.Drawing.Drawing2D.Matrix? matrix = default, System.Drawing.Drawing2D.WarpMode warpMode = System.Drawing.Drawing2D.WarpMode.Perspective, float flatness = 0.25);
member this.Warp : ReadOnlySpan<System.Drawing.PointF> * System.Drawing.RectangleF * System.Drawing.Drawing2D.Matrix * System.Drawing.Drawing2D.WarpMode * single -> unit
Public Sub Warp (destPoints As ReadOnlySpan(Of PointF), srcRect As RectangleF, Optional matrix As Matrix = Nothing, Optional warpMode As WarpMode = System.Drawing.Drawing2D.WarpMode.Perspective, Optional flatness As Single = 0.25)
参数
- destPoints
- ReadOnlySpan<PointF>
- srcRect
- RectangleF
- matrix
- Matrix
- warpMode
- WarpMode
- flatness
- Single