Class PdfICCColor
Represents an ICC color, based on an ICC colorspace.
Namespace: Syncfusion.Pdf.ColorSpace
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfICCColor : PdfExtendedColor
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
Constructors
PdfICCColor(PdfColorSpaces)
Initializes a new instance of the PdfICCColor class.
Declaration
public PdfICCColor(PdfColorSpaces colorspace)
Parameters
Type | Name | Description |
---|---|---|
PdfColorSpaces | colorspace | The colorspace. |
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")
See Also
Properties
ColorComponents
Gets or sets the color components.
Declaration
public double[] ColorComponents { get; set; }
Property Value
Type | Description |
---|---|
System.Double[] | An array of values that describe the color in the ICC colorspace. |
Remarks
The length of this array must match the value of ColorComponents property on the underlying ICC colorspace.
Examples
// Creates a new document
PdfDocument doc = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = doc.Pages.Add();
// Read the ICC profile from disk.
FileStream fs = new FileStream("rgb.icc", FileMode.Open, FileAccess.Read);
byte[] profileData = new byte[fs.Length];
fs.Read(profileData, 0, profileData.Length);
fs.Close();
PdfCalRGBColorSpace calRgbCS = new PdfCalRGBColorSpace();
calRgbCS.Gamma = new double[] { 7.6, 5.1, 8.5 };
// Creating instance for ICCColorSpace
PdfICCColorSpace IccBasedCS = new PdfICCColorSpace();
IccBasedCS.ProfileData = profileData;
IccBasedCS.AlternateColorSpace = calRgbCS;
IccBasedCS.ColorComponents = 3;
IccBasedCS.Range = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
PdfICCColor iccColorSpace = new PdfICCColor(IccBasedCS);
iccColorSpace.ColorComponents = new double[] { 1, 0, 1 };
PdfPen pen = new PdfPen(iccColorSpace);
RectangleF rect = new RectangleF(20, 70, 200, 100);
page.Graphics.DrawRectangle(pen, rect);
doc.Save("ICCColorCS.pdf");
' Creates a new document
Dim doc As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = doc.Pages.Add()
' Read the ICC profile from disk.
Dim fs As FileStream = New FileStream("rgb.icc", FileMode.Open, FileAccess.Read)
Dim profileData() As Byte = New Byte(fs.Length - 1){}
fs.Read(profileData, 0, profileData.Length)
fs.Close()
Dim calRgbCS As PdfCalRGBColorSpace = New PdfCalRGBColorSpace()
calRgbCS.Gamma = New Double() { 7.6, 5.1, 8.5 }
' Creating instance for ICCColorSpace
Dim IccBasedCS As PdfICCColorSpace = New PdfICCColorSpace()
IccBasedCS.ProfileData = profileData
IccBasedCS.AlternateColorSpace = calRgbCS
IccBasedCS.ColorComponents = 3
IccBasedCS.Range = New Double() { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 }
Dim iccColorSpace As PdfICCColor = New PdfICCColor(IccBasedCS)
iccColorSpace.ColorComponents = New Double() { 1, 0, 1 }
Dim pen As PdfPen = New PdfPen(iccColorSpace)
Dim rect As RectangleF = New RectangleF(20, 70, 200, 100)
page.Graphics.DrawRectangle(pen, rect)
doc.Save("ICCColorCS.pdf")