public struct IccNameRecord public value class IccNameRecord : public System.ValueType class IccNameRecord: using Leadtools;using Leadtools.ColorConversion;public void IccMultiLocalizedUnicodeTagTypeExample(){// load an Icc Profilestring fileName = Path.Combine(LEAD_VARS.ImagesDir, "ReadFromImageCS.icc");IccProfileExtended iccProfile = new IccProfileExtended(fileName);// define the name language code, for example English "en"ushort nameLanguageCode = 'e';nameLanguageCode <<= 8;nameLanguageCode |= 0x00FF;nameLanguageCode &= 0xFF00 | 'n';// and then define the country code, for example Canada "ca"ushort nameCountryCode = 'c';nameCountryCode <<= 8;nameCountryCode |= 0x00FF;nameCountryCode &= 0xFF00 | 'a';// the name recordstring[] names = new string[2];names[0] = "first name record";names[1] = "second name record";// define the name recordsIccNameRecord[] nameRecord = new IccNameRecord[2];// the offset should start from the beginning of the tag, and for the first name record the offset is:// 16Bytes + (numberOfNames(2Names) * sizeOfNameRecord(12Bytes))// and since the size is in bytes, we multiply the length by 2 because each element is 2 bytes.nameRecord[0] = new IccNameRecord(nameLanguageCode, nameCountryCode, names[0].Length * 2, 16 + (2 * 12));// after that, the offset can be calculated by adding the previous name record's lengths (remember that name records have "2 bytes" elements)nameRecord[1] = new IccNameRecord(nameLanguageCode, nameCountryCode, names[1].Length * 2, ((16 + (2 * 12)) + (names[0].Length * 2)));// unicode characters, put all the name record characters into one buffer in// a sequential orderchar[] firstName = new char[names[0].Length];firstName = names[0].ToCharArray();char[] secondName = new char[names[1].Length];secondName = names[1].ToCharArray();ushort[] unicodeChars = new ushort[names[0].Length + names[1].Length];int nCntr = 0;int nX = 0;while (nX < names[0].Length){unicodeChars[nCntr] = firstName[nX];nX++;nCntr++;}nX = 0;while (nX < names[1].Length){unicodeChars[nCntr] = secondName[nX];nX++;nCntr++;}// create the IccMultiLocalizedUnicode class.// 12 is the fixed size of all the name records implemented with the// ICC.1:2004-10 specification. This length doesnt include the length// of the name records' characters.IccMultiLocalizedUnicode iccMultiLocalized = new IccMultiLocalizedUnicode(12, nameRecord, unicodeChars);// define the tag typeIccMultiLocalizedUnicodeTagType iccMultiLocalizedTagType = new IccMultiLocalizedUnicodeTagType(iccMultiLocalized);// add the new tag to the ICC ProfileiccProfile.AddTag(iccMultiLocalizedTagType, IccTag.DeviceModelDescTag, IccTagTypeBase.MultiLocalizedUnicodeTypeSignature);// generate the new profile idiccProfile.GenerateProfileId();// update the icc array with the new changesiccProfile.UpdateDataArray();// write the Icc Profile into a new filestring IccfileName = Path.Combine(LEAD_VARS.ImagesDir, "IccMultiLocalizedUnicodeTagTypeCS.icc");iccProfile.GenerateIccFile(IccfileName);}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
