示例#1
0
 public PdfRectangleF()
 {
     point1 = new PdfReal();
     point2 = new PdfReal();
     point3 = new PdfReal();
     point4 = new PdfReal();
     Init();
 }
示例#2
0
 public DeviceCMYKColor(double c, double m, double y, double k) : this(
         new PdfArray(
             PdfReal.Get(NormalizeComponent(c)),
             PdfReal.Get(NormalizeComponent(m)),
             PdfReal.Get(NormalizeComponent(y)),
             PdfReal.Get(NormalizeComponent(k))))
 {
 }
示例#3
0
 public Line(Page page, SKPoint startPoint, SKPoint endPoint, string text, DeviceRGBColor color)
     : base(page, PdfName.Line, SKRect.Create(startPoint.X, startPoint.Y, endPoint.X - startPoint.X, endPoint.Y - startPoint.Y), text)
 {
     BaseDataObject[PdfName.L] = new PdfArray(new PdfDirectObject[] { PdfReal.Get(0), PdfReal.Get(0), PdfReal.Get(0), PdfReal.Get(0) });
     StartPoint = startPoint;
     EndPoint   = endPoint;
     Color      = color;
 }
示例#4
0
 public PdfRectangleF(PdfReal point1, PdfReal point2, PdfReal point3, PdfReal point4)
 {
     this.point1 = point1;
     this.point2 = point2;
     this.point3 = point3;
     this.point4 = point4;
     Init();
 }
示例#5
0
 /*
  * TODO:colors MUST be instantiated only indirectly by the ColorSpace.getColor method!
  * This method MUST be made internal and its color space MUST be passed as argument!
  */
 public LabColor(double l, double a, double b) : this(
         new PdfArray(
             PdfReal.Get(NormalizeComponent(l)),//TODO:normalize using the actual color space ranges!!!
             PdfReal.Get(NormalizeComponent(a)),
             PdfReal.Get(NormalizeComponent(b))
             )
         )
 {
 }
示例#6
0
 public CalGrayColor(
     double g
     ) : this(
         new List <PdfDirectObject>(
             new PdfDirectObject[] { PdfReal.Get(NormalizeComponent(g)) }
             )
         )
 {
 }
示例#7
0
 public CalRGBColor(double r, double g, double b)
     : this(new PdfArray(
                PdfReal.Get(NormalizeComponent(r)),
                PdfReal.Get(NormalizeComponent(g)),
                PdfReal.Get(NormalizeComponent(b))
                )
            )
 {
 }
示例#8
0
 public DeviceRGBColor(double r, double g, double b)
     : this(new PdfDirectObject[]
 {
     PdfReal.Get(NormalizeComponent(r)),
     PdfReal.Get(NormalizeComponent(g)),
     PdfReal.Get(NormalizeComponent(b))
 })
 {
 }
示例#9
0
 public SetCharSpace(double value)
     : base(
         OperatorKeyword,
         new List <PdfDirectObject>(
             new PdfDirectObject[] { PdfReal.Get(value) }
             )
         )
 {
 }
示例#10
0
 /**
  * <param name="pointX">Current point X.</param>
  * <param name="pointY">Current point Y.</param>
  */
 public BeginSubpath(double pointX, double pointY)
     : base(OperatorKeyword, new List <PdfDirectObject>(new PdfDirectObject[]
 {
     PdfReal.Get(pointX),
     PdfReal.Get(pointY)
 }
                                                        )
            )
 {
 }
示例#11
0
 private void EnsureSpaceOperation(
     )
 {
     if (@operator.Equals(SimpleOperatorKeyword))
     {
         @operator = SpaceOperatorKeyword;
         operands.Insert(0, PdfReal.Get(0));
         operands.Insert(1, PdfReal.Get(0));
     }
 }
示例#12
0
        private static IList <PdfDirectObject> GetComponentValues(params double[] components)
        {// TODO:normalize parameters!
            IList <PdfDirectObject> componentValues = new List <PdfDirectObject>();

            foreach (double component in components)
            {
                componentValues.Add(PdfReal.Get((component)));
            }
            return(componentValues);
        }
示例#13
0
 public TranslateTextRelative(
     double offsetX,
     double offsetY,
     bool leadSet
     ) : base(
         leadSet ? LeadOperatorKeyword : SimpleOperatorKeyword,
         PdfReal.Get(offsetX),
         PdfReal.Get(offsetY)
         )
 {
 }
示例#14
0
 public SetTextMatrix(double a, double b, double c, double d, double e, double f)
     : base(OperatorKeyword,
            PdfReal.Get(a),
            PdfReal.Get(b),
            PdfReal.Get(c),
            PdfReal.Get(d),
            PdfReal.Get(e),
            PdfReal.Get(f)
            )
 {
 }
示例#15
0
 /**
  * <param name="text">Text encoded using current font's encoding.</param>
  * <param name="wordSpace">Word spacing.</param>
  * <param name="charSpace">Character spacing.</param>
  */
 public ShowTextToNextLine(
     byte[] text,
     double wordSpace,
     double charSpace
     ) : base(
         SpaceOperatorKeyword,
         PdfReal.Get(wordSpace),
         PdfReal.Get(charSpace),
         new PdfByteString(text)
         )
 {
 }
示例#16
0
 public SeparationColor(
     double intensity
     ) : this(
         new List <PdfDirectObject>(
             new PdfDirectObject[]
 {
     PdfReal.Get(intensity) //TODO:normalize value (see devicecolor)!
 }
             )
         )
 {
 }
示例#17
0
 public DeviceCMYKColor(double c, double m, double y, double k) : this(
         new List <PdfDirectObject>(
             new PdfDirectObject[]
 {
     PdfReal.Get(NormalizeComponent(c)),
     PdfReal.Get(NormalizeComponent(m)),
     PdfReal.Get(NormalizeComponent(y)),
     PdfReal.Get(NormalizeComponent(k))
 }
             )
         )
 {
 }
示例#18
0
 /**
  * <summary>Creates a partially-explicit curve.</summary>
  * <param name="point">Final endpoint.</param>
  * <param name="control">Explicit control point.</param>
  * <param name="operator">Operator (either <code>InitialOperator</code> or <code>FinalOperator</code>).
  * It defines how to interpret the <code>control</code> parameter.</param>
  */
 public DrawCurve(SKPoint point, SKPoint control, string @operator)
     : base(@operator.Equals(InitialOperatorKeyword, StringComparison.Ordinal)
           ? InitialOperatorKeyword
           : FinalOperatorKeyword, new List <PdfDirectObject>(new PdfDirectObject[]
 {
     PdfReal.Get(control.X),
     PdfReal.Get(control.Y),
     PdfReal.Get(point.X),
     PdfReal.Get(point.Y)
 }
                                                              )
            )
 {
 }
示例#19
0
 /**
  * <summary>Creates a fully-explicit curve.</summary>
  */
 public DrawCurve(double pointX, double pointY, double control1X, double control1Y, double control2X, double control2Y)
     : base(FullOperatorKeyword, new List <PdfDirectObject>(new PdfDirectObject[]
 {
     PdfReal.Get(control1X),
     PdfReal.Get(control1Y),
     PdfReal.Get(control2X),
     PdfReal.Get(control2Y),
     PdfReal.Get(pointX),
     PdfReal.Get(pointY)
 }
                                                            )
            )
 {
 }
示例#20
0
 /*
  * TODO:colors MUST be instantiated only indirectly by the ColorSpace.getColor method!
  * This method MUST be made internal and its color space MUST be passed as argument!
  */
 public LabColor(
     double l,
     double a,
     double b
     ) : this(
         new List <PdfDirectObject>(
             new PdfDirectObject[]
 {
     PdfReal.Get(NormalizeComponent(l)),//TODO:normalize using the actual color space ranges!!!
     PdfReal.Get(NormalizeComponent(a)),
     PdfReal.Get(NormalizeComponent(b))
 }
             )
         )
 {
 }
示例#21
0
 public CalRGBColor(
     double r,
     double g,
     double b
     ) : this(
         new List <PdfDirectObject>(
             new PdfDirectObject[]
 {
     PdfReal.Get(NormalizeComponent(r)),
     PdfReal.Get(NormalizeComponent(g)),
     PdfReal.Get(NormalizeComponent(b))
 }
             )
         )
 {
 }
示例#22
0
 public ModifyCTM(double a, double b, double c, double d, double e, double f)
     : base(OperatorKeyword,
            new List <PdfDirectObject>(
                new PdfDirectObject[]
 {
     PdfReal.Get(a),
     PdfReal.Get(b),
     PdfReal.Get(c),
     PdfReal.Get(d),
     PdfReal.Get(e),
     PdfReal.Get(f)
 }
                )
            )
 {
 }
示例#23
0
        private IPdfElement ParseNumber()
        {
            long          startPosition = _streamPosition;
            bool          valid         = false;
            int           dotCount      = 0;
            StringBuilder sbNumber      = new StringBuilder();

            if (PeekChar() == '-')
            {
                sbNumber.Append('-');
                NextChar();
            }
            else if (PeekChar() == '+')
            {
                NextChar();
            }
            while (IsDigit(PeekChar()) || PeekChar() == '.')
            {
                if (PeekChar() == '.')
                {
                    sbNumber.Append(_decimalSeparator);
                    dotCount++;
                }
                else
                {
                    sbNumber.Append((char)PeekChar());
                }
                NextChar();
                valid = true;
            }
            if (valid && dotCount <= 1)
            {
                if (dotCount == 0)
                {
                    PdfInteger obj = new PdfInteger();
                    obj.Value = Convert.ToInt32(sbNumber.ToString());
                    return(obj);
                }
                if (dotCount == 1)
                {
                    PdfReal obj = new PdfReal();
                    obj.Value = Convert.ToDouble(sbNumber.ToString(), CultureInfo.InvariantCulture);
                    return(obj);
                }
            }
            throw new Exception(string.Format("Expected number at {0}, found \"{1}\"", startPosition, sbNumber.ToString()));
        }
示例#24
0
 /**
  * <summary>Creates a partially-explicit curve.</summary>
  * <param name="point">Final endpoint.</param>
  * <param name="control">Explicit control point.</param>
  * <param name="operator">Operator (either <code>InitialOperator</code> or <code>FinalOperator</code>).
  * It defines how to interpret the <code>control</code> parameter.</param>
  */
 public DrawCurve(
     PointF point,
     PointF control,
     string @operator
     ) : base(
         @operator.Equals(InitialOperatorKeyword) ? InitialOperatorKeyword : FinalOperatorKeyword,
         new List <PdfDirectObject>(
             new PdfDirectObject[]
 {
     PdfReal.Get(control.X),
     PdfReal.Get(control.Y),
     PdfReal.Get(point.X),
     PdfReal.Get(point.Y)
 }
             )
         )
 {
 }
示例#25
0
        /**
         * <summary>Gets the result of the calculation applied by this function
         * to the specified input values.</summary>
         * <param name="inputs">Input values.</param>
         */
        public IList <PdfDirectObject> Calculate(IList <PdfDirectObject> inputs)
        {
            IList <PdfDirectObject> outputs = new List <PdfDirectObject>();

            {
                double[] inputValues = new double[inputs.Count];
                for (int index = 0, length = inputValues.Length; index < length; index++)
                {
                    inputValues[index] = ((IPdfNumber)inputs[index]).RawValue;
                }
                double[] outputValues = Calculate(inputValues);
                for (int index = 0, length = outputValues.Length; index < length; index++)
                {
                    outputs.Add(PdfReal.Get(outputValues[index]));
                }
            }
            return(outputs);
        }
示例#26
0
 public DrawRectangle(
     double x,
     double y,
     double width,
     double height
     ) : base(
         OperatorKeyword,
         new List <PdfDirectObject>(
             new PdfDirectObject[]
 {
     PdfReal.Get(x),
     PdfReal.Get(y),
     PdfReal.Get(width),
     PdfReal.Get(height)
 }
             )
         )
 {
 }
示例#27
0
 public CalloutLine(Page page, SKPoint start, SKPoint?knee, SKPoint end)
     : base(new PdfArray())
 {
     SKMatrix matrix         = page.InRotateMatrix;
     PdfArray baseDataObject = BaseDataObject;
     {
         start = matrix.MapPoint(start);
         baseDataObject.Add(PdfReal.Get(start.X));
         baseDataObject.Add(PdfReal.Get(start.Y));
         if (knee.HasValue)
         {
             knee = matrix.MapPoint(knee.Value);
             baseDataObject.Add(PdfReal.Get(knee.Value.X));
             baseDataObject.Add(PdfReal.Get(knee.Value.Y));
         }
         end = matrix.MapPoint(end);
         baseDataObject.Add(PdfReal.Get(end.X));
         baseDataObject.Add(PdfReal.Get(end.Y));
     }
 }
示例#28
0
 public Line(
     Page page,
     PointF startPoint,
     PointF endPoint,
     string text
     ) : base(
         page,
         PdfName.Line,
         new RectangleF(
             startPoint.X,
             startPoint.Y,
             endPoint.X - startPoint.X,
             endPoint.Y - startPoint.Y
             ),
         text
         )
 {
     BaseDataObject[PdfName.L] = new PdfArray(new PdfDirectObject[] { PdfReal.Get(0), PdfReal.Get(0), PdfReal.Get(0), PdfReal.Get(0) });
     StartPoint = startPoint;
     EndPoint   = endPoint;
 }
示例#29
0
 public CalloutLine(
     Page page,
     PointF start,
     PointF?knee,
     PointF end
     ) : base(new PdfArray())
 {
     this.page = page;
     PdfArray baseDataObject = BaseDataObject;
     {
         double pageHeight = page.Box.Height;
         baseDataObject.Add(PdfReal.Get(start.X));
         baseDataObject.Add(PdfReal.Get(pageHeight - start.Y));
         if (knee.HasValue)
         {
             baseDataObject.Add(PdfReal.Get(knee.Value.X));
             baseDataObject.Add(PdfReal.Get(pageHeight - knee.Value.Y));
         }
         baseDataObject.Add(PdfReal.Get(end.X));
         baseDataObject.Add(PdfReal.Get(pageHeight - end.Y));
     }
 }
示例#30
0
 /// <summary>
 /// Writes the specified value to the PDF stream.
 /// </summary>
 public void Write(PdfReal value)
 {
     WriteSeparator(CharCat.Character);
     WriteRaw(value.Value.ToString(Config.SignificantFigures7, CultureInfo.InvariantCulture));
     _lastCat = CharCat.Character;
 }
示例#31
0
   protected void SetComponentValue(
 int index,
 double value
 )
   {
       Components[index] = new PdfReal(NormalizeComponent(value));
   }
示例#32
0
文件: Visitor.cs 项目: n9/pdfclown
 public virtual PdfObject Visit(
     PdfReal obj,
     object data
     )
 {
     return obj;
 }
示例#33
0
 /// <summary>
 /// Writes the specified value to the PDF stream.
 /// </summary>
 public void Write(PdfReal value)
 {
   WriteSeparator(CharCat.Character);
   WriteRaw(value.Value.ToString("0.###", CultureInfo.InvariantCulture));
   this.lastCat = CharCat.Character;
 }
示例#34
0
 /// <summary>
 /// Writes the specified value to the PDF stream.
 /// </summary>
 public void Write(PdfReal value)
 {
     WriteSeparator(CharCat.Character);
     WriteRaw(value.Value.ToString(Config.SignificantFigures7, CultureInfo.InvariantCulture));
     _lastCat = CharCat.Character;
 }