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 |
This example method can be used in creating an "multiLocalizedUnicodeType" mentioned in the ICC.1:2004-10 specification.
Visual Basic | Copy Code |
---|---|
Public Sub IccMultiLocalizedUnicodeTagTypeExample() ' load an Icc Profile Dim iccProfile As New IccProfileExtended(Path.Combine(LEAD_VARS.ImagesDir, "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(Path.Combine(LEAD_VARS.ImagesDir, "IccMultiLocalizedUnicodeTagTypeVB.icc")) End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class |
C# | Copy Code |
---|---|
public void IccMultiLocalizedUnicodeTagTypeExample() { // load an Icc Profile string fileName = Path.Combine(LEAD_VARS.ImagesDir, "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 = Path.Combine(LEAD_VARS.ImagesDir, "IccMultiLocalizedUnicodeTagTypeCS.icc"); iccProfile.GenerateIccFile(IccfileName); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; } |
SilverlightCSharp | Copy Code |
---|---|
SilverlightVB | Copy Code |
---|---|
- The signature for this tag type is IccTagTypeBase.MultiLocalizedUnicodeTypeSignature.
System.Object
Leadtools.ColorConversion.IccTagTypeBase
Leadtools.ColorConversion.IccMultiLocalizedUnicodeTagType
Target Platforms: Silverlight 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)
Reference
IccMultiLocalizedUnicodeTagType MembersLeadtools.ColorConversion Namespace
IccTagTypeBase Class
IccCurveTagType Class
IccDateTimeTagType Class
IccDataTagType Class
IccLookupTable16TagType Class
IccLookupTable8TagType Class
IccMeasurementTagType Class
IccNamedColor2TagType Class
IccParametricCurveTagType Class
IccResponseCurveSet16TagType Class
IccViewingConditionsTagType Class
IccChromaticityTagType Class
IccColorantTableTagType Class
IccColorantOrderTagType Class
IccLookupTableAToBTagType Class
IccLookupTableBToATagType Class
IccProfileSequenceDescriptionTagType Class
IccS15Fixed16ArrayTagType Class
IccSignatureTagType Class
IccTextTagType Class
IccU16Fixed16ArrayTagType Class
IccUint16ArrayTagType Class
IccUint32ArrayTagType Class
IccUint64ArrayTagType Class
IccUint8ArrayTagType Class
IccXyzTagType Class
IccUnknownTagType Class
IccTools Class
IccProfileExtended Class