All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pdfjet.Path Maven / Gradle / Ivy

/*     */ package com.pdfjet;
/*     */ 
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Path
/*     */   implements Drawable
/*     */ {
/*  43 */   private int color = 0;
/*  44 */   private float width = 0.3F;
/*  45 */   private String pattern = "[] 0";
/*  46 */   private boolean fill_shape = false;
/*  47 */   private boolean close_path = false;
/*     */ 
/*  49 */   private List points = null;
/*     */   private float box_x;
/*     */   private float box_y;
/*  54 */   private int lineCapStyle = 0;
/*  55 */   private int lineJoinStyle = 0;
/*     */ 
/*     */   public Path()
/*     */   {
/*  64 */     this.points = new ArrayList();
/*     */   }
/*     */ 
/*     */   public void add(Point paramPoint)
/*     */   {
/*  74 */     this.points.add(paramPoint);
/*     */   }
/*     */ 
/*     */   public void setPattern(String paramString)
/*     */   {
/* 104 */     this.pattern = paramString;
/*     */   }
/*     */ 
/*     */   public void setWidth(double paramDouble)
/*     */   {
/* 114 */     this.width = ((float)paramDouble);
/*     */   }
/*     */ 
/*     */   public void setWidth(float paramFloat)
/*     */   {
/* 124 */     this.width = paramFloat;
/*     */   }
/*     */ 
/*     */   public void setColor(int paramInt)
/*     */   {
/* 134 */     this.color = paramInt;
/*     */   }
/*     */ 
/*     */   public void setClosePath(boolean paramBoolean)
/*     */   {
/* 144 */     this.close_path = paramBoolean;
/*     */   }
/*     */ 
/*     */   public void setFillShape(boolean paramBoolean)
/*     */   {
/* 154 */     this.fill_shape = paramBoolean;
/*     */   }
/*     */ 
/*     */   public void setLineCapStyle(int paramInt)
/*     */   {
/* 164 */     this.lineCapStyle = paramInt;
/*     */   }
/*     */ 
/*     */   public int getLineCapStyle()
/*     */   {
/* 174 */     return this.lineCapStyle;
/*     */   }
/*     */ 
/*     */   public void setLineJoinStyle(int paramInt)
/*     */   {
/* 184 */     this.lineJoinStyle = paramInt;
/*     */   }
/*     */ 
/*     */   public int getLineJoinStyle()
/*     */   {
/* 194 */     return this.lineJoinStyle;
/*     */   }
/*     */ 
/*     */   public void placeIn(Box paramBox)
/*     */     throws Exception
/*     */   {
/* 204 */     placeIn(paramBox, 0.0F, 0.0F);
/*     */   }
/*     */ 
/*     */   public void placeIn(Box paramBox, double paramDouble1, double paramDouble2)
/*     */     throws Exception
/*     */   {
/* 219 */     placeIn(paramBox, (float)paramDouble1, (float)paramDouble2);
/*     */   }
/*     */ 
/*     */   public void placeIn(Box paramBox, float paramFloat1, float paramFloat2)
/*     */     throws Exception
/*     */   {
/* 234 */     this.box_x = (paramBox.x + paramFloat1);
/* 235 */     this.box_y = (paramBox.y + paramFloat2);
/*     */   }
/*     */ 
/*     */   public void scaleBy(double paramDouble)
/*     */     throws Exception
/*     */   {
/* 245 */     scaleBy((float)paramDouble);
/*     */   }
/*     */ 
/*     */   public void scaleBy(float paramFloat)
/*     */     throws Exception
/*     */   {
/* 255 */     for (int i = 0; i < this.points.size(); i++) {
/* 256 */       Point localPoint = (Point)this.points.get(i);
/* 257 */       localPoint.x *= paramFloat;
/* 258 */       localPoint.y *= paramFloat;
/*     */     }
/*     */   }
/*     */ 
/*     */   public static List getCurvePoints(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, int paramInt)
/*     */     throws Exception
/*     */   {
/* 282 */     float f = 0.551784F;
/* 283 */     ArrayList localArrayList = new ArrayList();
/*     */ 
/* 285 */     if (paramInt == 0) {
/* 286 */       localArrayList.add(new Point(paramFloat1, paramFloat2 - paramFloat4));
/* 287 */       localArrayList.add(new Point(paramFloat1 + f * paramFloat3, paramFloat2 - paramFloat4, true));
/* 288 */       localArrayList.add(new Point(paramFloat1 + paramFloat3, paramFloat2 - f * paramFloat4, true));
/* 289 */       localArrayList.add(new Point(paramFloat1 + paramFloat3, paramFloat2));
/*     */     }
/* 291 */     else if (paramInt == 1) {
/* 292 */       localArrayList.add(new Point(paramFloat1 + paramFloat3, paramFloat2));
/* 293 */       localArrayList.add(new Point(paramFloat1 + paramFloat3, paramFloat2 + f * paramFloat4, true));
/* 294 */       localArrayList.add(new Point(paramFloat1 + f * paramFloat3, paramFloat2 + paramFloat4, true));
/* 295 */       localArrayList.add(new Point(paramFloat1, paramFloat2 + paramFloat4));
/*     */     }
/* 297 */     else if (paramInt == 2) {
/* 298 */       localArrayList.add(new Point(paramFloat1, paramFloat2 + paramFloat4));
/* 299 */       localArrayList.add(new Point(paramFloat1 - f * paramFloat3, paramFloat2 + paramFloat4, true));
/* 300 */       localArrayList.add(new Point(paramFloat1 - paramFloat3, paramFloat2 + f * paramFloat4, true));
/* 301 */       localArrayList.add(new Point(paramFloat1 - paramFloat3, paramFloat2));
/*     */     }
/* 303 */     else if (paramInt == 3) {
/* 304 */       localArrayList.add(new Point(paramFloat1 - paramFloat3, paramFloat2));
/* 305 */       localArrayList.add(new Point(paramFloat1 - paramFloat3, paramFloat2 - f * paramFloat4, true));
/* 306 */       localArrayList.add(new Point(paramFloat1 - f * paramFloat3, paramFloat2 - paramFloat4, true));
/* 307 */       localArrayList.add(new Point(paramFloat1, paramFloat2 - paramFloat4));
/*     */     }
/*     */ 
/* 310 */     return localArrayList;
/*     */   }
/*     */ 
/*     */   public float[] drawOn(Page paramPage)
/*     */     throws Exception
/*     */   {
/* 322 */     if (this.fill_shape) {
/* 323 */       paramPage.setBrushColor(this.color);
/*     */     }
/*     */     else {
/* 326 */       paramPage.setPenColor(this.color);
/*     */     }
/* 328 */     paramPage.setPenWidth(this.width);
/* 329 */     paramPage.setLinePattern(this.pattern);
/* 330 */     paramPage.setLineCapStyle(this.lineCapStyle);
/* 331 */     paramPage.setLineJoinStyle(this.lineJoinStyle);
/*     */ 
/* 333 */     for (int i = 0; i < this.points.size(); i++) {
/* 334 */       Point localPoint1 = (Point)this.points.get(i);
/* 335 */       localPoint1.x += this.box_x;
/* 336 */       localPoint1.y += this.box_y;
/*     */     }
/*     */ 
/* 339 */     if (this.fill_shape) {
/* 340 */       paramPage.drawPath(this.points, 'f');
/*     */     }
/* 343 */     else if (this.close_path) {
/* 344 */       paramPage.drawPath(this.points, 's');
/*     */     }
/*     */     else {
/* 347 */       paramPage.drawPath(this.points, 'S');
/*     */     }
/*     */ 
/* 351 */     float f1 = 0.0F;
/* 352 */     float f2 = 0.0F;
/* 353 */     for (int j = 0; j < this.points.size(); j++) {
/* 354 */       Point localPoint2 = (Point)this.points.get(j);
/* 355 */       if (localPoint2.x > f1) f1 = localPoint2.x;
/* 356 */       if (localPoint2.y > f2) f2 = localPoint2.y;
/* 357 */       localPoint2.x -= this.box_x;
/* 358 */       localPoint2.y -= this.box_y;
/*     */     }
/*     */ 
/* 361 */     return new float[] { f1, f2 };
/*     */   }
/*     */ }

/* Location:           E:\EGGWIFI\Customer\trunk\src\Workspace\Customer\Customer Maven Webapp\src\main\webapp\WEB-INF\lib\PDFjet.jar
 * Qualified Name:     com.pdfjet.Path
 * JD-Core Version:    0.6.2
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy