01: /*
02: Copyright © 2007 Stefano Chizzolini. http://clown.stefanochizzolini.it
03:
04: Contributors:
05: * Stefano Chizzolini (original code developer, http://www.stefanochizzolini.it):
06: contributed code is Copyright © 2007 by Stefano Chizzolini.
07:
08: This file should be part of the source code distribution of "PDF Clown library"
09: (the Program): see the accompanying README files for more info.
10:
11: This Program is free software; you can redistribute it and/or modify it under
12: the terms of the GNU General Public License as published by the Free Software
13: Foundation; either version 2 of the License, or (at your option) any later version.
14:
15: This Program is distributed in the hope that it will be useful, but WITHOUT ANY
16: WARRANTY, either expressed or implied; without even the implied warranty of
17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
18:
19: You should have received a copy of the GNU General Public License along with this
20: Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
21:
22: Redistribution and use, with or without modification, are permitted provided that such
23: redistributions retain the above copyright notice, license and disclaimer, along with
24: this list of conditions.
25: */
26:
27: package it.stefanochizzolini.clown.documents.contents.objects;
28:
29: import it.stefanochizzolini.clown.objects.IPdfNumber;
30: import it.stefanochizzolini.clown.objects.PdfDirectObject;
31: import it.stefanochizzolini.clown.objects.PdfReal;
32:
33: import java.util.Arrays;
34: import java.util.List;
35:
36: /**
37: 'Set the text matrix' operation [PDF:1.6:5.3.1].
38: <h3>Remarks</h3>
39: <p>The specified matrix is not concatenated onto the current text matrix, but replaces it.</p>
40:
41: @author Stefano Chizzolini
42: @version 0.0.4, 06/17/07
43: @since 0.0.4
44: */
45: public final class SetTextMatrix extends Operation {
46: // <class>
47: // <static>
48: // <fields>
49: public static final String Operator = "Tm";
50:
51: // </fields>
52: // </static>
53:
54: // <dynamic>
55: // <constructors>
56: public SetTextMatrix(double a, double b, double c, double d,
57: double e, double f) {
58: super (
59: Operator,
60: (List<PdfDirectObject>) (List<? extends PdfDirectObject>) Arrays
61: .asList(new PdfReal(a), new PdfReal(b),
62: new PdfReal(c), new PdfReal(d),
63: new PdfReal(e), new PdfReal(f)));
64: }
65:
66: public SetTextMatrix(List<PdfDirectObject> operands) {
67: super (Operator, operands);
68: }
69:
70: // </constructors>
71:
72: // <interface>
73: // <public>
74: public double[] getMatrix() {
75: return new double[] {
76: ((IPdfNumber) operands.get(0)).getNumberValue(), // a.
77: ((IPdfNumber) operands.get(1)).getNumberValue(), // b.
78: ((IPdfNumber) operands.get(2)).getNumberValue(), // c.
79: ((IPdfNumber) operands.get(3)).getNumberValue(), // d.
80: ((IPdfNumber) operands.get(4)).getNumberValue(), // e.
81: ((IPdfNumber) operands.get(5)).getNumberValue() // f.
82: };
83: }
84: // </public>
85: // </interface>
86: // </dynamic>
87: // </class>
88: }
|