Class CmykColorHelper
نام ها : Aspose.Imaging جمع آوری: Aspose.Imaging.dll (25.4.0)
روش های کمک کننده برای کار با رنگ CMYK ارائه شده به عنوان یک ارزش کامل 32 بیتی امضا شده است.ارائه API مشابه به Aspose.Imaging.CmykColor ساختار.این سبک تر است زیرا رنگ CMYK همانند Int32 به جای ساختار با میدان های داخلی ارائه شده است.لطفا ترجیح دهید در صورت امکان از روش های استاتیک این کلاس استفاده کنید.آرشیو برچسب ها: CmykColor Structure
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(int، int، int، int)
ایجاد 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(int)
ارزش اجزای سیان را به دست می آورد.
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)
گیتک(int)
ارزش اجزای سیاه را به دست می آورد.
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)
GTM(int)
ارزش اجزای Magenta را به دست می آورد.
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)
گیتا(int)
ارزش قطعه ی زرد را به دست می آورد.
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(int[])
تبدیل از رنگ های CMYK به رنگ های ARGB
public static Color[] ToArgb(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
رنگ های CMYK به عنوان ارزش های کامل 32 بیتی ارائه شده است.
Returns
Color [ ]
رنگ های ARGB
ToArgb(int)
تغییر رنگ از رنگ 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(int[])
تبدیل از رنگ های CMYK به رنگ های ARGB
public static int[] ToArgb32(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
رنگ های CMYK به عنوان ارزش های کامل 32 بیتی ارائه شده است.
Returns
int [ ]
رنگ های ARGB به عنوان ارزش های کامل 32 بیتی ارائه شده است.
ToArgbIcc(int[])
تبدیل از رنگ های CMYK به رنگ های ARGB با استفاده از تبدیل Icc با پروفایل های پیش فرض.
public static Color[] ToArgbIcc(int[] cmykPixels)
Parameters
cmykPixels
int
[ ]
پیکسل های CMYK به عنوان ارزش های کامل 32 بیتی ارائه شده است.
Returns
Color [ ]
رنگ های ARGB
ToArgbIcc(int[ ], جریان، جریان)
تبدیل از رنگ های 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(int)
تبدیل از رنگ 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(int[])
تبدیل از رنگ های ARGB به رنگ های CMYK
public static int[] ToCmyk(int[] argbPixels)
Parameters
argbPixels
int
[ ]
رنگ های ARGB به عنوان ارزش های کامل 32 بیتی ارائه شده است.
Returns
int [ ]
رنگ های CMYK به عنوان ارزش های کامل 32 بیتی ارائه شده است.
ToCmyk(int)
تبدیل از رنگ 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(int[ ], int , int)
تبدیل 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(int[ ], جریان، جریان)
تبدیل از رنگ های 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(int[])
تبدیل از رنگ های 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(int)
تبدیل از رنگ 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 , 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(int[ ], int , int)
تبدیل 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 , int , جریان , جریان)
تبدیل RGB به CMYKA (با آلفا) با استفاده از پروفایل های 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(int[ ], جریان، جریان)
تبدیل از رنگ های 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(int[])
تبدیل از رنگ های ARGB به رنگ های CMYK با استفاده از تبدیل Icc با پروفایل های پیش فرض.استفاده از PSD CMYK فرمت KCMY بایت سفارش با ارزش های کانال تبدیل شده.
public static int[] ToPsdCmykIcc(int[] pixels)
Parameters
pixels
int
[ ]
رنگ های ARGB
Returns
int [ ]
رنگ های CMYK به عنوان ارزش های کامل 32 بیتی در ترتیب بایت KCMY با ارزش های کانال تبدیل ارائه شده است.
ToPsdCmykIcc(int)
تبدیل از رنگ 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 با ارزش های کانال تبدیل ارائه شده است.