public ColorGradientFormatting(ILittleEndianInput in1) { in1.ReadShort(); // Ignored in1.ReadByte(); // Reserved int numI = in1.ReadByte(); int numG = in1.ReadByte(); if (numI != numG) { //log.Log(POILogger.WARN, "Inconsistent Color Gradient defintion, found " + numI + " vs " + numG + " entries"); } options = (byte)in1.ReadByte(); thresholds = new ColorGradientThreshold[numI]; for (int i = 0; i < thresholds.Length; i++) { thresholds[i] = new ColorGradientThreshold(in1); } colors = new ExtendedColor[numG]; for (int i = 0; i < colors.Length; i++) { in1.ReadDouble(); // Slightly pointless step counter colors[i] = new ExtendedColor(in1); } }
private void OnDrawGizmosSelected() { Gizmos.color = ExtendedColor.RGB(129, 198, 247); Gizmos.DrawRay(transform.position, transform.forward * poiMaxDistanceCheck); Gizmos.color = ExtendedColor.RGB(186, 139, 247); Gizmos.DrawWireSphere(transform.position + transform.forward * poiMaxDistanceCheck, poiSearchRadius); }
protected override void CheckColor(PdfWriter writer, int key, Object obj1) { switch (key) { case PdfIsoKeys.PDFISOKEY_COLOR: if (obj1 is ExtendedColor) { ExtendedColor ec = (ExtendedColor)obj1; switch (ec.Type) { case ExtendedColor.TYPE_CMYK: CheckColor(writer, PdfIsoKeys.PDFISOKEY_CMYK, obj1); break; case ExtendedColor.TYPE_GRAY: return; case ExtendedColor.TYPE_RGB: CheckColor(writer, PdfIsoKeys.PDFISOKEY_RGB, obj1); break; case ExtendedColor.TYPE_SEPARATION: SpotColor sc = (SpotColor)ec; CheckColor(writer, PdfIsoKeys.PDFISOKEY_COLOR, sc.PdfSpotColor.AlternativeCS); break; case ExtendedColor.TYPE_SHADING: ShadingColor xc = (ShadingColor)ec; CheckColor(writer, PdfIsoKeys.PDFISOKEY_COLOR, xc.PdfShadingPattern.Shading.ColorSpace); break; case ExtendedColor.TYPE_PATTERN: PatternColor pc = (PatternColor)ec; CheckColor(writer, PdfIsoKeys.PDFISOKEY_COLOR, pc.Painter.DefaultColor); break; } } else if (obj1 is BaseColor) { CheckColor(writer, PdfIsoKeys.PDFISOKEY_RGB, obj1); } break; case PdfIsoKeys.PDFISOKEY_CMYK: if (rgbUsed) { throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("devicergb.and.devicecmyk.colorspaces.cannot.be.used.both.in.one.file")); } cmykUsed = true; break; case PdfIsoKeys.PDFISOKEY_RGB: if (cmykUsed) { throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("devicergb.and.devicecmyk.colorspaces.cannot.be.used.both.in.one.file")); } rgbUsed = true; break; } }
static void Main(string[] args) { SimpleCollection sc = new SimpleCollection() .AddRange(2, 5, 7, -6, -8, 200, 201) .ApplyFilter(i => i % 2 == 0) .ApplyFilter(i => i <= 200) .ApplyFilter(i => i > 0); foreach (var item in sc.GetCollection()) { Console.WriteLine(item); } InstanceContainer.Register <ICalculator>(new Calculator()); ICalculator calculator = InstanceContainer.Resolve <ICalculator>(); Console.WriteLine(calculator); object lol = new ExtendedCalculator(); ICalculator ec = (ICalculator)lol; Console.WriteLine(ec); Calculator calculator1 = new Calculator { A = 50 }; Console.WriteLine(calculator1.A); ChangeA(calculator1); Console.WriteLine(calculator1.A); ExtendedColor exColor = CollorCreator.GetColorEnum(ExtendedColor.Indigo); Color color = CollorCreator.GetColorEnum(Color.Blue); Console.WriteLine(color); Console.WriteLine(exColor); Console.ReadKey(); }
public void Serialize(ILittleEndianOutput out1) { out1.WriteShort(0); out1.WriteByte(0); out1.WriteByte(thresholds.Length); out1.WriteByte(thresholds.Length); out1.WriteByte(options); foreach (ColorGradientThreshold t in thresholds) { t.Serialize(out1); } double step = 1d / (colors.Length - 1); for (int i = 0; i < colors.Length; i++) { out1.WriteDouble(i * step); ExtendedColor c = colors[i]; c.Serialize(out1); } }
public DataBarFormatting(ILittleEndianInput in1) { in1.ReadShort(); // Ignored in1.ReadByte(); // Reserved options = (byte)in1.ReadByte(); percentMin = (byte)in1.ReadByte(); percentMax = (byte)in1.ReadByte(); if (percentMin < 0 || percentMin > 100) { //log.Log(POILogger.WARN, "Inconsistent Minimum Percentage found " + percentMin); Console.WriteLine("Inconsistent Minimum Percentage found " + percentMin); } if (percentMax < 0 || percentMax > 100) { //log.Log(POILogger.WARN, "Inconsistent Minimum Percentage found " + percentMin); Console.WriteLine("Inconsistent Minimum Percentage found " + percentMin); } color = new ExtendedColor(in1); thresholdMin = new DataBarThreshold(in1); thresholdMax = new DataBarThreshold(in1); }
/** * Business logic that checks if a certain object is in conformance with PDF/X. * @param writer the writer that is supposed to write the PDF/X file * @param key the type of PDF ISO conformance that has to be checked * @param obj1 the object that is checked for conformance */ public static void CheckPDFXConformance(PdfWriter writer, int key, Object obj1) { if (writer == null || !writer.IsPdfX()) { return; } int conf = writer.PDFXConformance; switch (key) { case PdfIsoKeys.PDFISOKEY_COLOR: switch (conf) { case PdfWriter.PDFX1A2001: if (obj1 is ExtendedColor) { ExtendedColor ec = (ExtendedColor)obj1; switch (ec.Type) { case ExtendedColor.TYPE_CMYK: case ExtendedColor.TYPE_GRAY: return; case ExtendedColor.TYPE_RGB: throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("colorspace.rgb.is.not.allowed")); case ExtendedColor.TYPE_SEPARATION: SpotColor sc = (SpotColor)ec; CheckPDFXConformance(writer, PdfIsoKeys.PDFISOKEY_COLOR, sc.PdfSpotColor.AlternativeCS); break; case ExtendedColor.TYPE_SHADING: ShadingColor xc = (ShadingColor)ec; CheckPDFXConformance(writer, PdfIsoKeys.PDFISOKEY_COLOR, xc.PdfShadingPattern.Shading.ColorSpace); break; case ExtendedColor.TYPE_PATTERN: PatternColor pc = (PatternColor)ec; CheckPDFXConformance(writer, PdfIsoKeys.PDFISOKEY_COLOR, pc.Painter.DefaultColor); break; } } else if (obj1 is BaseColor) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("colorspace.rgb.is.not.allowed")); } break; } break; case PdfIsoKeys.PDFISOKEY_CMYK: break; case PdfIsoKeys.PDFISOKEY_RGB: if (conf == PdfWriter.PDFX1A2001) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("colorspace.rgb.is.not.allowed")); } break; case PdfIsoKeys.PDFISOKEY_FONT: if (!((BaseFont)obj1).IsEmbedded()) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("all.the.fonts.must.be.embedded.this.one.isn.t.1", ((BaseFont)obj1).PostscriptFontName)); } break; case PdfIsoKeys.PDFISOKEY_IMAGE: PdfImage image = (PdfImage)obj1; if (image.Get(PdfName.SMASK) != null) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("the.smask.key.is.not.allowed.in.images")); } switch (conf) { case PdfWriter.PDFX1A2001: PdfObject cs = image.Get(PdfName.COLORSPACE); if (cs == null) { return; } if (cs.IsName()) { if (PdfName.DEVICERGB.Equals(cs)) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("colorspace.rgb.is.not.allowed")); } } else if (cs.IsArray()) { if (PdfName.CALRGB.Equals(((PdfArray)cs)[0])) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("colorspace.calrgb.is.not.allowed")); } } break; } break; case PdfIsoKeys.PDFISOKEY_GSTATE: PdfDictionary gs = (PdfDictionary)obj1; PdfObject obj = gs.Get(PdfName.BM); if (obj != null && !PdfGState.BM_NORMAL.Equals(obj) && !PdfGState.BM_COMPATIBLE.Equals(obj)) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("blend.mode.1.not.allowed", obj.ToString())); } obj = gs.Get(PdfName.CA); double v = 0.0; if (obj != null && (v = ((PdfNumber)obj).DoubleValue) != 1.0) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("transparency.is.not.allowed.ca.eq.1", v)); } obj = gs.Get(PdfName.ca_); v = 0.0; if (obj != null && (v = ((PdfNumber)obj).DoubleValue) != 1.0) { throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("transparency.is.not.allowed.ca.eq.1", v)); } break; case PdfIsoKeys.PDFISOKEY_LAYER: throw new PdfXConformanceException(MessageLocalization.GetComposedMessage("layers.are.not.allowed")); } }
public IConditionalFormattingRule CreateConditionalFormattingRule(ExtendedColor color) { return(CreateConditionalFormattingRule((HSSFExtendedColor)color)); }
/** * Business logic that checks if a certain object is in conformance with PDF/X. * @param writer the writer that is supposed to write the PDF/X file * @param key the type of PDF/X conformance that has to be checked * @param obj1 the object that is checked for conformance */ public static void CheckPDFXConformance(PdfWriter writer, int key, Object obj1) { if (writer == null || !writer.IsPdfX()) { return; } int conf = writer.PDFXConformance; switch (key) { case PDFXKEY_COLOR: switch (conf) { case PdfWriter.PDFX1A2001: if (obj1 is ExtendedColor) { ExtendedColor ec = (ExtendedColor)obj1; switch (ec.Type) { case ExtendedColor.TYPE_CMYK: case ExtendedColor.TYPE_GRAY: return; case ExtendedColor.TYPE_RGB: throw new PdfXConformanceException("Colorspace RGB is not allowed."); case ExtendedColor.TYPE_SEPARATION: SpotColor sc = (SpotColor)ec; CheckPDFXConformance(writer, PDFXKEY_COLOR, sc.PdfSpotColor.AlternativeCS); break; case ExtendedColor.TYPE_SHADING: ShadingColor xc = (ShadingColor)ec; CheckPDFXConformance(writer, PDFXKEY_COLOR, xc.PdfShadingPattern.Shading.ColorSpace); break; case ExtendedColor.TYPE_PATTERN: PatternColor pc = (PatternColor)ec; CheckPDFXConformance(writer, PDFXKEY_COLOR, pc.Painter.DefaultColor); break; } } else if (obj1 is Color) { throw new PdfXConformanceException("Colorspace RGB is not allowed."); } break; } break; case PDFXKEY_CMYK: break; case PDFXKEY_RGB: if (conf == PdfWriter.PDFX1A2001) { throw new PdfXConformanceException("Colorspace RGB is not allowed."); } break; case PDFXKEY_FONT: if (!((BaseFont)obj1).IsEmbedded()) { throw new PdfXConformanceException("All the fonts must be embedded. This one isn't: " + ((BaseFont)obj1).PostscriptFontName); } break; case PDFXKEY_IMAGE: PdfImage image = (PdfImage)obj1; if (image.Get(PdfName.SMASK) != null) { throw new PdfXConformanceException("The /SMask key is not allowed in images."); } switch (conf) { case PdfWriter.PDFX1A2001: PdfObject cs = image.Get(PdfName.COLORSPACE); if (cs == null) { return; } if (cs.IsName()) { if (PdfName.DEVICERGB.Equals(cs)) { throw new PdfXConformanceException("Colorspace RGB is not allowed."); } } else if (cs.IsArray()) { if (PdfName.CALRGB.Equals(((PdfArray)cs)[0])) { throw new PdfXConformanceException("Colorspace CalRGB is not allowed."); } } break; } break; case PDFXKEY_GSTATE: PdfDictionary gs = (PdfDictionary)obj1; PdfObject obj = gs.Get(PdfName.BM); if (obj != null && !PdfGState.BM_NORMAL.Equals(obj) && !PdfGState.BM_COMPATIBLE.Equals(obj)) { throw new PdfXConformanceException("Blend mode " + obj.ToString() + " not allowed."); } obj = gs.Get(PdfName.CA); double v = 0.0; if (obj != null && (v = ((PdfNumber)obj).DoubleValue) != 1.0) { throw new PdfXConformanceException("Transparency is not allowed: /CA = " + v); } obj = gs.Get(PdfName.ca_); v = 0.0; if (obj != null && (v = ((PdfNumber)obj).DoubleValue) != 1.0) { throw new PdfXConformanceException("Transparency is not allowed: /ca = " + v); } break; case PDFXKEY_LAYER: throw new PdfXConformanceException("Layers are not allowed."); } }
//set header text void SetHeaderText(ExtendedColor col) { _ref.HeaderText.text = "Tap the <b><color=#" + col.color.ToHex() + "ff>" + col.name + "</color></b> quare!"; }