CmykColorHelper.GetC
Contents
[
Hide
]CmykColorHelper.GetC method
Gets the cyan component value.
public static int GetC(int cmyk)
Parameter | Type | Description |
---|---|---|
cmyk | Int32 | The CMYK color presented as a 32-bit integer value. |
Return Value
The cyan component value.
Examples
The following example shows how to convert RGB colors to their CMYK counterparts without applying ICC profiles.
[C#]
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)
The following example shows how to convert CMYK colors to their RGB counterparts in a fast manner following straightforward formulas without using ICC profiles.
[C#]
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)
See Also
- class CmykColorHelper
- namespace Aspose.Imaging
- assembly Aspose.Imaging