ColorLerp function added
This commit is contained in:
parent
090dbf62ef
commit
9d16da4548
2 changed files with 17 additions and 0 deletions
|
@ -362,6 +362,7 @@ var colorBrightness func(col uintptr, factor float32) uintptr
|
||||||
var colorContrast func(col uintptr, contrast float32) uintptr
|
var colorContrast func(col uintptr, contrast float32) uintptr
|
||||||
var colorAlpha func(col uintptr, alpha float32) uintptr
|
var colorAlpha func(col uintptr, alpha float32) uintptr
|
||||||
var colorAlphaBlend func(dst uintptr, src uintptr, tint uintptr) uintptr
|
var colorAlphaBlend func(dst uintptr, src uintptr, tint uintptr) uintptr
|
||||||
|
var colorLerp func(col1, col2 uintptr, factor float32) uintptr
|
||||||
var getColor func(hexValue uint32) uintptr
|
var getColor func(hexValue uint32) uintptr
|
||||||
var getPixelColor func(srcPtr unsafe.Pointer, format int32) uintptr
|
var getPixelColor func(srcPtr unsafe.Pointer, format int32) uintptr
|
||||||
var setPixelColor func(dstPtr unsafe.Pointer, col uintptr, format int32)
|
var setPixelColor func(dstPtr unsafe.Pointer, col uintptr, format int32)
|
||||||
|
@ -874,6 +875,7 @@ func init() {
|
||||||
purego.RegisterLibFunc(&colorContrast, raylibDll, "ColorContrast")
|
purego.RegisterLibFunc(&colorContrast, raylibDll, "ColorContrast")
|
||||||
purego.RegisterLibFunc(&colorAlpha, raylibDll, "ColorAlpha")
|
purego.RegisterLibFunc(&colorAlpha, raylibDll, "ColorAlpha")
|
||||||
purego.RegisterLibFunc(&colorAlphaBlend, raylibDll, "ColorAlphaBlend")
|
purego.RegisterLibFunc(&colorAlphaBlend, raylibDll, "ColorAlphaBlend")
|
||||||
|
purego.RegisterLibFunc(&colorLerp, raylibDll, "ColorLerp")
|
||||||
purego.RegisterLibFunc(&getColor, raylibDll, "GetColor")
|
purego.RegisterLibFunc(&getColor, raylibDll, "GetColor")
|
||||||
purego.RegisterLibFunc(&getPixelColor, raylibDll, "GetPixelColor")
|
purego.RegisterLibFunc(&getPixelColor, raylibDll, "GetPixelColor")
|
||||||
purego.RegisterLibFunc(&setPixelColor, raylibDll, "SetPixelColor")
|
purego.RegisterLibFunc(&setPixelColor, raylibDll, "SetPixelColor")
|
||||||
|
@ -2957,6 +2959,12 @@ func ColorAlphaBlend(dst color.RGBA, src color.RGBA, tint color.RGBA) color.RGBA
|
||||||
return *(*color.RGBA)(unsafe.Pointer(&ret))
|
return *(*color.RGBA)(unsafe.Pointer(&ret))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ColorLerp - Get color lerp interpolation between two colors, factor [0.0f..1.0f]
|
||||||
|
func ColorLerp(col1, col2 color.RGBA, factor float32) color.RGBA {
|
||||||
|
ret := colorLerp(*(*uintptr)(unsafe.Pointer(&col1)), *(*uintptr)(unsafe.Pointer(&col2)), factor)
|
||||||
|
return *(*color.RGBA)(unsafe.Pointer(&ret))
|
||||||
|
}
|
||||||
|
|
||||||
// GetColor - Get Color structure from hexadecimal value
|
// GetColor - Get Color structure from hexadecimal value
|
||||||
func GetColor(hexValue uint) color.RGBA {
|
func GetColor(hexValue uint) color.RGBA {
|
||||||
ret := getColor(uint32(hexValue))
|
ret := getColor(uint32(hexValue))
|
||||||
|
|
|
@ -853,6 +853,15 @@ func ColorAlphaBlend(src, dst, tint color.RGBA) color.RGBA {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ColorLerp - Get color lerp interpolation between two colors, factor [0.0f..1.0f]
|
||||||
|
func ColorLerp(col1, col2 color.RGBA, factor float32) color.RGBA {
|
||||||
|
ccol1 := colorCptr(col1)
|
||||||
|
ccol2 := colorCptr(col2)
|
||||||
|
ret := C.ColorLerp(*ccol1, *ccol2, C.float(factor))
|
||||||
|
v := newColorFromPointer(unsafe.Pointer(&ret))
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// GetColor - Returns a Color struct from hexadecimal value
|
// GetColor - Returns a Color struct from hexadecimal value
|
||||||
func GetColor(hexValue uint) color.RGBA {
|
func GetColor(hexValue uint) color.RGBA {
|
||||||
chexValue := (C.uint)(hexValue)
|
chexValue := (C.uint)(hexValue)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue