maxvalue binding

This commit is contained in:
Mutah 2021-05-14 09:44:28 +02:00
parent fbea9488f0
commit 4b57a41705
2 changed files with 20 additions and 0 deletions

View File

@ -176,6 +176,9 @@ c_fimg_load_from_png = LIB.fimg_load_from_png
c_fimg_load_from_png.argtypes = (ct.c_char_p, ct.POINTER(C_FloatImg))
c_fimg_load_from_png.restype = ct.c_int
c_fimg_get_maxvalue = LIB.fimg_get_maxvalue
c_fimg_get_maxvalue.argtypes = (ct.POINTER(C_FloatImg),)
c_fimg_get_maxvalue.restype = ct.c_float
############################################################################################################
class FloatImg:
@ -337,6 +340,11 @@ class FloatImg:
== 0
)
#######################################################################################################
def maxvalue(self):
"""return the maximum value for any channel in the image"""
return c_fimg_get_maxvalue(self.c_img_p)
###########################################################################################################
def fileinfos(fname):

12
tests/maths.py Normal file
View File

@ -0,0 +1,12 @@
"""test of core functions """
import floatimg
def test_maxvaalue():
width = 5
height = 5
img = floatimg.create_rgb(width, height)
color = (255.0, 255.0, 255.0)
img.put(2,2, color)
assert img.maxvalue() == 255.0ls