←Select platform

CreateTagType Method

Summary
Creates an ICC tag type data.
Syntax
C#
C++/CLI
Python
public static IccTagTypeBase CreateTagType( 
   IccTagTypeBase sourceTagData, 
   int tagTypeSignature 
) 
public: 
static IccTagTypeBase^ CreateTagType(  
   IccTagTypeBase^ sourceTagData, 
   int tagTypeSignature 
)  
def CreateTagType(self,sourceTagData,tagTypeSignature): 

Parameters

sourceTagData
Icc class object that contains the tag data.

tagTypeSignature
Tag type signature of the tag type that needs to be created.

Return Value

Icc class object that contains the resulted tag.

Remarks
  • This method converts the  sourceTagData into Big Endian format, and returns a ready tag type that can be used as part of other tag type.
  • For the purposes of ICC v4.2 tag types, this method is only used with the IccProfileSequenceDescriptionTagType class.
Example
C#
using Leadtools; 
using Leadtools.ColorConversion; 
 
 
public IccMultiLocalizedUnicodeTagType FillIccMultiLocalizedUnicodeTagType() 
{ 
   ushort nameLanguageCode = 'e'; 
   nameLanguageCode <<= 8; 
   nameLanguageCode |= 0x00FF; 
   nameLanguageCode &= 0xFF00 | 'n'; 
 
   ushort nameCountryCode = 'c'; 
   nameCountryCode <<= 8; 
   nameCountryCode |= 0x00FF; 
   nameCountryCode &= 0xFF00 | 'a'; 
 
   string[] names = new string[2]; 
   names[0] = "first name record"; 
   names[1] = "second name record"; 
 
   IccNameRecord[] nameRecord = new IccNameRecord[2]; 
 
   nameRecord[0] = new IccNameRecord(nameLanguageCode, nameCountryCode, names[0].Length * 2, 16 + (2 * 12)); 
   nameRecord[1] = new IccNameRecord(nameLanguageCode, nameCountryCode, names[1].Length * 2, ((16 + (2 * 12)) + (names[0].Length * 2))); 
 
   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++; 
   } 
 
   IccMultiLocalizedUnicode iccMultiLocalized = new IccMultiLocalizedUnicode(12, nameRecord, unicodeChars); 
   IccMultiLocalizedUnicodeTagType iccMultiLocalizedTagType = new IccMultiLocalizedUnicodeTagType(iccMultiLocalized); 
 
   return iccMultiLocalizedTagType; 
} 
 
public void IccProfileSequenceDescriptionTagTypeExample() 
{ 
   // load an Icc Profile 
   string fileName = Path.Combine(LEAD_VARS.ImagesDir, "ReadFromImageCS.icc"); 
   IccProfileExtended iccProfile = new IccProfileExtended(fileName); 
 
   // define the device attributes must be 8 bytes 
   byte[] deviceAttribs = new byte[8] { 0, 0, 0, 0, 0, 0, 0, 0 }; 
 
   // define the device manufacturer and model descriptions 
   IccMultiLocalizedUnicodeTagType devManufacturerDesc = FillIccMultiLocalizedUnicodeTagType(); 
   IccMultiLocalizedUnicodeTagType devModelDesc = FillIccMultiLocalizedUnicodeTagType(); 
 
   // if a tag type is used inside another tag type, it should be converted 
   // into BigIndian notation first. And that can be done by calling the  
   // IccProfile.CreateICCTagData() method 
   devManufacturerDesc = (IccMultiLocalizedUnicodeTagType)IccTools.CreateTagType(devManufacturerDesc, IccTagTypeBase.MultiLocalizedUnicodeTypeSignature); 
   devModelDesc = (IccMultiLocalizedUnicodeTagType)IccTools.CreateTagType(devModelDesc, IccTagTypeBase.MultiLocalizedUnicodeTypeSignature); 
 
   // define the 1 profile descriptions 
   IccProfileDescription[] profileDescription = new IccProfileDescription[1]; 
   profileDescription[0] = new IccProfileDescription( 
      0x46464549, 
      0x0, 
      deviceAttribs, 
      IccTechnologySignatureType.None, 
      devManufacturerDesc, 
      devModelDesc); 
 
   // create the IccProfileSequenceDescription class 
   IccProfileSequenceDescription profileSeqDesc = new IccProfileSequenceDescription(profileDescription); 
 
   // define the tag type 
   IccProfileSequenceDescriptionTagType profileSeqDescTagType = new IccProfileSequenceDescriptionTagType(profileSeqDesc); 
 
   // add the new tag to the ICC Profile 
   iccProfile.AddTag(profileSeqDescTagType, IccTag.ProfileSequenceDescTag, IccTagTypeBase.ProfileSequenceDescTypeSignature); 
 
   // 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, "IccProfileSequenceDescriptionTagTypeCS.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.