←Select platform

IccNameRecord Structure

Summary
Contains the name record data used in the IccMultiLocalizedUnicodeTagType structure.
Syntax
C#
C++/CLI
Python
public struct IccNameRecord 
public value class IccNameRecord : public System.ValueType  
class IccNameRecord: 
Example
C#
using Leadtools; 
using Leadtools.ColorConversion; 
 
 
public void IccMultiLocalizedUnicodeTagTypeExample() 
{ 
   // load an Icc Profile 
   string 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 record 
   string[] names = new string[2]; 
   names[0] = "first name record"; 
   names[1] = "second name record"; 
 
   // define the name records 
   IccNameRecord[] 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 order 
   char[] 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 type 
   IccMultiLocalizedUnicodeTagType iccMultiLocalizedTagType = new IccMultiLocalizedUnicodeTagType(iccMultiLocalized); 
 
   // add the new tag to the ICC Profile 
   iccProfile.AddTag(iccMultiLocalizedTagType, IccTag.DeviceModelDescTag, IccTagTypeBase.MultiLocalizedUnicodeTypeSignature); 
 
   // generate the new profile id 
   iccProfile.GenerateProfileId(); 
 
   // update the icc array with the new changes 
   iccProfile.UpdateDataArray(); 
 
   // write the Icc Profile into a new file 
   string IccfileName = Path.Combine(LEAD_VARS.ImagesDir, "IccMultiLocalizedUnicodeTagTypeCS.icc"); 
   iccProfile.GenerateIccFile(IccfileName); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ColorConversion Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.