Got 2.0.0 working again. #139

This commit is contained in:
jevans 2014-03-15 22:09:49 -04:00
commit 093f9c49fb
4 changed files with 22 additions and 8 deletions

View file

@ -10,6 +10,20 @@ import sys
from .config import glymur_config
OPENJP2, OPENJPEG = glymur_config()
def version():
"""Wrapper for opj_version library routine."""
OPENJP2.opj_version.restype = ctypes.c_char_p
library_version = OPENJP2.opj_version()
if sys.hexversion >= 0x03000000:
return library_version.decode('utf-8')
else:
return library_version
if OPENJP2 is not None:
_MAJOR, _MINOR, _PATCH = version().split('.')
else:
_MINOR = 0
ERROR_MSG_LST = []
# Map certain atomic OpenJPEG datatypes to the ctypes equivalents.
@ -391,12 +405,10 @@ class ImageCompType(ctypes.Structure):
("factor", ctypes.c_uint32),
# image component data
("data", ctypes.POINTER(ctypes.c_int32)),
# alpha channel
# TODO: exclude for 2.0, 1.5
("alpha", ctypes.c_uint16)]
("data", ctypes.POINTER(ctypes.c_int32))]
if _MINOR == '1':
_fields_.append(("alpha", ctypes.c_uint16))
class ImageType(ctypes.Structure):
"""Defines image data and characteristics.