public class IccMultiLocalizedUnicodeTagType : IccTagTypeBase
Public Class IccMultiLocalizedUnicodeTagType
Inherits IccTagTypeBase
public ref class IccMultiLocalizedUnicodeTagType : public IccTagTypeBase
This example method can be used in creating an "multiLocalizedUnicodeType" mentioned in the ICC.1:2004-10 specification.
using Leadtools;
using Leadtools.ColorConversion;
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:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.ColorConversion
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:\LEADTOOLS21\Resources\Images"
End Class
IccMultiLocalizedUnicodeTagType Members
Leadtools.ColorConversion Namespace
IccParametricCurveTagType Class
IccResponseCurveSet16TagType Class
IccViewingConditionsTagType Class
IccLookupTableAToBTagType Class
IccLookupTableBToATagType Class
IccProfileSequenceDescriptionTagType Class
IccS15Fixed16ArrayTagType Class
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.