Class CmykColorHelper
اسم الفضاء : Aspose.Imaging تجميع: Aspose.Imaging.dll (25.4.0)
أساليب مساعدة للعمل مع لون CMYK المقدمة كقيمة كاملة 32 بت الموقعة.يوفر API مماثلة لـ Aspose.Imaging.CmykColor struct.انها خفيفة الوزن لأن لون CMYK يتم تقديمها على قدم المساواة مع Int32 بدلا من الهيكل مع الحقول الداخلية.يرجى تفضيل استخدام الأساليب الثابتة من هذه الفئة عندما يكون ذلك ممكنا بدلا منكلمات مفتاحية - كلمات مفتاحية - كلمات مفتاحية
public static class CmykColorHelper
Inheritance
الأعضاء الموروثين
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Methods
FromComponents(إنت، إنت، إنت، إنت)
يخلق CMYK من قيم 32 بت سيان، ماغنتا، الأصفر والأسود.
public static int FromComponents(int cyan, int magenta, int yellow, int black)
Parameters
cyan
int
المكون السيان. القيم الصالحة هي 0 إلى 255.
magenta
int
المكون المغناطيسي.القيم الصالحة هي 0 إلى 255.
yellow
int
المكون الأصفر.القيم الصالحة هي 0 إلى 255.
black
int
المكون الأسود.القيم الصالحة هي 0 إلى 255.
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Examples
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB بسرعة وفقًا للصيغ البسيطة دون استخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
GTC(إنت)
يحصل على قيمة مكون السيان.
public static int GetC(int cmyk)
Parameters
cmyk
int
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Returns
قيمة مكونات السيان.
Examples
يظهر المثال التالي كيفية تحويل ألوان RGB إلى نظرائهم CMYK دون تطبيق ملفات تعريف ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB بسرعة وفقًا للصيغ البسيطة دون استخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
GETK(إنت)
يحصل على قيمة المكون الأسود.
public static int GetK(int cmyk)
Parameters
cmyk
int
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Returns
قيمة المكون الأسود.
Examples
يظهر المثال التالي كيفية تحويل ألوان RGB إلى نظرائهم CMYK دون تطبيق ملفات تعريف ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB بسرعة وفقًا للصيغ البسيطة دون استخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
GetM(إنت)
يحصل على قيمة مكونات ماغنتا.
public static int GetM(int cmyk)
Parameters
cmyk
int
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Returns
قيمة مكونات ماغنتا.
Examples
يظهر المثال التالي كيفية تحويل ألوان RGB إلى نظرائهم CMYK دون تطبيق ملفات تعريف ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB بسرعة وفقًا للصيغ البسيطة دون استخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
GETY(إنت)
يحصل على قيمة المكونات الصفراء.
public static int GetY(int cmyk)
Parameters
cmyk
int
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Returns
قيمة المكونات الصفراء.
Examples
يظهر المثال التالي كيفية تحويل ألوان RGB إلى نظرائهم CMYK دون تطبيق ملفات تعريف ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB بسرعة وفقًا للصيغ البسيطة دون استخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
ToArgb(إنت[])
التحويل من ألوان CMYK إلى ألوان ARGB.
public static Color[] ToArgb(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
Returns
Color [ ]
ألوان ARGB
ToArgb(إنت)
التحويل من لون CMYK إلى لون ARGB.
public static Color ToArgb(int cmykPixel)
Parameters
cmykPixel
int
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Returns
لون ARGB
Examples
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB بسرعة وفقًا للصيغ البسيطة دون استخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB without using ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgb(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
//The output looks like this:
//Convert CMYK to RGB without using ICC profiles.
//CMYK(255,0,0,0) => RGB(0,255,255)
//CMYK(0,255,0,0) => RGB(255,0,255)
//CMYK(0,0,255,0) => RGB(255,255,0)
//CMYK(0,0,0,255) => RGB(0,0,0)
ToArgb32(إنت[])
التحويل من ألوان CMYK إلى ألوان ARGB.
public static int[] ToArgb32(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
Returns
int [ ]
تم تقديم ألوان ARGB كقيم كاملة 32 بت.
ToArgbIcc(إنت[])
التحويل من ألوان CMYK إلى ألوان ARGB باستخدام التحويل Icc مع الملفات الافتراضية.
public static Color[] ToArgbIcc(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
تم تقديم بكسل CMYK كقيم كاملة 32 بت.
Returns
Color [ ]
ألوان ARGB
ToArgbIcc(إنت[ ]البث , البث , البث)
التحويل من ألوان CMYK إلى ألوان ARGB باستخدام التحويل Icc مع الملفات المخصصة.
public static Color[] ToArgbIcc(int[] cmykPixels, Stream cmykIccStream, Stream rgbIccStream)
Parameters
cmykPixels
int
[ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
Returns
Color [ ]
ألوان ARGB
ToArgbIcc(إنت)
التحويل من لون CMYK إلى لون ARGB باستخدام التحويل Icc مع الملفات الافتراضية.
public static Color ToArgbIcc(int cmykPixel)
Parameters
cmykPixel
int
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Returns
لون ARGB
Examples
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB باستخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB using default ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
// Specify your path to custom RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert CMYK to RGB using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
}
//The output looks like this:
//Convert CMYK to RGB using default ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//CMYK(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
//Convert CMYK to RGB using custom ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
ToArgbIcc(البث، البث، البث)
التحويل من لون CMYK إلى لون ARGB باستخدام التحويل Icc مع ملف تعريف مخصص.
public static Color ToArgbIcc(int cmykPixel, Stream cmykIccStream, Stream rgbIccStream)
Parameters
cmykPixel
int
تم تقديم لون CMYK كقيمة كاملة 32 بت.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
Returns
لون ARGB
Examples
يظهر المثال التالي كيفية تحويل ألوان CMYK إلى نظرائهم RGB باستخدام ملفات تعريف ICC.
int[] cmykColors = new int[]
{
Aspose.Imaging.CmykColorHelper.FromComponents(255, 0, 0, 0), // Cyan
Aspose.Imaging.CmykColorHelper.FromComponents(0, 255, 0, 0), // Magenta
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 255, 0), // Yellow
Aspose.Imaging.CmykColorHelper.FromComponents(0, 0, 0, 255), // Black
};
System.Console.WriteLine("Convert CMYK to RGB using default ICC profiles.");
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
// Specify your path to custom RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert CMYK to RGB using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (int cmykColor in cmykColors)
{
Aspose.Imaging.Color rgbColor = Aspose.Imaging.CmykColorHelper.ToArgbIcc(cmykColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmykColor);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmykColor);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmykColor);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmykColor);
System.Console.WriteLine("CMYK({0},{1},{2},{3})\t\t=> RGB({4},{5},{6})", c, m, y, k, rgbColor.R, rgbColor.G, rgbColor.B);
}
}
//The output looks like this:
//Convert CMYK to RGB using default ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//CMYK(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
//Convert CMYK to RGB using custom ICC profiles.
//CMYK(255,0,0,0) => RGB(46,188,220)
//CMYK(0,255,0,0) => RGB(231,52,142)
//(0,0,255,0) => RGB(244,253,63)
//CMYK(0,0,0,255) => RGB(21,21,21)
ToCmyk(إنت[])
التحويل من ألوان ARGB إلى ألوان CMYK.
public static int[] ToCmyk(int[] argbPixels)
Parameters
argbPixels
int
[ ]
تم تقديم ألوان ARGB كقيم كاملة 32 بت.
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
ToCmyk(إنت)
التحويل من لون ARGB إلى لون CMYK.
public static int ToCmyk(int argbPixel)
Parameters
argbPixel
int
تم تقديم لون ARGB كقيمة كاملة 32 بت.
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت.
ToCmyk(Color)
التحويل من لون ARGB إلى لون CMYK.
public static int ToCmyk(Color pixel)
Parameters
pixel
Color
لون ARGB
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Examples
يملأ المثال التالي المنطقة المركزية للصورة الخرسانية بكسل سوداء باستخدام طريقة Aspose.Imaging.RasterImage.SaveCmyk32Pixels.
string dir = @"c:\temp\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get an integer representation of black in the CMYK color space.
int blackCmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(Color.Black);
// The black square.
int[] pixels = new int[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = blackCmyk;
}
// Draw the black square at the center of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
rasterImage.SaveCmyk32Pixels(area, pixels);
rasterImage.Save(dir + "sample.SaveCmyk32Pixels.png");
}
يظهر المثال التالي كيفية تحويل ألوان RGB إلى نظرائهم CMYK دون تطبيق ملفات تعريف ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK without using ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
//The output looks like this:
//Convert RGB to CMYK without using ICC profiles.
//RGB(255,0,0) => CMYK(0,255,255,0)
//RGB(0,128,0) => CMYK(255,0,255,127)
//RGB(0,0,255) => CMYK(255,255,0,0)
ToCmyk(Color[])
التحويل من ألوان ARGB إلى ألوان CMYK.
public static int[] ToCmyk(Color[] pixels)
Parameters
pixels
Color
[ ]
ألوان ARGB
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
ToCmykBytes(إنت[ ]إنت، إنت)
تحويل ARGB إلى CMYK.
public static byte[] ToCmykBytes(int[] argbPixels, int startIndex, int length)
Parameters
argbPixels
int
[ ]
تم تقديم ألوان RGB كقيم كاملة 32 بت.
startIndex
int
مؤشر البداية لون RGB.
length
int
عدد بكسلات RGB للتحويل.
Returns
byte [ ]
يتم تقديم ألوان CMYK كسلسلة بايت.
ToCmykIcc(Color[ ]البث , البث , البث)
التحويل من ألوان ARGB إلى ألوان CMYK باستخدام التحويل Icc مع الملفات المخصصة.
public static int[] ToCmykIcc(Color[] pixels, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
Color
[ ]
ألوان ARGB
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
ToCmykIcc(إنت[ ]البث , البث , البث)
التحويل من ألوان ARGB إلى ألوان CMYK باستخدام التحويل Icc مع الملفات المخصصة.
public static int[] ToCmykIcc(int[] pixels, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
ألوان ARGB
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
ToCmykIcc(Color[])
التحويل من ألوان ARGB إلى ألوان CMYK باستخدام التحويل Icc مع الملفات الافتراضية.
public static int[] ToCmykIcc(Color[] pixels)
Parameters
pixels
Color
[ ]
ألوان ARGB
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
ToCmykIcc(إنت[])
التحويل من ألوان ARGB إلى ألوان CMYK باستخدام التحويل Icc مع الملفات الافتراضية.
public static int[] ToCmykIcc(int[] pixels)
Parameters
pixels
int
[ ]
ألوان ARGB
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت.
ToCmykIcc(Color)
التحويل من لون ARGB إلى لون CMYK باستخدام التحويل Icc مع الملفات الافتراضية.
public static int ToCmykIcc(Color pixel)
Parameters
pixel
Color
لون ARGB
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Examples
يظهر المثال التالي كيفية تحويل ألوان RGB إلى نظرائهم CMYK باستخدام ملفات تعريف ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK using default ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
// Specify your path to the RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert RGB to CMYK using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor, rgbProfileStream, cmykProfileStream);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
}
//The output looks like this:
//Convert RGB to CMYK using default ICC profiles.
//RGB(255,0,0) => CMYK(0,254,249,15)
//RGB(0,128,0) => CMYK(247,21,254,85)
//RGB(0,0,255) => CMYK(254,195,0,134)
//Convert RGB to CMYK using custom ICC profiles.
//RGB(255,0,0) => CMYK(0,207,219,0)
//RGB(0,128,0) => CMYK(238,16,254,80)
//RGB(0,0,255) => CMYK(242,182,0,0)
ToCmykIcc(إنت)
التحويل من لون ARGB إلى لون CMYK باستخدام التحويل Icc مع الملفات الافتراضية.
public static int ToCmykIcc(int argb)
Parameters
argb
int
لون ARGB
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت.
ToCmykIcc(الألوان، التدفق، التدفق)
التحويل من لون ARGB إلى لون CMYK باستخدام التحويل Icc مع الملفات المخصصة.
public static int ToCmykIcc(Color pixel, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixel
Color
لون ARGB
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت.
Examples
يظهر المثال التالي كيفية تحويل ألوان RGB إلى نظرائهم CMYK باستخدام ملفات تعريف ICC.
Aspose.Imaging.Color[] rgbColors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green,
Aspose.Imaging.Color.Blue,
};
System.Console.WriteLine("Convert RGB to CMYK using default ICC profiles.");
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
// Specify your path to the RGB and CMYK ICC profiles.
string dir = "c:\\temp\\iccprofiles\\";
System.Console.WriteLine("Convert RGB to CMYK using custom ICC profiles.");
using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
{
foreach (Aspose.Imaging.Color rgbColor in rgbColors)
{
int cmyk = Aspose.Imaging.CmykColorHelper.ToCmykIcc(rgbColor, rgbProfileStream, cmykProfileStream);
int c = Aspose.Imaging.CmykColorHelper.GetC(cmyk);
int m = Aspose.Imaging.CmykColorHelper.GetM(cmyk);
int y = Aspose.Imaging.CmykColorHelper.GetY(cmyk);
int k = Aspose.Imaging.CmykColorHelper.GetK(cmyk);
System.Console.WriteLine("RGB({0},{1},{2})\t\t=> CMYK({3},{4},{5},{6})", rgbColor.R, rgbColor.G, rgbColor.B, c, m, y, k);
}
}
//The output looks like this:
//Convert RGB to CMYK using default ICC profiles.
//RGB(255,0,0) => CMYK(0,254,249,15)
//RGB(0,128,0) => CMYK(247,21,254,85)
//RGB(0,0,255) => CMYK(254,195,0,134)
//Convert RGB to CMYK using custom ICC profiles.
//RGB(255,0,0) => CMYK(0,207,219,0)
//RGB(0,128,0) => CMYK(238,16,254,80)
//RGB(0,0,255) => CMYK(242,182,0,0)
ToCmykIcc(البث، البث، البث)
التحويل من لون ARGB إلى لون CMYK باستخدام التحويل Icc مع الملفات المخصصة.
public static int ToCmykIcc(int argb, Stream rgbIccStream, Stream cmykIccStream)
Parameters
argb
int
لون ARGB
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت.
ToCmykIccBytes(إنت[ ], int , int , تدفق , تدفق)
تحويل RGB إلى CMYK باستخدام ملفات تعريف ICC المخصصة.
public static byte[] ToCmykIccBytes(int[] pixels, int startIndex, int length, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
تم تقديم ألوان RGB كقيم كاملة 32 بت.
startIndex
int
مؤشر البداية لون RGB.
length
int
عدد بكسلات RGB للتحويل.
rgbIccStream
Stream
الملف الشخصي RGB.
cmykIccStream
Stream
الملف الشخصي CMYK.
Returns
byte [ ]
يتم تقديم ألوان CMYK كسلسلة بايت.
ToCmykaBytes(إنت[ ]إنت، إنت)
تحويل ARGB إلى CMYKA (مع الشفافية).
public static byte[] ToCmykaBytes(int[] argbPixels, int startIndex, int length)
Parameters
argbPixels
int
[ ]
تم تقديم ألوان RGB كقيم كاملة 32 بت.
startIndex
int
مؤشر البداية لون RGB.
length
int
عدد بكسلات RGB للتحويل.
Returns
byte [ ]
يتم تقديم ألوان CMYK كسلسلة بايت.
ToCmykaIccBytes(إنت[ ], int , int , تدفق , تدفق)
تحويل RGB إلى CMYKA (مع alpha) باستخدام ملفات تعريف ICC المخصصة.
public static byte[] ToCmykaIccBytes(int[] pixels, int startIndex, int length, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
تم تقديم ألوان RGB كقيم كاملة 32 بت.
startIndex
int
مؤشر البداية لون RGB.
length
int
عدد بكسلات RGB للتحويل.
rgbIccStream
Stream
الملف الشخصي RGB.
cmykIccStream
Stream
الملف الشخصي CMYK.
Returns
byte [ ]
يتم تقديم ألوان CMYK كسلسلة بايت.
ToPsdCmykIcc(إنت[ ]البث , البث , البث)
التحويل من ألوان ARGB إلى ألوان CMYK باستخدام التحويل Icc مع الملفات المخصصة.يستخدم تنسيق PSD CMYK ترتيب بايت KCMY مع قيم القناة المستديرة.
public static int[] ToPsdCmykIcc(int[] pixels, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixels
int
[ ]
ألوان ARGB
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت في ترتيب بايت KCMY مع قيم القناة المعاكسة..
ToPsdCmykIcc(إنت[])
التحويل من ألوان ARGB إلى ألوان CMYK باستخدام التحويل Icc مع الملفات الافتراضية.يستخدم تنسيق PSD CMYK ترتيب بايت KCMY مع قيم القناة المستديرة.
public static int[] ToPsdCmykIcc(int[] pixels)
Parameters
pixels
int
[ ]
ألوان ARGB
Returns
int [ ]
تم تقديم ألوان CMYK كقيم كاملة 32 بت في ترتيب بايت KCMY مع قيم القناة المعاكسة..
ToPsdCmykIcc(إنت)
التحويل من لون ARGB إلى لون CMYK باستخدام التحويل Icc مع الملفات الافتراضية.يستخدم تنسيق PSD CMYK ترتيب بايت KCMY مع قيم القناة المستديرة.
public static int ToPsdCmykIcc(int argb)
Parameters
argb
int
لون ARGB
Returns
تم تقديم لون CMYK كقيمة كاملة 32 بت في ترتيب بايت KCMY مع قيم القناة المعاكسة.
ToPsdCmykIcc(البث، البث، البث)
التحويل من لون ARGB إلى لون CMYK باستخدام التحويل Icc مع الملفات المخصصة.
public static int ToPsdCmykIcc(int pixel, Stream rgbIccStream, Stream cmykIccStream)
Parameters
pixel
int
لون ARGB
rgbIccStream
Stream
تدفق يحتوي على ملف تعريف RGB Icc.
cmykIccStream
Stream
تدفق يحتوي على ملف تعريف CMYK Icc.
Returns
تم تقديم ألوان CMYK كقيم كاملة 32 بت في ترتيب بايت KCMY مع قيم القناة المعاكسة..