Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

membaspr.c

Go to the documentation of this file.
00001 /* 00002 File: MemBasPr.c 00003 00004 Contains: 00005 creation of mem based profiles 00006 00007 Written by: U. J. Krabbenhoeft 00008 00009 Copyright: � 1993-1996 by Linotype-Hell AG, all rights reserved. 00010 00011 Version: 00012 */ 00013 00014 #include "Windef.h" 00015 #include "WinGdi.h" 00016 #include <wtypes.h> 00017 #include <winbase.h> 00018 #include <windowsX.h> 00019 #include "ICM.h" 00020 00021 #ifndef LHGeneralIncs_h 00022 #include "General.h" 00023 #endif 00024 00025 #ifndef MSNewMemProfile_h 00026 #include "MemProf.h" 00027 #endif 00028 00029 #ifdef _DEBUG 00030 //#define WRITE_PROFILE 00031 #endif 00032 00033 #ifdef WRITE_PROFILE 00034 void WriteProf( LPSTR name, icProfile *theProf, long currentSize ); 00035 #endif 00036 00037 #define MyTagCount 5 00038 #define LINK_BUFFER_MAX 3000 00039 00040 CMError DeviceLinkFill( CMWorldRef cw, CMConcatProfileSet *profileSet, icProfile **theProf, 00041 unsigned long aIntent ) 00042 { 00043 CMError err = unimpErr; 00044 OSErr aOSerr = unimpErr; 00045 #ifdef __MWERKS__ 00046 unsigned char theText[] = "\pDeviceLink profile "; 00047 #else 00048 char theText[] = "\026DeviceLink profile "; 00049 #endif 00050 char copyrightText[] = "\037�1996 by Linotype-Hell U.J.K."; 00051 icProfile *aProf=0; 00052 long theTagTabSize; 00053 long theHeaderSize; 00054 long theDescSize; 00055 long theMediaSize; 00056 long theSequenceDescSize; 00057 long theA2B0Size; 00058 long theCopyRightSize; 00059 long currentSize=0; 00060 long theTotalSize=0; 00061 icTag aTag; 00062 UINT32 sCS,dCS,clutSize; 00063 Ptr aPtr=0; 00064 00065 MyDoubleXYZ D50XYZ = { 0.9642, 1.0000, 0.8249 }; 00066 icXYZNumber D50 = { (unsigned long)(D50XYZ.X * 65536), (unsigned long)(D50XYZ.Y * 65536), (unsigned long)(D50XYZ.Z * 65536)}; 00067 theHeaderSize = sizeof(icHeader); 00068 theDescSize = sizeof(OSType) /* type descriptor */ 00069 + sizeof(unsigned long) /* reserved */ 00070 + sizeof(unsigned long) /* ASCII length */ 00071 + theText[0] /* ASCII profile description */ 00072 + sizeof(unsigned long) /* Unicode code */ 00073 + sizeof(unsigned long) /* Unicode character count */ 00074 + sizeof(unsigned short) /* Macintosh script code */ 00075 + sizeof(unsigned char) /* Macintosh string length */ 00076 + 67 /* Macintosh string */ 00077 ; 00078 theCopyRightSize = sizeof(OSType) /* type descriptor */ 00079 + sizeof(unsigned long) /* reserved */ 00080 + copyrightText[0] /* ASCII profile description */ 00081 ; 00082 theMediaSize = sizeof( icXYZType );; 00083 00084 theTagTabSize = MyTagCount * sizeof( icTag ) + sizeof( unsigned long ); 00085 00086 *theProf = 0; 00087 00088 if( ((CMMModelPtr)cw)->hasNamedColorProf != NoNamedColorProfile ){ 00089 err = cmProfileError; 00090 goto CleanupAndExit; 00091 } 00092 err = MyGetColorSpaces( profileSet, &sCS, &dCS ); 00093 if (err) 00094 goto CleanupAndExit; 00095 00096 aProf = (icProfile *)SmartNewPtrClear( LINK_BUFFER_MAX, &aOSerr ); 00097 err = aOSerr; 00098 if (err) 00099 goto CleanupAndExit; 00100 00101 err = MyAdd_NL_Header(theTotalSize, (icHeader*)((Ptr)aProf+currentSize), aIntent, icSigLinkClass, sCS, dCS ); 00102 if (err) 00103 goto CleanupAndExit; 00104 00105 /*----------------------------------------------------------------------------------------- cmProfileDescriptionTag */ 00106 currentSize = theHeaderSize + theTagTabSize; 00107 CMHelperICC2int32Const(&(aProf->tagList.count ), MyTagCount); 00108 00109 CMHelperICC2int32Const(&(aTag.sig ), icSigProfileDescriptionTag); 00110 CMHelperICC2int32Const(&(aTag.offset ), currentSize); 00111 CMHelperICC2int32Const(&(aTag.size ), theDescSize); 00112 aProf->tagList.tags[0] = aTag; 00113 err =MyAdd_NL_DescriptionTag ( (CMTextDescriptionType *)((Ptr)aProf+currentSize), (unsigned char *)theText ); 00114 if (err) 00115 goto CleanupAndExit; 00116 currentSize += theDescSize; 00117 currentSize = ( currentSize + 3 ) & ~ 3; 00118 00119 CMHelperICC2int32Const(&(aTag.sig ), icSigMediaWhitePointTag); 00120 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 00121 CMHelperICC2int32Const(&(aTag.size ), theMediaSize); 00122 aProf->tagList.tags[1] = aTag; 00123 MyAdd_NL_ColorantTag((icXYZType *)((Ptr)aProf+currentSize), &D50); 00124 currentSize += theMediaSize; 00125 currentSize = ( currentSize + 3 ) & ~ 3; 00126 00127 CMHelperICC2int32Const(&(aTag.sig ), icSigCopyrightTag); 00128 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 00129 CMHelperICC2int32Const(&(aTag.size ), theCopyRightSize); 00130 aProf->tagList.tags[2] = aTag; 00131 err = MyAdd_NL_CopyrightTag( (unsigned char *)copyrightText, (CMTextType *)((Ptr)aProf+currentSize)); 00132 if (err) 00133 goto CleanupAndExit; 00134 currentSize += theCopyRightSize; 00135 currentSize = ( currentSize + 3 ) & ~ 3; 00136 00137 err = MyAdd_NL_SequenceDescTag( profileSet, (icProfileSequenceDescType *)((Ptr)aProf+currentSize), &theSequenceDescSize ); 00138 CMHelperICC2int32Const(&(aTag.sig ), icSigProfileSequenceDescTag); 00139 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 00140 CMHelperICC2int32Const(&(aTag.size ), theSequenceDescSize); 00141 aProf->tagList.tags[3] = aTag; 00142 currentSize += theSequenceDescSize; 00143 currentSize = ( currentSize + 3 ) & ~ 3; 00144 00145 theA2B0Size = GetSizes( (CMMModelPtr)cw, &clutSize ); 00146 00147 CMHelperICC2int32Const(&(aTag.sig ), icSigAToB0Tag); 00148 CMHelperICC2int32Const(&(aTag.offset ), currentSize ); 00149 CMHelperICC2int32Const(&(aTag.size ), theA2B0Size); 00150 aProf->tagList.tags[4] = aTag; 00151 00152 /* aPtr = SmartNewPtr( theA2B0Size+currentSize, &aOSerr ); 00153 err = aOSerr; 00154 if( err ){ 00155 goto CleanupAndExit; 00156 }*/ 00157 aPtr = GlobalAllocPtr( GHND, theA2B0Size+currentSize ); 00158 00159 if( aPtr == 0 ){ 00160 err = GetLastError(); 00161 goto CleanupAndExit; 00162 } 00163 00164 if ( ((CMMModelPtr)cw)->lutParam.colorLutWordSize == 8 ) 00165 err = MyAdd_NL_AToB0Tag_mft1( (CMMModelPtr)cw, (icLut8Type *)(aPtr+currentSize), clutSize ); 00166 else 00167 err = MyAdd_NL_AToB0Tag_mft2( (CMMModelPtr)cw, (icLut16Type *)(aPtr+currentSize), clutSize ); 00168 00169 if (err) 00170 goto CleanupAndExit; 00171 00172 BlockMove( (Ptr)aProf, aPtr, currentSize ); 00173 aProf = (icProfile *)DisposeIfPtr( (Ptr)aProf ); 00174 00175 CMHelperICC2int32Const( aPtr, theA2B0Size+currentSize ); 00176 00177 *theProf = (icProfile *)aPtr; 00178 #ifdef WRITE_PROFILE 00179 WriteProf( "DeviceLinkFill.pf", (icProfile *)aPtr, theA2B0Size+currentSize ); 00180 #endif 00181 return noErr; 00182 00183 CleanupAndExit: 00184 *theProf = (icProfile *)DisposeIfPtr( (Ptr)aProf ); 00185 if( aPtr )GlobalFreePtr( aPtr ); 00186 return err; 00187 } 00188 00189

Generated on Sat May 15 19:40:43 2004 for test by doxygen 1.3.7