1 47 48 package com.lowagie.text.pdf; 49 50 public class PdfTransition { 51 54 public static final int SPLITVOUT = 1; 55 58 public static final int SPLITHOUT = 2; 59 62 public static final int SPLITVIN = 3; 63 66 public static final int SPLITHIN = 4; 67 70 public static final int BLINDV = 5; 71 74 public static final int BLINDH = 6; 75 78 public static final int INBOX = 7; 79 82 public static final int OUTBOX = 8; 83 86 public static final int LRWIPE = 9; 87 90 public static final int RLWIPE = 10; 91 94 public static final int BTWIPE = 11; 95 98 public static final int TBWIPE = 12; 99 102 public static final int DISSOLVE = 13; 103 106 public static final int LRGLITTER = 14; 107 110 public static final int TBGLITTER = 15; 111 114 public static final int DGLITTER = 16; 115 116 119 protected int duration; 120 123 protected int type; 124 125 129 public PdfTransition() { 130 this(BLINDH); 131 } 132 133 138 public PdfTransition(int type) { 139 this(type,1); 140 } 141 142 148 public PdfTransition(int type, int duration) { 149 this.duration = duration; 150 this.type = type; 151 } 152 153 154 public int getDuration() { 155 return duration; 156 } 157 158 159 public int getType() { 160 return type; 161 } 162 163 public PdfDictionary getTransitionDictionary() { 164 PdfDictionary trans = new PdfDictionary(PdfName.TRANS); 165 switch (type) { 166 case SPLITVOUT: 167 trans.put(PdfName.S,PdfName.SPLIT); 168 trans.put(PdfName.D,new PdfNumber(duration)); 169 trans.put(PdfName.DM,PdfName.V); 170 trans.put(PdfName.M,PdfName.O); 171 break; 172 case SPLITHOUT: 173 trans.put(PdfName.S,PdfName.SPLIT); 174 trans.put(PdfName.D,new PdfNumber(duration)); 175 trans.put(PdfName.DM,PdfName.H); 176 trans.put(PdfName.M,PdfName.O); 177 break; 178 case SPLITVIN: 179 trans.put(PdfName.S,PdfName.SPLIT); 180 trans.put(PdfName.D,new PdfNumber(duration)); 181 trans.put(PdfName.DM,PdfName.V); 182 trans.put(PdfName.M,PdfName.I); 183 break; 184 case SPLITHIN: 185 trans.put(PdfName.S,PdfName.SPLIT); 186 trans.put(PdfName.D,new PdfNumber(duration)); 187 trans.put(PdfName.DM,PdfName.H); 188 trans.put(PdfName.M,PdfName.I); 189 break; 190 case BLINDV: 191 trans.put(PdfName.S,PdfName.BLINDS); 192 trans.put(PdfName.D,new PdfNumber(duration)); 193 trans.put(PdfName.DM,PdfName.V); 194 break; 195 case BLINDH: 196 trans.put(PdfName.S,PdfName.BLINDS); 197 trans.put(PdfName.D,new PdfNumber(duration)); 198 trans.put(PdfName.DM,PdfName.H); 199 break; 200 case INBOX: 201 trans.put(PdfName.S,PdfName.BOX); 202 trans.put(PdfName.D,new PdfNumber(duration)); 203 trans.put(PdfName.M,PdfName.I); 204 break; 205 case OUTBOX: 206 trans.put(PdfName.S,PdfName.BOX); 207 trans.put(PdfName.D,new PdfNumber(duration)); 208 trans.put(PdfName.M,PdfName.O); 209 break; 210 case LRWIPE: 211 trans.put(PdfName.S,PdfName.WIPE); 212 trans.put(PdfName.D,new PdfNumber(duration)); 213 trans.put(PdfName.DI,new PdfNumber(0)); 214 break; 215 case RLWIPE: 216 trans.put(PdfName.S,PdfName.WIPE); 217 trans.put(PdfName.D,new PdfNumber(duration)); 218 trans.put(PdfName.DI,new PdfNumber(180)); 219 break; 220 case BTWIPE: 221 trans.put(PdfName.S,PdfName.WIPE); 222 trans.put(PdfName.D,new PdfNumber(duration)); 223 trans.put(PdfName.DI,new PdfNumber(90)); 224 break; 225 case TBWIPE: 226 trans.put(PdfName.S,PdfName.WIPE); 227 trans.put(PdfName.D,new PdfNumber(duration)); 228 trans.put(PdfName.DI,new PdfNumber(270)); 229 break; 230 case DISSOLVE: 231 trans.put(PdfName.S,PdfName.DISSOLVE); 232 trans.put(PdfName.D,new PdfNumber(duration)); 233 break; 234 case LRGLITTER: 235 trans.put(PdfName.S,PdfName.GLITTER); 236 trans.put(PdfName.D,new PdfNumber(duration)); 237 trans.put(PdfName.DI,new PdfNumber(0)); 238 break; 239 case TBGLITTER: 240 trans.put(PdfName.S,PdfName.GLITTER); 241 trans.put(PdfName.D,new PdfNumber(duration)); 242 trans.put(PdfName.DI,new PdfNumber(270)); 243 break; 244 case DGLITTER: 245 trans.put(PdfName.S,PdfName.GLITTER); 246 trans.put(PdfName.D,new PdfNumber(duration)); 247 trans.put(PdfName.DI,new PdfNumber(315)); 248 break; 249 } 250 return trans; 251 } 252 } 253 254 | Popular Tags |