Merge pull request #210 from alessandrojcm/master

Added ImageDrawLine and ImageDrawLineV functions to rtexture.go
This commit is contained in:
Milan Nikolic 2022-10-31 16:27:36 +01:00 committed by GitHub
commit 892ce4892c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -384,6 +384,26 @@ func ImageDraw(dst, src *Image, srcRec, dstRec Rectangle, tint color.RGBA) {
C.ImageDraw(cdst, *csrc, *csrcRec, *cdstRec, *ctint)
}
// ImageDrawLine - Draw line within an image
func ImageDrawLine(dst *Image, startPosX, startPosY, endPosX, endPosY int32, col color.RGBA) {
cdst := dst.cptr()
cstartPosX := (C.int)(startPosX)
cstartPosY := (C.int)(startPosY)
cendPosX := (C.int)(endPosX)
cendPosY := (C.int)(endPosY)
ccolor := colorCptr(col)
C.ImageDrawLine(cdst, cstartPosX, cstartPosY, cendPosX, cendPosY, *ccolor)
}
// ImageDrawLineV - Draw line within an image, vector version
func ImageDrawLineV(dst *Image, start, end Vector2, col color.RGBA) {
cdst := dst.cptr()
cstart := start.cptr()
cend := end.cptr()
ccolor := colorCptr(col)
C.ImageDrawLineV(cdst, *cstart, *cend, *ccolor)
}
// ImageDrawCircle - Draw a filled circle within an image
func ImageDrawCircle(dst *Image, centerX, centerY, radius int32, col color.RGBA) {
cdst := dst.cptr()