예제 #1
0
파일: libcms.py 프로젝트: wenlibin02/sk1-wx
def cms_create_transform(inputProfile,
                         inMode,
                         outputProfile,
                         outMode,
                         renderingIntent=uc2const.INTENT_PERCEPTUAL,
                         flags=uc2const.cmsFLAGS_NOTPRECALC):
    """
	Returns a handle to lcms transformation wrapped as a Python object.

	inputProfile - a valid lcms profile handle
	outputProfile - a valid lcms profile handle
	inMode - predefined string constant 
			(i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	outMode - predefined string constant 
			(i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	renderingIntent - integer constant (0-3) specifying rendering intent 
			for the transform
	flags - a set of predefined lcms flags
	"""

    if renderingIntent not in (0, 1, 2, 3):
        raise CmsError, 'renderingIntent must be an integer between 0 and 3'

    result = _cms.buildTransform(inputProfile, inMode, outputProfile, outMode,
                                 renderingIntent, flags)

    if result is None:
        msg = 'Cannot create requested transform'
        raise CmsError, msg + ": %s %s" % (inMode, outMode)

    return result
예제 #2
0
파일: libcms.py 프로젝트: sahwar/sk1-wx
def cms_create_transform(in_profile,
                         in_mode,
                         out_profile,
                         out_mode,
                         intent=uc2const.INTENT_PERCEPTUAL,
                         flags=uc2const.cmsFLAGS_NOTPRECALC):
    """Returns a handle to lcms transformation wrapped as a Python object.

    :param in_profile: valid lcms profile handle
    :param in_mode: valid lcms profile handle
    :param out_profile: valid lcms or PIL mode
    :param out_mode: valid lcms or PIL mode
    :param intent: integer constant (0-3) of transform rendering intent
    :param flags: lcms flags

    :return: handle to lcms transformation
    """

    if intent not in INTENTS:
        raise CmsError('renderingIntent must be an integer between 0 and 3')

    result = _cms.buildTransform(in_profile, in_mode, out_profile, out_mode,
                                 intent, flags)

    if result is None:
        msg = 'Cannot create requested transform'
        raise CmsError("%s: %s %s" % (msg, in_mode, out_mode))

    return result
예제 #3
0
파일: libcms.py 프로젝트: sk1project/sk1-wx
def cms_create_transform(inputProfile, inMode,
					outputProfile, outMode,
					renderingIntent=uc2const.INTENT_PERCEPTUAL,
					flags=uc2const.cmsFLAGS_NOTPRECALC):
	"""
	Returns a handle to lcms transformation wrapped as a Python object.

	inputProfile - a valid lcms profile handle
	outputProfile - a valid lcms profile handle
	inMode - predefined string constant 
			(i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	outMode - predefined string constant 
			(i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	renderingIntent - integer constant (0-3) specifying rendering intent 
			for the transform
	flags - a set of predefined lcms flags
	"""

	if renderingIntent not in (0, 1, 2, 3):
		raise CmsError, 'renderingIntent must be an integer between 0 and 3'

	result = _cms.buildTransform(inputProfile, inMode,
								outputProfile, outMode,
								renderingIntent, flags)

	if result is None:
		msg = 'Cannot create requested transform'
		raise CmsError, msg + ": %s %s" % (inMode, outMode)

	return result