ebiten: add comments at DrawTriangles

This commit is contained in:
Hajime Hoshi 2022-04-26 23:23:31 +09:00
parent a0e1d08123
commit b1bcbbeeea
2 changed files with 9 additions and 1 deletions

View File

@ -30,7 +30,10 @@ import (
)
var (
emptyImage = ebiten.NewImage(3, 3)
emptyImage = ebiten.NewImage(3, 3)
// emptySubImage is an internal sub image of emptyImage.
// Use emptySubImage at DrawTriangles instead of emptyImage in order to avoid bleeding edges.
emptySubImage = emptyImage.SubImage(image.Rect(1, 1, 2, 2)).(*ebiten.Image)
)

View File

@ -276,6 +276,11 @@ const MaxIndicesNum = graphics.IndicesNum
// DrawTriangles draws triangles with the specified vertices and their indices.
//
// img is used as a source image. img cannot be nil.
// If you want to draw triangles with a solid color, use a small white image
// and adjust the color elements in the vertices. For an actual implementation,
// see the example 'vector'.
//
// Vertex contains color values, which are interpreted as straight-alpha colors.
//
// If len(indices) is not multiple of 3, DrawTriangles panics.