示例#1
0
文件: transform.go 项目: yoya/go-lcms
func CreateTransform(src_prof *Profile, src_type CMSType, dst_prof *Profile, dst_type CMSType) *Transform {
	transform := C.cmsCreateTransform(
		src_prof.prof, C.cmsUInt32Number(src_type),
		dst_prof.prof, C.cmsUInt32Number(dst_type),
		C.INTENT_PERCEPTUAL, 0)
	return &Transform{trans: transform}
}
示例#2
0
文件: transform.go 项目: yoya/go-lcms
func (trans *Transform) DoTransform(inputBuffer []uint8, outputBuffer []uint8, length int) error {
	inputLen := len(inputBuffer)
	outputLen := len(outputBuffer)
	if inputLen < length {
		return fmt.Errorf("DoTransform: inputLen(%d) < length(%d)", inputLen, length)
	}
	if outputLen < length {
		return fmt.Errorf("DoTransform: outputLen(%d) < length(%d)", outputLen, length)
	}
	inputPtr := unsafe.Pointer(&inputBuffer[0])
	outputPtr := unsafe.Pointer(&outputBuffer[0])
	length /= 4 // XXX?
	C.cmsDoTransform(trans.trans, inputPtr, outputPtr, C.cmsUInt32Number(length))
	return nil
}
示例#3
0
文件: profile.go 项目: yoya/go-lcms
func OpenProfileFromMem(profdata []byte) *Profile {
	data := unsafe.Pointer(&profdata[0])
	dataLen := C.cmsUInt32Number(len(profdata))
	return &Profile{prof: C.cmsOpenProfileFromMem(data, dataLen)}
}