freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

圖形圖像與多媒體編程培訓(xùn)課件(編輯修改稿)

2025-02-11 02:19 本頁面
 

【文章內(nèi)容簡介】 new Point(45,150), new Point(25,150),new Point(0,100) }。(pen, points)。points =new Point[]{ new Point(250,50),new Point(300,100),new Point(275,150), new Point(225,150),new Point(200,100)}。(new SolidBrush(),points)。}3738曲線 這里所講的曲線是指自定義曲線,自定義曲線有兩種形式:打開的曲線和封閉的曲線 在 Graphics類中,繪制自定義曲線的方法有: ? DrawCurve()方法 ? DrawClosedCurve()方法 以及應(yīng)用廣泛的繪制貝塞爾曲線的 ? DrawBezier()方法?DrawBeziers()方法。 39 DrawCurve()方法 這個方法用光滑的曲線把給定的點連接起來,常用形式有: ? public void DrawCurve(Pen pen, Point[] points) 其中, Point結(jié)構(gòu)類型的數(shù)組中指明各節(jié)點,默認彎曲強度為 ,注意數(shù)組中至少要有 4個元素。 ?public void DrawCurve(Pen pen, Point[] points, float tension) 其中 tension指定彎曲強度,該值范圍為 ~ ,超出此范圍會產(chǎn)生異常,當(dāng)彎曲強度為零時,就是直線。 40【例】繪制直線與平滑曲線。private void Form1_Paint(object sender, e){Pen redPen = new Pen(, 3)。Pen greenPen = new Pen(, 3)。Point[] curvePoints ={new Point( 50, 250),new Point(100, 25),new Point(200, 250),new Point(250, 50),new Point(300, 75),new Point(350, 200),new Point(400, 150)}。(redPen, curvePoints)。(greenPen, curvePoints)。}4142 DrawClosedCurve()方法 這個方法也是用平滑的曲線將各節(jié)點連接起來,但會自動把首尾節(jié)點連接起來構(gòu)成封閉曲線。貝塞爾曲線 每段貝塞爾曲線都需要四個點,第一個點是起始點,第四個點是終止點,第二個點和第三個點控制曲線的形狀。使用DrawBezier()方法繪制一段貝塞爾曲線,使用 DrawBeziers()方法繪制多段貝塞爾曲線。常用形式有: ? public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4) 其中 pt pt pt pt4分別指定四個點。 ? public void DrawBezier(Pen pen, Point[] points) 其中 points是 Point結(jié)構(gòu)的數(shù)組,第一段貝塞爾曲線從點數(shù)組中的第一個點到第四個點繪制而成。以后每段曲線只需要三個點:兩個控制點和一個結(jié)束點。前一段曲線的結(jié)束點會自動用作后一段曲線的起始點。 43【例】繪制貝塞爾曲線。private void Form1_Paint(object sender, e) {Pen blackPen = new Pen(, 3)。Point[] bezierPoints ={ new Point(50, 100),new Point(100, 10),new Point(150,290),new Point(200, 100),new Point(250,10),new Point(300, 290),new Point(350,100) }。(blackPen, bezierPoints)。 }4445 橢圓 橢圓是一種特殊的封閉曲線, Graphics類專門提供了繪制橢圓的兩種方法: DrawEllipse()方法和 FillEllipse()方法。常用形式有: ? public void DrawEllipse(Pen pen, Rectangle rect) 其中 rect為 Rectangle結(jié)構(gòu),用于確定橢圓的邊界。 ?public void DrawEllipse(Pen pen, int x, int y, int width, int height) 其中 x, y為橢圓左上角的坐標(biāo), width定義橢圓的邊框的寬度,height定義橢圓的邊框的高度。 ?public void FillEllipse(Pen pen, Rectangle rect) 填充橢圓的內(nèi)部區(qū)域。其中 rect為 Rectangle結(jié)構(gòu),用于確定橢圓的邊界。 ?public void FillEllipse(Pen pen, int x, int y, int width, int height) 填充橢圓的內(nèi)部區(qū)域。其中 x,y為橢圓左上角的坐標(biāo), width定義橢圓的邊框的寬度 ,height定義橢圓的邊框的高度。 46 顯示圖像 可以使用 GDI+ 顯示以文件形式存在的圖像。圖像文件可以是 BMP、 JPEG、 GIF、 TIFF、 PNG等。實現(xiàn)步驟為: ?創(chuàng)建一個 Bitmap對象,指明要顯示的圖像文件; ?創(chuàng)建一個 Graphics對象,表示要使用的繪圖平面; ? 調(diào)用 Graphics 對象的 DrawImage 方法顯示圖像。 ⑴ 創(chuàng)建 Bitmap對象 Bitmap類有很多重載的構(gòu)造函數(shù),其中之一是: Public Bitmap(string filename) 可以利用該構(gòu)造函數(shù)創(chuàng)建 Bitmap對象,例如: Bitmap bitmap = new Bitmap(“”)。 47⑵ DrawImage()方法 Graphics類的 DrawImage()方法用于在指定位置顯示原始圖像或者縮放后的圖像。該方法的重載形式非常多,其中之一為: public void DrawImage(Image image, int x, int y, int width, int height) 該方法在 x,y按指定的大小顯示圖像。利用這個方法可以直接顯示縮放后的圖像。 【例】假設(shè)窗體中有一個 Button按鈕 button1,可以在單擊按鈕的事件代碼中顯示圖像。private void button1_Click(object sender, e){Bitmap bitmap = new Bitmap(d:\test\)。Graphics g = ()。(bitmap,3,10,200,200)。(bitmap,250,10,50,50)。(bitmap,350,10, )。}4849保存圖像 使用畫圖功能在窗體上繪制出圖形或者圖像后,可以以多種格式保存到圖像文件中 . 下面的例子說明了具體的用法。【例】將繪制的圖形或圖像保存到文件中。 ⑴ 創(chuàng)建一個 Windows 應(yīng)用程序,設(shè)計畫面: 50⑵ 添加名稱空間引用using 。⑶ 添加【畫圖】按鈕的 Click事件代碼private void button1_Click(object sender, e){Graphics g = ()。DrawMyImage(g)。 }⑷ 添加調(diào)用的方法private void DrawMyImage(Graphics g){Rectangle rect1=new Rectangle(0,0, )。HatchBrush hatchBrush = new HatchBrush(, , )。(hatchBrush, rect1)。Rectangle rect2=new Rectangle(+50,0, ,)。51hatchBrush = new HatchBrush(, , )。(hatchBrush,rect2)。int x=。Point[] points =new Point[] { new Point(x,10),new Point(x+50,60),new Point(x+150,10),new Point(x+200,160),new Point(x+150,260),new Point(x+50,260),new Point(x,160)}。hatchBrush = new HatchBrush(, , )。TextureBrush myBrush = new TextureBrush(new Bitmap(e:\test\))。(myBrush,points)。 }52⑸ 添加【保存】按鈕的 Click事件代碼private void button2_Click(object sender, e){//構(gòu)造一個指定區(qū)域的空圖像Bitmap image=new Bitmap(,)。//根據(jù)指定區(qū)域得到 Graphics對象Graphics g=(image)。//設(shè)置圖像的背景色()。//將圖形畫到 Graphics對象中DrawMyImage(g)。try {//保存畫到 Graphics對象中的圖形(d:\test\,)。53g=()。Rectangle rect=new Rectangle(0,0,100)。(new SolidBrush(),rect)。(保存成功! ,恭喜 )。}catch(Exception err){()。 }} ⑹ 添加【顯示】按鈕的 Click事件代碼private void button3_Click(object sender, e){Rectangle rect=new Rectangle(0,0,100)。Graphics g=()。Image image=new Bitmap(d:\test\)。(image,rect)。}5455動畫設(shè)計 分別
點擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1