Compare commits

..

No commits in common. "2342a9e2a8cd3c1cf33ca0edef3293fd0ebfe215" and "fbea9488f0af71ba62843dd7109c72ecf2c9ca6d" have entirely different histories.

3 changed files with 4 additions and 40 deletions

View File

@ -49,7 +49,7 @@ new_img = img.clone()
new_img = img.clone(True) new_img = img.clone(True)
``` ```
### Basic pixel operations ### Basic pixel manipulation
```python ```python
# Get pixel value # Get pixel value
@ -65,7 +65,7 @@ img.clear()
img.copy_data(another_img) img.copy_data(another_img)
``` ```
### File operations ### File manipulation
#### Raw dump files #### Raw dump files
@ -135,18 +135,3 @@ Ensure `floatimg` containing path is in the `PYTHONPATH`, this will run the test
pytest --cov=floatimg tests/* pytest --cov=floatimg tests/*
``` ```
### Status
The goal is not to bind all the functions but essential ones too build a front-end with python-tkinter.
#### Done
- lib/fimg-core.c
- lib/fimg-file.c
- lib/operator.c
- funcs/exporter.c
- funcs/fimg-png.c
#### Partial
- lib/fimg-math.c

View File

@ -176,9 +176,6 @@ 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.argtypes = (ct.c_char_p, ct.POINTER(C_FloatImg))
c_fimg_load_from_png.restype = ct.c_int 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: class FloatImg:
@ -319,16 +316,15 @@ class FloatImg:
"""return a new image with minimum pixel values per channel between current and parameter""" """return a new image with minimum pixel values per channel between current and parameter"""
res = self.clone(False) res = self.clone(False)
# C code inverts comparison # C code inverts comparison
assert c_fimg_minimum(self.c_img_p, img.c_img_p, res.c_img_p) == 0 assert c_fimg_maximum(self.c_img_p, img.c_img_p, res.c_img_p) == 0
return res return res
####################################################################################################### #######################################################################################################
def max(self, img): def max(self, img):
"""return a new image with maximum pixel values per channel between current and parameter""" """return a new image with maximum pixel values per channel between current and parameter"""
res = self.clone(False) res = self.clone(False)
# C code inverts comparison # C code inverts comparison
assert c_fimg_maximum(self.c_img_p, img.c_img_p, res.c_img_p) == 0 assert c_fimg_minimum(self.c_img_p, img.c_img_p, res.c_img_p) == 0
return res return res
####################################################################################################### #######################################################################################################
@ -341,11 +337,6 @@ class FloatImg:
== 0 == 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): def fileinfos(fname):

View File

@ -1,12 +0,0 @@
"""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.0