public struct IccNameRecord
public value class IccNameRecord : public System.ValueType
class IccNameRecord:
using Leadtools;
using Leadtools.ColorConversion;
using Leadtools.Codecs;
public string outputIccFile = Path.Combine(LEAD_VARS.ImagesDir, "IccMultiLocalizedUnicodeTagType.icc");
public void IccMultiLocalizedUnicodeTagTypeExample()
{
// Load an ICC profile
string fileName = Path.Combine(LEAD_VARS.ImagesDir, "InputProfile.icc");
IccProfileExtended iccProfile = new IccProfileExtended(fileName);
// Define the two bytes for the name's language code. For example: English, "en"
ushort nameLanguageCode = 'e'; // (0x0065)
nameLanguageCode <<= 8; // Shift to upper byte to become (0x6500)
nameLanguageCode |= 'n'; // OR operation to insert the second character (0x006e) into the lower byte to become (0x656e)
// Define the two bytes for the name's country code. For example: Canada, "ca"
ushort nameCountryCode = 'c';
nameCountryCode <<= 8;
nameCountryCode |= 'a';
// Define the name records
string[] names = new string[2];
names[0] = "first name record";
names[1] = "second name record";
IccNameRecord[] nameRecord = new IccNameRecord[2];
// Since the size is in bytes, multiply the length by 2 because each element is 2 bytes
int firstNameLength = names[0].Length * 2;
int secondNameLength = names[1].Length * 2;
// The offset should start from the beginning of the tag. For the first name record the offset is:
// 16Bytes + (numberOfNames(2Names) * sizeOfNameRecord(12Bytes))
int firstNameOffset = 16 + (names.Length * 12);
// After that, the offset can be calculated by adding the previous name record's lengths (remember that name records have "2 bytes" elements)
int secondNameOffset = firstNameOffset + (names[0].Length * 2);
// Create the name records
nameRecord[0] = new IccNameRecord(nameLanguageCode, nameCountryCode, firstNameLength, firstNameOffset);
nameRecord[1] = new IccNameRecord(nameLanguageCode, nameCountryCode, secondNameLength, secondNameOffset);
// For 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
iccProfile.GenerateIccFile(outputIccFile);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
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.