ImageFromChannel function added
This commit is contained in:
parent
23f1ab19b7
commit
bf03596ee4
2 changed files with 18 additions and 0 deletions
|
@ -276,6 +276,7 @@ var genImageCellular func(image uintptr, width int32, height int32, tileSize int
|
||||||
var genImageText func(image uintptr, width int32, height int32, text string)
|
var genImageText func(image uintptr, width int32, height int32, text string)
|
||||||
var imageCopy func(retImage uintptr, image uintptr)
|
var imageCopy func(retImage uintptr, image uintptr)
|
||||||
var imageFromImage func(retImage uintptr, image uintptr, rec uintptr)
|
var imageFromImage func(retImage uintptr, image uintptr, rec uintptr)
|
||||||
|
var imageFromChannel func(retImage uintptr, image uintptr, selectedChannel int32)
|
||||||
var imageText func(retImage uintptr, text string, fontSize int32, col uintptr)
|
var imageText func(retImage uintptr, text string, fontSize int32, col uintptr)
|
||||||
var imageTextEx func(retImage uintptr, font uintptr, text string, fontSize float32, spacing float32, tint uintptr)
|
var imageTextEx func(retImage uintptr, font uintptr, text string, fontSize float32, spacing float32, tint uintptr)
|
||||||
var imageFormat func(image *Image, newFormat int32)
|
var imageFormat func(image *Image, newFormat int32)
|
||||||
|
@ -780,6 +781,7 @@ func init() {
|
||||||
purego.RegisterLibFunc(&genImageText, raylibDll, "GenImageText")
|
purego.RegisterLibFunc(&genImageText, raylibDll, "GenImageText")
|
||||||
purego.RegisterLibFunc(&imageCopy, raylibDll, "ImageCopy")
|
purego.RegisterLibFunc(&imageCopy, raylibDll, "ImageCopy")
|
||||||
purego.RegisterLibFunc(&imageFromImage, raylibDll, "ImageFromImage")
|
purego.RegisterLibFunc(&imageFromImage, raylibDll, "ImageFromImage")
|
||||||
|
purego.RegisterLibFunc(&imageFromChannel, raylibDll, "ImageFromChannel")
|
||||||
purego.RegisterLibFunc(&imageText, raylibDll, "ImageText")
|
purego.RegisterLibFunc(&imageText, raylibDll, "ImageText")
|
||||||
purego.RegisterLibFunc(&imageTextEx, raylibDll, "ImageTextEx")
|
purego.RegisterLibFunc(&imageTextEx, raylibDll, "ImageTextEx")
|
||||||
purego.RegisterLibFunc(&imageFormat, raylibDll, "ImageFormat")
|
purego.RegisterLibFunc(&imageFormat, raylibDll, "ImageFormat")
|
||||||
|
@ -2472,6 +2474,13 @@ func ImageFromImage(image Image, rec Rectangle) Image {
|
||||||
return retImage
|
return retImage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ImageFromChannel - Create an image from a selected channel of another image (GRAYSCALE)
|
||||||
|
func ImageFromChannel(image Image, selectedChannel int32) Image {
|
||||||
|
var retImage Image
|
||||||
|
imageFromChannel(uintptr(unsafe.Pointer(&retImage)), uintptr(unsafe.Pointer(&image)), selectedChannel)
|
||||||
|
return retImage
|
||||||
|
}
|
||||||
|
|
||||||
// ImageText - Create an image from text (default font)
|
// ImageText - Create an image from text (default font)
|
||||||
func ImageText(text string, fontSize int32, col color.RGBA) Image {
|
func ImageText(text string, fontSize int32, col color.RGBA) Image {
|
||||||
var retImage Image
|
var retImage Image
|
||||||
|
|
|
@ -292,6 +292,15 @@ func ImageFromImage(image Image, rec Rectangle) Image {
|
||||||
return *v
|
return *v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ImageFromChannel - Create an image from a selected channel of another image (GRAYSCALE)
|
||||||
|
func ImageFromChannel(image Image, selectedChannel int32) Image {
|
||||||
|
cimage := image.cptr()
|
||||||
|
cselectedChannel := C.int(selectedChannel)
|
||||||
|
ret := C.ImageFromChannel(*cimage, cselectedChannel)
|
||||||
|
v := newImageFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return *v
|
||||||
|
}
|
||||||
|
|
||||||
// ImageText - Create an image from text (default font)
|
// ImageText - Create an image from text (default font)
|
||||||
func ImageText(text string, fontSize int32, col color.RGBA) *Image {
|
func ImageText(text string, fontSize int32, col color.RGBA) *Image {
|
||||||
ctext := C.CString(text)
|
ctext := C.CString(text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue