maxvalue binding
This commit is contained in:
parent
fbea9488f0
commit
4b57a41705
@ -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
12
tests/maths.py
Normal 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
|
Loading…
Reference in New Issue
Block a user