public static ColorValueExtent ColorValueExtent(MetafileReader reader) { ColorValueExtent result; if (reader.Descriptor.ColorModel == ColorModel.RGB) { MetafileColor min = reader.ReadDirectColor(); MetafileColor max = reader.ReadDirectColor(); result = new ColorValueExtent(ColorSpace.RGB, min, max); } else if (reader.Descriptor.ColorModel == ColorModel.CMYK) { MetafileColor min = reader.ReadDirectColor(); MetafileColor max = reader.ReadDirectColor(); result = new ColorValueExtent(ColorSpace.CMYK, min, max); } else if (reader.Descriptor.ColorModel == ColorModel.CIELAB || reader.Descriptor.ColorModel == ColorModel.CIELUV || reader.Descriptor.ColorModel == ColorModel.RGBrelated) { double firstScale = reader.ReadReal(); double firstOffset = reader.ReadReal(); double secondScale = reader.ReadReal(); double secondOffset = reader.ReadReal(); double thirdScale = reader.ReadReal(); double thirdOffset = reader.ReadReal(); result = new ColorValueExtent(ColorSpace.CIE, firstScale, firstOffset, secondScale, secondOffset, thirdScale, thirdOffset); } else { // unsupported, just return a default unknown color space result = new ColorValueExtent(); } return(result); }
public void AcceptMetafileDescriptorColorValueExtent(ColorValueExtent colorValueExtent, PrintContext parameter) { if (colorValueExtent.ColorSpace == ColorSpace.Unknown) { parameter.WriteLine("Color Value Extent: Unknown Color Space"); } else if (colorValueExtent.ColorSpace == ColorSpace.CIE) { parameter.WriteLine("Color Value Extent: CIE {0}+{1}/{2}+{3}/{4}+{5}", colorValueExtent.FirstScale, colorValueExtent.FirstOffset, colorValueExtent.SecondScale, colorValueExtent.SecondOffset, colorValueExtent.ThirdScale, colorValueExtent.ThirdOffset); } else // RGB or CMYK { parameter.WriteLine("Color Value Extent: {0} {1}/{2}", colorValueExtent.ColorSpace, colorValueExtent.Minimum, colorValueExtent.Maximum); } }
public static ColorValueExtent ColorValueExtent(MetafileReader reader, CommandHeader commandHeader) { // If the model is RGB or CMYK, then 2 parameters: // P1: (direct colour value) minimum colour value // P2: (direct colour value) maximum colour value // If the model is CIELAB, CIELUV, or RGB-related then 3 parameters: // P1: (real) scale and offset pair for first component // P2: (real) scale and offset pair for second component // P3: (real) scale and offset pair for third component ColorValueExtent result; if (reader.Descriptor.ColorModel == ColorModel.RGB) { MetafileColor min = reader.ReadDirectColor(); MetafileColor max = reader.ReadDirectColor(); result = new ColorValueExtent(ColorSpace.RGB, min, max); } else if (reader.Descriptor.ColorModel == ColorModel.CMYK) { MetafileColor min = reader.ReadDirectColor(); MetafileColor max = reader.ReadDirectColor(); result = new ColorValueExtent(ColorSpace.CMYK, min, max); } else if (reader.Descriptor.ColorModel == ColorModel.CIELAB || reader.Descriptor.ColorModel == ColorModel.CIELUV || reader.Descriptor.ColorModel == ColorModel.RGBrelated) { double firstScale = reader.ReadReal(); double firstOffset = reader.ReadReal(); double secondScale = reader.ReadReal(); double secondOffset = reader.ReadReal(); double thirdScale = reader.ReadReal(); double thirdOffset = reader.ReadReal(); result = new ColorValueExtent(ColorSpace.CIE, firstScale, firstOffset, secondScale, secondOffset, thirdScale, thirdOffset); } else { // unsupported, just return a default unknown color space result = new ColorValueExtent(); } return(result); }
public virtual void AcceptMetafileDescriptorColorValueExtent(ColorValueExtent colorValueExtent, T parameter) { // intentionally left blank }