ragephoto.py: change format variable to photoFormat

This commit is contained in:
Syping 2023-11-09 20:35:28 +01:00
parent 0f1cfe630b
commit 8b8da1c1ef

View file

@ -114,11 +114,11 @@ class RagePhoto:
else: else:
return b"" return b""
def jpegSign(self, format = None): def jpegSign(self, photoFormat = None):
if format is None: if photoFormat is None:
return libragephoto.ragephoto_getphotosign(self.__instance) return libragephoto.ragephoto_getphotosign(self.__instance)
else: else:
return libragephoto.ragephoto_getphotosignf(self.__instance, format) return libragephoto.ragephoto_getphotosignf(self.__instance, photoFormat)
def jpegSize(self): def jpegSize(self):
return libragephoto.ragephoto_getphotosize(self.__instance) return libragephoto.ragephoto_getphotosize(self.__instance)
@ -137,33 +137,33 @@ class RagePhoto:
else: else:
return b"" return b""
def save(self, format = None): def save(self, photoFormat = None):
_data = bytearray(self.saveSize(format)) _data = bytearray(self.saveSize(photoFormat))
_ptr = (c_char * len(_data)).from_buffer(_data) _ptr = (c_char * len(_data)).from_buffer(_data)
if format is None: if photoFormat is None:
_ret = libragephoto.ragephoto_save(self.__instance, _ptr) _ret = libragephoto.ragephoto_save(self.__instance, _ptr)
else: else:
_ret = libragephoto.ragephoto_savef(self.__instance, _ptr, format) _ret = libragephoto.ragephoto_savef(self.__instance, _ptr, photoFormat)
if _ret: if _ret:
return _data return _data
else: else:
return None return None
def saveFile(self, file, format = None): def saveFile(self, file, photoFormat = None):
if isinstance(file, str): if isinstance(file, str):
_file = file.encode() _file = file.encode()
else: else:
_file = file _file = file
if format is None: if photoFormat is None:
return libragephoto.ragephoto_savefile(self.__instance, _file) return libragephoto.ragephoto_savefile(self.__instance, _file)
else: else:
return libragephoto.ragephoto_savefilef(self.__instance, _file, format) return libragephoto.ragephoto_savefilef(self.__instance, _file, photoFormat)
def saveSize(self, format = None): def saveSize(self, photoFormat = None):
if format is None: if photoFormat is None:
return libragephoto.ragephoto_getsavesize(self.__instance) return libragephoto.ragephoto_getsavesize(self.__instance)
else: else:
return libragephoto.ragephoto_getsavesizef(self.__instance, format) return libragephoto.ragephoto_getsavesizef(self.__instance, photoFormat)
def setBufferDefault(self): def setBufferDefault(self):
return libragephoto.ragephoto_setbufferdefault(self.__instance) return libragephoto.ragephoto_setbufferdefault(self.__instance)
@ -181,8 +181,8 @@ class RagePhoto:
else: else:
libragephoto.ragephoto_setphotodesc(self.__instance, _desc, buffer) libragephoto.ragephoto_setphotodesc(self.__instance, _desc, buffer)
def setFormat(self, format): def setFormat(self, photoFormat):
libragephoto.ragephoto_setphotoformat(self.__instance, format) libragephoto.ragephoto_setphotoformat(self.__instance, photoFormat)
def setJpeg(self, jpeg, buffer = None): def setJpeg(self, jpeg, buffer = None):
_buffer = 0 _buffer = 0