Package quicktime.qd.text

Source Code of quicktime.qd.text.ScrpSTElement

/*     */ package quicktime.qd.text;
/*     */
/*     */ import java.io.IOException;
/*     */ import java.io.ObjectInputStream;
/*     */ import java.io.ObjectOutputStream;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.qd.QDColor;
/*     */ import quicktime.util.EndianDescriptor;
/*     */ import quicktime.util.EndianFlipSpec;
/*     */ import quicktime.util.EndianOrder;
/*     */ import quicktime.util.QTByteObject;
/*     */ import quicktime.util.QTUtils;
/*     */
/*     */ public final class ScrpSTElement extends QTByteObject
/*     */ {
/*  24 */   private static boolean apriori = QTSession.apriori();
/*     */   public static final int kNativeSize = 20;
/*     */   private static EndianDescriptor ed;
/*     */   private static final long serialVersionUID = 939259602280929910L;
/*     */
/*     */   protected static EndianDescriptor makeED()
/*     */   {
/*  49 */     EndianDescriptor localEndianDescriptor = new EndianDescriptor(0);
/*     */
/*  51 */     EndianFlipSpec localEndianFlipSpec1 = new EndianFlipSpec(0, 4, 1);
/*  52 */     localEndianDescriptor.addFlipSpec(localEndianFlipSpec1);
/*     */
/*  54 */     EndianFlipSpec localEndianFlipSpec2 = new EndianFlipSpec(4, 2, 3);
/*  55 */     localEndianDescriptor.addFlipSpec(localEndianFlipSpec2);
/*     */
/*  58 */     EndianFlipSpec localEndianFlipSpec3 = new EndianFlipSpec(12, 2, 1);
/*  59 */     localEndianDescriptor.addFlipSpec(localEndianFlipSpec3);
/*     */
/*  61 */     EndianFlipSpec localEndianFlipSpec4 = new EndianFlipSpec(14, 2, 3);
/*  62 */     localEndianDescriptor.addFlipSpec(localEndianFlipSpec4);
/*     */
/*  64 */     return localEndianDescriptor;
/*     */   }
/*     */
/*     */   public static EndianDescriptor getEndianDescriptor()
/*     */   {
/*  72 */     if (ed == null)
/*  73 */       ed = makeED();
/*  74 */     return ed;
/*     */   }
/*     */
/*     */   public ScrpSTElement()
/*     */   {
/*  80 */     super(20);
/*     */   }
/*     */
/*     */   private ScrpSTElement(byte[] paramArrayOfByte) {
/*  84 */     super(paramArrayOfByte);
/*     */   }
/*     */
/*     */   private void readObject(ObjectInputStream paramObjectInputStream)
/*     */     throws IOException
/*     */   {
/*  91 */     this.bytes = new byte[20];
/*     */
/*  94 */     byte[] arrayOfByte = new byte[20];
/*  95 */     paramObjectInputStream.read(arrayOfByte);
/*     */
/*  97 */     setIntInArray(this.bytes, 0, EndianOrder.flipBigEndianToNative32(getIntFromArray(arrayOfByte, 0)));
/*  98 */     setShortInArray(this.bytes, 4, EndianOrder.flipBigEndianToNative16(getShortFromArray(arrayOfByte, 4)));
/*  99 */     setShortInArray(this.bytes, 6, EndianOrder.flipBigEndianToNative16(getShortFromArray(arrayOfByte, 6)));
/* 100 */     setShortInArray(this.bytes, 8, EndianOrder.flipBigEndianToNative16(getShortFromArray(arrayOfByte, 8)));
/* 101 */     setShortInArray(this.bytes, 12, EndianOrder.flipBigEndianToNative16(getShortFromArray(arrayOfByte, 12)));
/* 102 */     setShortInArray(this.bytes, 14, EndianOrder.flipBigEndianToNative16(getShortFromArray(arrayOfByte, 14)));
/* 103 */     setShortInArray(this.bytes, 16, EndianOrder.flipBigEndianToNative16(getShortFromArray(arrayOfByte, 16)));
/* 104 */     setShortInArray(this.bytes, 18, EndianOrder.flipBigEndianToNative16(getShortFromArray(arrayOfByte, 18)));
/*     */   }
/*     */
/*     */   private void writeObject(ObjectOutputStream paramObjectOutputStream) throws IOException
/*     */   {
/* 109 */     byte[] arrayOfByte = new byte[20];
/*     */
/* 111 */     setIntInArray(arrayOfByte, 0, EndianOrder.flipNativeToBigEndian32(getIntFromArray(this.bytes, 0)));
/* 112 */     setShortInArray(arrayOfByte, 4, EndianOrder.flipNativeToBigEndian16(getShortFromArray(this.bytes, 4)));
/* 113 */     setShortInArray(arrayOfByte, 6, EndianOrder.flipNativeToBigEndian16(getShortFromArray(this.bytes, 6)));
/* 114 */     setShortInArray(arrayOfByte, 8, EndianOrder.flipNativeToBigEndian16(getShortFromArray(this.bytes, 8)));
/* 115 */     setShortInArray(arrayOfByte, 12, EndianOrder.flipNativeToBigEndian16(getShortFromArray(this.bytes, 12)));
/* 116 */     setShortInArray(arrayOfByte, 14, EndianOrder.flipNativeToBigEndian16(getShortFromArray(this.bytes, 14)));
/* 117 */     setShortInArray(arrayOfByte, 16, EndianOrder.flipNativeToBigEndian16(getShortFromArray(this.bytes, 16)));
/* 118 */     setShortInArray(arrayOfByte, 18, EndianOrder.flipNativeToBigEndian16(getShortFromArray(this.bytes, 18)));
/*     */
/* 121 */     paramObjectOutputStream.write(arrayOfByte);
/*     */   }
/*     */
/*     */   public Object clone() {
/* 125 */     return new ScrpSTElement(getBytes());
/*     */   }
/*     */
/*     */   public void setColor(QDColor paramQDColor)
/*     */   {
/* 132 */     if (paramQDColor == null) {
/* 133 */       setShortAt(14, (short)-1);
/* 134 */       setShortAt(16, (short)-1);
/* 135 */       setShortAt(18, (short)-1);
/*     */     } else {
/* 137 */       System.arraycopy(paramQDColor.getRGBColor(), 0, this.bytes, 14, 6);
/*     */     }
/*     */   }
/*     */
/*     */   public QDColor getColor()
/*     */   {
/* 146 */     byte[] arrayOfByte = new byte[6];
/* 147 */     System.arraycopy(this.bytes, 14, arrayOfByte, 0, 6);
/* 148 */     return QDColor.fromArray(arrayOfByte, 6);
/*     */   }
/*     */
/*     */   public void setScriptSize(int paramInt)
/*     */   {
/* 156 */     setShortAt(12, (short)paramInt);
/*     */   }
/*     */
/*     */   public int getScriptSize()
/*     */   {
/* 164 */     return getShortAt(12);
/*     */   }
/*     */
/*     */   public void setFace(int paramInt)
/*     */   {
/* 172 */     setByteAt(10, (byte)paramInt);
/* 173 */     setByteAt(11, (byte)0);
/*     */   }
/*     */
/*     */   public int getFace()
/*     */   {
/* 181 */     return QTUtils.UByte2Int(getByteAt(10));
/*     */   }
/*     */
/*     */   public void setFont(int paramInt)
/*     */   {
/* 189 */     setShortAt(8, (short)paramInt);
/*     */   }
/*     */
/*     */   public int getFont()
/*     */   {
/* 197 */     return getShortAt(8);
/*     */   }
/*     */
/*     */   public void setAscent(int paramInt)
/*     */   {
/* 205 */     setShortAt(6, (short)paramInt);
/*     */   }
/*     */
/*     */   public int getAscent()
/*     */   {
/* 213 */     return getShortAt(6);
/*     */   }
/*     */
/*     */   public void setHeight(int paramInt)
/*     */   {
/* 221 */     setShortAt(4, (short)paramInt);
/*     */   }
/*     */
/*     */   public int getHeight()
/*     */   {
/* 229 */     return getShortAt(4);
/*     */   }
/*     */
/*     */   public void setStartChar(int paramInt)
/*     */   {
/* 237 */     setIntAt(0, paramInt);
/*     */   }
/*     */
/*     */   public int getStartChar()
/*     */   {
/* 245 */     return getIntAt(0);
/*     */   }
/*     */
/*     */   public String toString()
/*     */   {
/* 250 */     return getClass().getName() + "[" + ",startChar=" + getStartChar() + ",getHeight=" + getHeight() + ",getAscent=" + getAscent() + ",getFont=" + getFont() + ",getFace=" + getFace() + ",getSize=" + getSize() + ",getColor=" + getColor() + "]";
/*     */   }
/*     */
/*     */   private static native int getIntFromArray(byte[] paramArrayOfByte, int paramInt);
/*     */
/*     */   private static native void setIntInArray(byte[] paramArrayOfByte, int paramInt1, int paramInt2);
/*     */
/*     */   private static native short getShortFromArray(byte[] paramArrayOfByte, int paramInt);
/*     */
/*     */   private static native void setShortInArray(byte[] paramArrayOfByte, int paramInt, short paramShort);
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name:     quicktime.qd.text.ScrpSTElement
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.qd.text.ScrpSTElement

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.