Drawing a Point?
- 主要言語
- Go
- スター
- 8.4k
- フォーク
- 639
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi,
due to the lack of a function to brush freehand, I tried to draw a single pixel with Lineto, but it crashes unsafe.
Here is the code:
```
func (t areaHandlerDraw) Draw(a *ui.Area, dp *ui.AreaDrawParams) {
var brush ui.Brush
brush.Type = ui.Solid
var p = ui.NewPath(ui.Winding)
var sp ui.StrokeParams
for x := 0; x < pic.Bounds().Max.X; x++ {
for y := 0; y < pic.Bounds().Max.Y; y++ {
r, g, b, alpha := pic.At(x, y).RGBA()
brush.A = float64(alpha)
brush.R = float64(r)
brush.G = float64(g)
brush.B = float64(b)
//brush.X0 = float64(x)
//brush.Y0 = float64(y)
p.NewFigure(float64(x), float64(y))
p.LineTo(float64(x), float64(y))
sp.Thickness = 1.0
dp.Context.Stroke(p, &brush, &sp)
//dp.Context.Save()
}
}
return
}
```
Pic is loaded in a function before and declared accessable by all functions.
Greetings Björn
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。