示例#1
0
def cmsDoTransform(hTransform,
                   inputBuffer,
                   outputBuffer,
                   buffersSizeInPixels=None):
    """
	Transform color values from inputBuffer to outputBuffer using provided lcms transform handle.
	
	hTransform - a valid lcms transformation handle
	inputBuffer - 4-member list object. The members must be an integer between 0 and 255
	outputBuffer - 4-member list object with any values for recording transformation results.
	             Can be [0,0,0,0].
	buffersSizeInPixels - parameter for python-lcms compatibility. Can be skipped.               
	"""

    if type(inputBuffer) is types.ListType and type(
            outputBuffer) is types.ListType:

        outputBuffer[0], outputBuffer[1], outputBuffer[2], outputBuffer[
            3] = _cms.transformPixel(hTransform, inputBuffer[0],
                                     inputBuffer[1], inputBuffer[2],
                                     inputBuffer[3])
        return

    else:
        raise cmsError, "inputBuffer and outputBuffer must be Python 4-member list objects"
示例#2
0
文件: libcms.py 项目: sahwar/sk1-wx
def cms_do_transform(transform, inbuff, outbuff):
    """Transform color values from inputBuffer to outputBuffer using provided
    lcms transform handle.

    :param transform: valid lcms transformation handle
    :param inbuff: 4-member list. The members should be between 0 and 255
    :param outbuff: 4-member list. The members should be between 0 and 255
    """
    if isinstance(inbuff, list) and isinstance(outbuff, list):
        ret = _cms.transformPixel(transform, *inbuff)
        outbuff[0] = ret[0]
        outbuff[1] = ret[1]
        outbuff[2] = ret[2]
        outbuff[3] = ret[3]
        return
    else:
        msg = 'inbuff and outbuff must be Python 4-member list objects'
        raise CmsError(msg)
示例#3
0
def cms_do_transform(hTransform, inbuff, outbuff):
    """
	Transform color values from inputBuffer to outputBuffer using provided 
	lcms transform handle.
	
	hTransform - a valid lcms transformation handle
	inbuff - 4-member list object. The members must be an integer 
					between 0 and 255
	outbuff - 4-member list object with any values for recording 
					transformation results. Can be [0,0,0,0].              
	"""
    if type(inbuff) is types.ListType and type(outbuff) is types.ListType:
        ret = _cms.transformPixel(hTransform, *inbuff)
        outbuff[0] = ret[0]
        outbuff[1] = ret[1]
        outbuff[2] = ret[2]
        outbuff[3] = ret[3]
        return

    else:
        msg = 'inputBuffer and outputBuffer must be Python 4-member list objects'
        raise CmsError, msg
示例#4
0
def cms_do_transform(hTransform, inputBuffer, outputBuffer, buffersSizeInPixels=None):
	"""
	Transform color values from inputBuffer to outputBuffer using provided lcms transform handle.
	
	hTransform - a valid lcms transformation handle
	inputBuffer - 4-member list object. The members must be an integer between 0 and 255
	outputBuffer - 4-member list object with any values for recording transformation results.
	             Can be [0,0,0,0].
	buffersSizeInPixels - parameter for python-lcms compatibility. Can be skipped.               
	"""

	if type(inputBuffer) is types.ListType and type(outputBuffer) is types.ListType:

		outputBuffer[0], outputBuffer[1], outputBuffer[2], outputBuffer[3] = _cms.transformPixel(hTransform,
																									inputBuffer[0],
																									inputBuffer[1],
																									inputBuffer[2],
																									inputBuffer[3])
		return

	else:
		raise CmsError, "inputBuffer and outputBuffer must be Python 4-member list objects"
示例#5
0
def cms_do_transform(hTransform, inbuff, outbuff):
	"""
	Transform color values from inputBuffer to outputBuffer using provided 
	lcms transform handle.
	
	hTransform - a valid lcms transformation handle
	inbuff - 4-member list object. The members must be an integer 
					between 0 and 255
	outbuff - 4-member list object with any values for recording 
					transformation results. Can be [0,0,0,0].              
	"""
	if type(inbuff) is types.ListType and type(outbuff) is types.ListType:
		ret = _cms.transformPixel(hTransform, *inbuff)
		outbuff[0] = ret[0]
		outbuff[1] = ret[1]
		outbuff[2] = ret[2]
		outbuff[3] = ret[3]
		return

	else:
		msg = 'inputBuffer and outputBuffer must be Python 4-member list objects'
		raise CmsError, msg