Ejemplo n.º 1
0
        public virtual void GoodColorTests()
        {
            String[] colors =
            {
                "#00FF00", "00FF00", "#0F0", "0F0", "LIme",
                "rgb(0,255,0 )"
            };
            // TODO webColor creates colors with a zero alpha channel (save
            // "transparent"), BaseColor's 3-param constructor creates them with a
            // 0xFF alpha channel. Which is right?!
            BaseColor testCol = new BaseColor(0, 255, 0);

            foreach (String colStr in colors)
            {
                BaseColor curCol = WebColors.GetRGBColor(colStr);
                Assert.IsTrue(testCol.Equals(curCol), DumpColor(testCol) + "!=" + DumpColor(curCol));
            }
        }
Ejemplo n.º 2
0
        public override void ToPdf(PdfWriter writer, Stream os)
        {
            if (_color != null && !_color.Equals(BaseColor.Black))
            {
                Put(PdfName.C, new PdfArray(new[] { _color.R / 255f, _color.G / 255f, _color.B / 255f }));
            }
            int flag = 0;

            if ((_style & text.Font.BOLD) != 0)
            {
                flag |= 2;
            }
            if ((_style & text.Font.ITALIC) != 0)
            {
                flag |= 1;
            }
            if (flag != 0)
            {
                Put(PdfName.F, new PdfNumber(flag));
            }
            if (_parent != null)
            {
                Put(PdfName.Parent, _parent.IndirectReference);
            }
            if (_destination != null && _destination.HasPage())
            {
                Put(PdfName.Dest, _destination);
            }
            if (_action != null)
            {
                Put(PdfName.A, _action);
            }
            if (_count != 0)
            {
                Put(PdfName.Count, new PdfNumber(_count));
            }
            base.ToPdf(writer, os);
        }
Ejemplo n.º 3
0
        /**
         * Returns the PDF representation of this <CODE>PdfOutline</CODE>.
         *
         * @param writer the encryption information
         * @param os
         * @throws IOException
         */

        public override void ToPdf(PdfWriter writer, Stream os)
        {
            if (color != null && !color.Equals(BaseColor.BLACK))
            {
                Put(PdfName.C, new PdfArray(new float[] { color.R / 255f, color.G / 255f, color.B / 255f }));
            }
            int flag = 0;

            if ((style & Font.BOLD) != 0)
            {
                flag |= 2;
            }
            if ((style & Font.ITALIC) != 0)
            {
                flag |= 1;
            }
            if (flag != 0)
            {
                Put(PdfName.F, new PdfNumber(flag));
            }
            if (parent != null)
            {
                Put(PdfName.PARENT, parent.IndirectReference);
            }
            if (destination != null && destination.HasPage())
            {
                Put(PdfName.DEST, destination);
            }
            if (action != null)
            {
                Put(PdfName.A, action);
            }
            if (count != 0)
            {
                Put(PdfName.COUNT, new PdfNumber(count));
            }
            base.ToPdf(writer, os);
        }
Ejemplo n.º 4
0
        public override bool Equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is PdfSpotColor))
            {
                return(false);
            }

            PdfSpotColor spotColor = (PdfSpotColor)o;

            if (!altcs.Equals(spotColor.altcs))
            {
                return(false);
            }
            if (!name.Equals(spotColor.name))
            {
                return(false);
            }

            return(true);
        }
 private bool CompareColors(BaseColor c1, BaseColor c2) {
     if (c1 == null && c2 == null)
         return true;
     if (c1 == null || c2 == null)
         return false;
     if (c1 is ExtendedColor)
         return c1.Equals(c2);
     return c2.Equals(c1);
 }