Multiply() public méthode

public Multiply ( Matrix by ) : Matrix
by Matrix
Résultat Matrix
Exemple #1
0
        virtual public void TestMultiply()
        {
            Matrix m1 = new Matrix(2, 3, 4, 5, 6, 7);
            Matrix m2 = new Matrix(8, 9, 10, 11, 12, 13);
            Matrix shouldBe = new Matrix(46, 51, 82, 91, 130, 144);

            Matrix rslt = m1.Multiply(m2);
            Assert.AreEqual(shouldBe, rslt);
        }
Exemple #2
0
 /**
  * Creates a new TextRenderInfo object
  * @param text the text that should be displayed
  * @param gs the graphics state (note: at this time, this is not immutable, so don't cache it)
  * @param textMatrix the text matrix at the time of the render operation
  * @param markedContentInfo the marked content sequence, if available
  */
 internal TextRenderInfo(String text, GraphicsState gs, Matrix textMatrix, ICollection markedContentInfo) {
     this.text = text;
     this.textToUserSpaceTransformMatrix = textMatrix.Multiply(gs.ctm);
     this.gs = gs;
     this.markedContentInfos = new List<MarkedContentInfo>();
     foreach (MarkedContentInfo m in markedContentInfo) {
         this.markedContentInfos.Add(m);
     }
 }
            public void HandleXObject(PdfContentStreamProcessor processor, PdfStream stream, PdfIndirectReference refi) {
                
                PdfDictionary resources = stream.GetAsDict(PdfName.RESOURCES);

                // we read the content bytes up here so if it fails we don't leave the graphics state stack corrupted
                // this is probably not necessary (if we fail on this, probably the entire content stream processing
                // operation should be rejected
                byte[] contentBytes;
                contentBytes = ContentByteUtils.GetContentBytesFromContentObject(stream);
                PdfArray matrix = stream.GetAsArray(PdfName.MATRIX);

                new PushGraphicsState().Invoke(processor, null, null);

                if (matrix != null){
                    float a = matrix.GetAsNumber(0).FloatValue;
                    float b = matrix.GetAsNumber(1).FloatValue;
                    float c = matrix.GetAsNumber(2).FloatValue;
                    float d = matrix.GetAsNumber(3).FloatValue;
                    float e = matrix.GetAsNumber(4).FloatValue;
                    float f = matrix.GetAsNumber(5).FloatValue;
                    Matrix formMatrix = new Matrix(a, b, c, d, e, f);

                    processor.Gs().ctm = formMatrix.Multiply(processor.Gs().ctm);
                }

                processor.ProcessContent(contentBytes, resources);

                new PopGraphicsState().Invoke(processor, null, null);
                
            }
 public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List<PdfObject> operands) {
     float a = ((PdfNumber)operands[0]).FloatValue;
     float b = ((PdfNumber)operands[1]).FloatValue;
     float c = ((PdfNumber)operands[2]).FloatValue;
     float d = ((PdfNumber)operands[3]).FloatValue;
     float e = ((PdfNumber)operands[4]).FloatValue;
     float f = ((PdfNumber)operands[5]).FloatValue;
     Matrix matrix = new Matrix(a, b, c, d, e, f);
     GraphicsState gs = processor.gsStack.Peek();
     gs.ctm = matrix.Multiply(gs.ctm);
 }
            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List<PdfObject> operands) {
                float tx = ((PdfNumber)operands[0]).FloatValue;
                float ty = ((PdfNumber)operands[1]).FloatValue;

                Matrix translationMatrix = new Matrix(tx, ty);
                processor.textMatrix =  translationMatrix.Multiply(processor.textLineMatrix);
                processor.textLineMatrix = processor.textMatrix;
            }
 /**
  * Creates a new TextRenderInfo object
  * @param string the PDF string that should be displayed
  * @param gs the graphics state (note: at this time, this is not immutable, so don't cache it)
  * @param textMatrix the text matrix at the time of the render operation
  * @param markedContentInfo the marked content sequence, if available
  */
 internal TextRenderInfo(PdfString @string, GraphicsState gs, Matrix textMatrix, ICollection markedContentInfo) {
     this.@string = @string;
     this.textToUserSpaceTransformMatrix = textMatrix.Multiply(gs.ctm);
     this.gs = gs;
     this.markedContentInfos = new List<MarkedContentInfo>();
     if (markedContentInfo.Count > 0) { // check for performance purposes, as markedContentInfo.GetEnumerator is a costly operation for some reason
         foreach (MarkedContentInfo m in markedContentInfo) {
             this.markedContentInfos.Add(m);
         }
     }
     this.fontMatrix = gs.font.GetFontMatrix();
 }