KJoint::KJoint(const Vector3& transform_from_parent, const Vector3& rotations, const Masses& masses, const Vector3& angles, int motor_id) :m_transform(create_transform(transform_from_parent, rotations)), m_inverse_transform(Matrix::Identity()), m_chain_matrix(create_transform(transform_from_parent, rotations)), m_mass_offset(create_mass_offset(masses)),m_mass_endpoint(create_mass_offset(masses)),m_chain_masspoint(create_mass_offset(masses)), m_angle(angles(0) * degree_to_rad), m_min_angle(angles(1) * degree_to_rad), m_max_angle(angles(2) * degree_to_rad), m_motor_id(motor_id) { check_angle(); }
/****************************************************************************** * CreateMultiProfileTransform [MSCMS.@] * * Create a color transform from an array of color profiles. * * PARAMS * profiles [I] Array of color profiles. * nprofiles [I] Number of color profiles. * intents [I] Array of rendering intents. * flags [I] Flags. * cmm [I] Profile to take the CMM from. * * RETURNS * Success: Handle to a transform. * Failure: NULL */ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofiles, PDWORD intents, DWORD nintents, DWORD flags, DWORD cmm ) { HTRANSFORM ret = NULL; #ifdef HAVE_LCMS2 cmsHPROFILE *cmsprofiles; struct transform transform; struct profile *profile0, *profile1; TRACE( "( %p, 0x%08x, %p, 0x%08x, 0x%08x, 0x%08x )\n", profiles, nprofiles, intents, nintents, flags, cmm ); if (!profiles || !nprofiles || !intents) return NULL; if (nprofiles > 2) { FIXME("more than 2 profiles not supported\n"); return NULL; } profile0 = grab_profile( profiles[0] ); if (!profile0) return NULL; profile1 = grab_profile( profiles[1] ); if (!profile1) { release_profile( profile0 ); return NULL; } if ((cmsprofiles = HeapAlloc( GetProcessHeap(), 0, (nprofiles + 1) * sizeof(cmsHPROFILE) ))) { cmsprofiles[0] = profile0->cmsprofile; cmsprofiles[1] = profile1->cmsprofile; transform.cmstransform = cmsCreateMultiprofileTransform( cmsprofiles, nprofiles, 0, 0, *intents, 0 ); HeapFree( GetProcessHeap(), 0, cmsprofiles ); if (!transform.cmstransform) { release_profile( profile0 ); release_profile( profile1 ); return FALSE; } ret = create_transform( &transform ); } release_profile( profile0 ); release_profile( profile1 ); #endif /* HAVE_LCMS2 */ return ret; }
/****************************************************************************** * CreateColorTransformW [MSCMS.@] * * Create a color transform. * * PARAMS * space [I] Input color space. * dest [I] Color profile of destination device. * target [I] Color profile of target device. * flags [I] Flags. * * RETURNS * Success: Handle to a transform. * Failure: NULL */ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest, HPROFILE target, DWORD flags ) { HTRANSFORM ret = NULL; #ifdef HAVE_LCMS2 struct transform transform; struct profile *dst, *tgt = NULL; cmsHPROFILE cmsinput, cmsoutput, cmstarget = NULL; DWORD proofing = 0; int intent; TRACE( "( %p, %p, %p, 0x%08x )\n", space, dest, target, flags ); if (!space || !(dst = grab_profile( dest ))) return FALSE; if (target && !(tgt = grab_profile( target ))) { release_profile( dst ); return FALSE; } intent = space->lcsIntent > 3 ? INTENT_PERCEPTUAL : space->lcsIntent; TRACE( "lcsIntent: %x\n", space->lcsIntent ); TRACE( "lcsCSType: %s\n", dbgstr_tag( space->lcsCSType ) ); TRACE( "lcsFilename: %s\n", debugstr_w( space->lcsFilename ) ); cmsinput = cmsCreate_sRGBProfile(); /* FIXME: create from supplied color space */ if (target) { proofing = cmsFLAGS_SOFTPROOFING; cmstarget = tgt->cmsprofile; } cmsoutput = dst->cmsprofile; transform.cmstransform = cmsCreateProofingTransform(cmsinput, 0, cmsoutput, 0, cmstarget, intent, INTENT_ABSOLUTE_COLORIMETRIC, proofing); if (!transform.cmstransform) { if (tgt) release_profile( tgt ); release_profile( dst ); return FALSE; } ret = create_transform( &transform ); if (tgt) release_profile( tgt ); release_profile( dst ); #endif /* HAVE_LCMS2 */ return ret; }
/****************************************************************************** * CreateMultiProfileTransform [MSCMS.@] * * Create a color transform from an array of color profiles. * * PARAMS * profiles [I] Array of color profiles. * nprofiles [I] Number of color profiles. * intents [I] Array of rendering intents. * flags [I] Flags. * cmm [I] Profile to take the CMM from. * * RETURNS * Success: Handle to a transform. * Failure: NULL */ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofiles, PDWORD intents, DWORD nintents, DWORD flags, DWORD cmm ) { HTRANSFORM ret = NULL; #ifdef HAVE_LCMS cmsHPROFILE *cmsprofiles, cmsconvert = NULL; struct transform transform; struct profile *profile0, *profile1; DWORD in_format, out_format; TRACE( "( %p, 0x%08x, %p, 0x%08x, 0x%08x, 0x%08x )\n", profiles, nprofiles, intents, nintents, flags, cmm ); if (!profiles || !nprofiles || !intents) return NULL; if (nprofiles > 2) { FIXME("more than 2 profiles not supported\n"); return NULL; } profile0 = grab_profile( profiles[0] ); if (!profile0) return NULL; profile1 = grab_profile( profiles[1] ); if (!profile1) { release_profile( profile0 ); return NULL; } in_format = from_profile( profiles[0] ); out_format = from_profile( profiles[nprofiles - 1] ); if (in_format != out_format) { /* insert a conversion profile for pairings that lcms doesn't handle */ if (out_format == TYPE_RGB_16) cmsconvert = cmsCreate_sRGBProfile(); if (out_format == TYPE_Lab_16) cmsconvert = cmsCreateLabProfile( NULL ); } cmsprofiles = HeapAlloc( GetProcessHeap(), 0, (nprofiles + 1) * sizeof(cmsHPROFILE) ); if (cmsprofiles) { cmsprofiles[0] = profile0->cmsprofile; if (cmsconvert) { cmsprofiles[1] = cmsconvert; cmsprofiles[2] = profile1->cmsprofile; nprofiles++; } else { cmsprofiles[1] = profile1->cmsprofile; } transform.cmstransform = cmsCreateMultiprofileTransform( cmsprofiles, nprofiles, in_format, out_format, *intents, 0 ); HeapFree( GetProcessHeap(), 0, cmsprofiles ); ret = create_transform( &transform ); } release_profile( profile0 ); release_profile( profile1 ); #endif /* HAVE_LCMS */ return ret; }