1 17 18 19 20 package org.apache.fop.render.afp.modca; 21 22 import java.io.IOException ; 23 import java.io.OutputStream ; 24 import org.apache.fop.render.afp.tools.BinaryUtils; 25 26 31 public class ObjectAreaPosition extends AbstractAFPObject { 32 33 private int _x = 0; 34 private int _y = 0; 35 private int _rot = 0; 36 37 43 public ObjectAreaPosition(int x, int y, int rotation) { 44 45 _x = x; 46 _y = y; 47 _rot = rotation; 48 } 49 50 55 public void writeDataStream(OutputStream os) 56 throws IOException { 57 58 byte[] data = new byte[] { 59 0x5A, 60 0x00, 0x20, (byte) 0xD3, 63 (byte) 0xAC, 64 (byte) 0x6B, 65 0x00, 0x00, 0x00, 0x01, 0x17, 0x00, 0x00, 72 0x00, 73 0x00, 0x00, 75 0x00, 76 (byte)(_rot / 2), 0x00, 78 (byte)(_rot / 2 + 45), 0x00, 80 0x00, 0x00, 0x00, 83 0x00, 84 0x00, 0x00, 86 0x00, 87 0x00, 0x00, 89 0x2D, 0x00, 91 0x01, }; 93 94 byte[] l = BinaryUtils.convert(data.length - 1, 2); 95 data[1] = l[0]; 96 data[2] = l[1]; 97 98 byte[] x = BinaryUtils.convert(_x, 3); 99 data[11] = x[0]; 100 data[12] = x[1]; 101 data[13] = x[2]; 102 103 byte[] y = BinaryUtils.convert(_y, 3); 104 data[14] = y[0]; 105 data[15] = y[1]; 106 data[16] = y[2]; 107 108 os.write(data); 109 110 } 111 112 } | Popular Tags |