筆記一 畫筆 筆刷認識

2021-06-18 13:27:31 字數 4048 閱讀 6323

pen主要畫線(直線、矩形、圓等)

brush主要用於填充

'畫橢圓

pen1.dashstyle = drawing2d.dashstyle.dashdotdot '重設線型

pen1.color = color.blueviolet

gr.drawellipse(pen1, 10, 10, 200, 200)

gr.dispose()

end sub

private sub button2_click(sender as object, e as eventargs) handles button2.click

picturebox1.refresh()

pen1.color = color.green

pen1.dashstyle = drawing2d.dashstyle.dot

pen1.width = 1

dim x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, r, s, t, u as single

for a as single = 0 to 2 * pi step pi / 120

x1 = 240 + 30 * cos(a)

y1 = 160 + 15 * sin(a)

r = 60 * (1 + 1 / 6 * sin(3 * a))

s = 80 * (1 + 1 / 6 * sin(4 * a))

t = 100 * (1 + 1 / 6 * sin(5 * a))

u = 140 * (1 + 1 / 8 * sin(6 * a))

x2 = r * cos(a + pi / 20) + 240

y2 = r * sin(a + pi / 20) + 160

x3 = s * cos(a) + 240

y3 = s * sin(a) + 160

x4 = t * cos(a + pi / 20) + 240

y4 = t * sin(a + pi / 20) + 160

x5 = 1.5 * u * cos(a) + 240

y5 = u * sin(a) + 160

pen1.color = color.red

gr = picturebox1.creategraphics

gr.drawline(pen1, x1, y1, x2, y2)

pen1.color = color.blueviolet

gr.drawline(pen1, x2, y2, x3, y3)

pen1.color = color.red

gr.drawline(pen1, x3, y3, x4, y4)

pen1.color = color.greenyellow

gr.drawline(pen1, x4, y4, x5, y5)

next

end sub

private sub button3_click(sender as object, e as eventargs) handles button3.click

'hatchbrush() 陰影筆刷

'lineargradientbrush 線性漸變筆刷

'solidbrush 單色筆刷

'texturebrush 紋理筆刷

'pathgradientbrus 漸變色填充

'陰影筆刷(十字圖案)

dim br1 as system.drawing.drawing2d.hatchbrush

br1 = new system.drawing.drawing2d.hatchbrush(drawing2d.hatchstyle.cross, color.red, color.black)

gr = picturebox1.creategraphics

gr.fillellipse(br1, 250, 0, 100, 150)

br1.dispose()

'線性漸變筆刷

dim br2 as system.drawing.drawing2d.lineargradientbrush

dim p1 as new point(140, 140) 'p1,p2控制漸變頻率

dim p2 as new point(160, 170)

br2 = new system.drawing.drawing2d.lineargradientbrush(p1, p2, color.red, color.black)

gr.fillrectangle(br2, 150, 150, 100, 50)

br2.dispose()

'漸變色填充(不規則或多邊形)

dim p(2) as point '建立path

p(0).x = 0 : p(0).y = 0

p(1).x = 20 : p(1).y = 10

p(2).x = 11 : p(2).y = 22

dim br3 as system.drawing.drawing2d.pathgradientbrush

br3 = new system.drawing.drawing2d.pathgradientbrush(p, drawing.drawing2d.wrapmode.tile)

br3.centercolor = color.blue '中心色

br3.surroundcolors = new color() '邊沿色對應各點數,除非是圓(一種色)

br3.centerpoint = new point(11, 15) '指定中心點

仔細一看上面pathgradientbrush筆刷,發現每個不規則封閉圖形中好像有「間距」,

我們放大看一下,原來,並不是間距,而是以這個不規則圖外沿作為乙個矩形,「平輔」到整個圖形中。

新增一下輔助線,就可以清晰看出它成圖的原因了:

windows程式設計筆記 八 畫筆與畫刷

在使用winapi繪圖的話,先要定義畫筆和畫刷 他們都是gui中所定義的圖形物件。hpen createpen int 樣式,int 寬度,rgb 255,0,0 建立畫筆 hbrush createhatchbrush int 樣式,rgb 255,0,0 建立陰影畫刷 hbrush create...

PS筆刷 80個自定義繪畫畫筆工具筆刷套裝

80個自定義繪畫畫筆工具筆刷套裝分享給大家,這是一套適用於adobe photoshop的特效筆刷合集,可以幫助使用者製造各種各樣的獨特的效果。專業人士或者業餘愛好者都非常適用。本站提供ps筆刷安裝教程,可以幫助使用者輕鬆匯入ps軟體使用。我每天都會使用我的自定義畫筆和工具預設進行素描和製作。這些刷...

LaTeX學習筆記 一 畫重點

如果你對word的排版效果不滿意?投稿期刊要求用latex排版?讓我們通過乙個例子來瞧瞧latex的強大吧!pprimef p t 1f t d t sum f p int f t mathrm pi t pprime f p t 1 f t d t 如下 sum f p int f t mathr...