GraphicsPath.Warp 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
對此 GraphicsPath施加由矩形和平行四邊形定義的曲速轉換。
多載
| 名稱 | Description |
|---|---|
| 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) |
對此 GraphicsPath施加由矩形和平行四邊形定義的曲速轉換。 |
Warp(PointF[], RectangleF)
對此 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
A RectangleF 代表被轉換成由 destPoints定義的平行四邊形的矩形。
範例
如需範例,請參閱 Warp(PointF[], RectangleF, Matrix, WarpMode, Single)。
適用於
Warp(PointF[], RectangleF, Matrix)
對此 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
A RectangleF 代表被轉換成由 destPoints定義的平行四邊形的矩形。
範例
如需範例,請參閱 Warp(PointF[], RectangleF, Matrix, WarpMode, Single)。
適用於
Warp(PointF[], RectangleF, Matrix, WarpMode)
對此 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
A RectangleF 代表被轉換成由 destPoints定義的平行四邊形的矩形。
範例
如需範例,請參閱 Warp(PointF[], RectangleF, Matrix, WarpMode, Single)。
適用於
Warp(PointF[], RectangleF, Matrix, WarpMode, Single)
對此 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
A RectangleF 代表被轉換成由 destPoints定義的平行四邊形的矩形。
範例
以下程式碼範例是為 Windows Forms 設計,並需要 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)
對此 GraphicsPath施加由矩形和平行四邊形定義的曲速轉換。
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 轉換為該點。
- srcRect
- RectangleF
一個矩形,代表被轉換成由 destPoints定義的平行四邊形的矩形。
- matrix
- Matrix
一個矩陣,指定一個幾何變換要應用於路徑。
- warpMode
- WarpMode
指定此曲速操作是否使用透視模式或雙線性模式。
- flatness
- Single
一個從 0 到 1 的值,用來指定最終路徑的平坦程度。 欲了解更多資訊,請參閱方法。Flatten(Matrix, Single)
備註
對於 destPoints,陣列可以包含三個或四個元素。 若陣列包含三個元素,平行四邊形右下角由前三個點所隱含。