In the following example we demonstrate how to use generic color components to draw in the Lab color space.
[C#]
using (Doc doc = new Doc()) {
doc.Width = 80;
doc.Rect.Inset(50, 50);
ColorSpace cs = new ColorSpace(doc.ObjectSoup, ColorSpaceType.Lab);
doc.ColorSpace = cs.ID;
// This Lab color is a deep green
doc.Color.ColorSpace = ColorOperatorType.ColorSpace;
doc.Color.Components[0] = 50; // L range is 0 to +100
doc.Color.Components[1] = -50; // a range is -100 to +100
doc.Color.Components[2] = +50; // B range is -100 to +100
doc.AddOval(true);
doc.Save("examplelabcolorspace.pdf");
}
[Visual Basic]
Using doc As New Doc()
doc.Width = 80
doc.Rect.Inset(50, 50)
Dim cs As New ColorSpace(doc.ObjectSoup, ColorSpaceType.Lab)
doc.ColorSpace = cs.ID
' This Lab color is a deep green
doc.Color.ColorSpace = ColorOperatorType.ColorSpace
doc.Color.Components(0) = 50
' L range is 0 to +100
doc.Color.Components(1) = -50
' a range is -100 to +100
doc.Color.Components(2) = +50
' B range is -100 to +100
doc.AddOval(True)
doc.Save("examplelabcolorspace.pdf")
End Using
End Sub
examplelabcolorspace.pdf
|