Leadtools.ColorConversion Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
IccMultiLocalizedUnicodeTagType Class
See Also  Members   Example 
Leadtools.ColorConversion Namespace : IccMultiLocalizedUnicodeTagType Class



Contains the multiLocalizedUnicodeType tag type data.

Object Model


Syntax

Visual Basic (Declaration) 
Public Class IccMultiLocalizedUnicodeTagType 
   Inherits IccTagTypeBase
Visual Basic (Usage)Copy Code
Dim instance As IccMultiLocalizedUnicodeTagType
C# 
public class IccMultiLocalizedUnicodeTagType : IccTagTypeBase 
C++/CLI 
public ref class IccMultiLocalizedUnicodeTagType : public IccTagTypeBase 

Example

This example method can be used in creating an "multiLocalizedUnicodeType" mentioned in the ICC.1:2004-10 specification.

Visual BasicCopy Code
Public Sub IccMultiLocalizedUnicodeTagTypeExample()
   ' load an Icc Profile
   Dim iccProfile As New IccProfileExtended(LeadtoolsExamples.Common.ImagesPath.Path + "EmptyIcc.icc")

   ' define the name language code, for example English "en"
   Dim nameLanguageCode As UShort = CUShort(AscW("e"c))
   nameLanguageCode <<= 8
   nameLanguageCode = nameLanguageCode Or CUShort(&HFF)
   nameLanguageCode = nameLanguageCode And CUShort((&HFF00 Or AscW("n"c)))

   ' and then define the country code, for example Canada "ca"
   Dim nameCountryCode As UShort = CUShort(AscW("c"c))
   nameCountryCode <<= 8
   nameCountryCode = nameCountryCode Or CUShort(&HFF)
   nameCountryCode = nameCountryCode And CUShort(&HFF00 Or AscW("a"c))

   ' the name record
   Dim names() As String = {"first name record", "second name record"}

   ' define the name records
   Dim nameRecord(1) As IccNameRecord

   ' 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
   Dim firstName() As Char = names(0).ToCharArray()

   Dim secondName() As Char = names(1).ToCharArray()

   Dim unicodeChars(names(0).Length + names(1).Length - 1) As UShort
   Dim nCntr As Integer = 0
   Dim nX As Integer = 0

   While (nX < names(0).Length)
      unicodeChars(nCntr) = CUShort(AscW(firstName(nX)))
      nX += 1
      nCntr += 1
   End While

   nX = 0
   While (nX < names(1).Length)
      unicodeChars(nCntr) = CUShort(AscW(secondName(nX)))
      nX += 1
      nCntr += 1
   End While

   ' 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.
   Dim iccMultiLocalized As New IccMultiLocalizedUnicode(12, nameRecord, unicodeChars)

   ' define the tag type
   Dim iccMultiLocalizedTagType As 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
   iccProfile.GenerateIccFile(LeadtoolsExamples.Common.ImagesPath.Path + "IccMultiLocalizedUnicodeTagTypeVB.icc")
End Sub
C#Copy Code
public void IccMultiLocalizedUnicodeTagTypeExample() 

   // load an Icc Profile 
   string fileName = LeadtoolsExamples.Common.ImagesPath.Path + "EmptyIcc.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 = LeadtoolsExamples.Common.ImagesPath.Path + "IccMultiLocalizedUnicodeTagTypeCS.icc"; 
   iccProfile.GenerateIccFile(IccfileName); 
}

Remarks

Inheritance Hierarchy

System.Object
   Leadtools.ColorConversion.IccTagTypeBase
      Leadtools.ColorConversion.IccMultiLocalizedUnicodeTagType

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also