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 28 public class ImageDataDescriptor extends AbstractAFPObject { 29 30 private int _xresol = 0; 31 private int _yresol = 0; 32 private int _width = 0; 33 private int _height = 0; 34 35 43 public ImageDataDescriptor(int xresol, int yresol, int width, int height) { 44 45 _xresol = xresol; 46 _yresol = yresol; 47 _width = width; 48 _height = height; 49 50 } 51 52 57 public void writeDataStream(OutputStream os) 58 throws IOException { 59 60 byte[] data = new byte[] { 61 0x5A, 62 0x00, 63 0x20, 64 (byte) 0xD3, 65 (byte) 0xA6, 66 (byte) 0xFB, 67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)0xF7, 0x02, 0x01, 0x0B, }; 84 85 byte[] l = BinaryUtils.convert(data.length - 1, 2); 86 data[1] = l[0]; 87 data[2] = l[1]; 88 89 byte[] x = BinaryUtils.convert(_xresol, 2); 90 data[10] = x[0]; 91 data[11] = x[1]; 92 93 byte[] y = BinaryUtils.convert(_yresol, 2); 94 data[12] = y[0]; 95 data[13] = y[1]; 96 97 byte[] w = BinaryUtils.convert(_width, 2); 98 data[14] = w[0]; 99 data[15] = w[1]; 100 101 byte[] h = BinaryUtils.convert(_height, 2); 102 data[16] = h[0]; 103 data[17] = h[1]; 104 105 os.write(data); 106 107 } 108 109 } 110 | Popular Tags |