1 18 package org.apache.batik.gvt.text; 19 20 import java.awt.Composite ; 21 import java.awt.Paint ; 22 import java.awt.Shape ; 23 import java.awt.Stroke ; 24 25 33 public class TextPaintInfo { 34 public boolean visible; 35 public Paint fillPaint; 36 public Paint strokePaint; 37 public Stroke strokeStroke; 38 public Composite composite; 39 40 public Paint underlinePaint; 41 public Paint underlineStrokePaint; 42 public Stroke underlineStroke; 43 44 public Paint overlinePaint; 45 public Paint overlineStrokePaint; 46 public Stroke overlineStroke; 47 48 public Paint strikethroughPaint; 49 public Paint strikethroughStrokePaint; 50 public Stroke strikethroughStroke; 51 52 public TextPaintInfo() { } 53 54 public TextPaintInfo(TextPaintInfo pi) { 55 set(pi); 56 } 57 58 public void set(TextPaintInfo pi) { 59 if (pi == null) { 60 this.fillPaint = null; 61 this.strokePaint = null; 62 this.strokeStroke = null; 63 this.composite = null; 64 65 this.underlinePaint = null; 66 this.underlineStrokePaint = null; 67 this.underlineStroke = null; 68 69 this.overlinePaint = null; 70 this.overlineStrokePaint = null; 71 this.overlineStroke = null; 72 73 this.strikethroughPaint = null; 74 this.strikethroughStrokePaint = null; 75 this.strikethroughStroke = null; 76 77 this.visible = false; 78 } else { 79 this.fillPaint = pi.fillPaint; 80 this.strokePaint = pi.strokePaint; 81 this.strokeStroke = pi.strokeStroke; 82 this.composite = pi.composite; 83 84 this.underlinePaint = pi.underlinePaint; 85 this.underlineStrokePaint = pi.underlineStrokePaint; 86 this.underlineStroke = pi.underlineStroke; 87 88 this.overlinePaint = pi.overlinePaint; 89 this.overlineStrokePaint = pi.overlineStrokePaint; 90 this.overlineStroke = pi.overlineStroke; 91 92 this.strikethroughPaint = pi.strikethroughPaint; 93 this.strikethroughStrokePaint = pi.strikethroughStrokePaint; 94 this.strikethroughStroke = pi.strikethroughStroke; 95 96 this.visible = pi.visible; 97 } 98 } 99 100 public static boolean equivilent(TextPaintInfo tpi1, TextPaintInfo tpi2) { 101 if (tpi1 == null) { 102 if (tpi2 == null) return true; 103 return false; 104 } else if (tpi2 == null) return false; 105 106 if ((tpi1.fillPaint == null) != (tpi2.fillPaint == null)) 107 return false; 108 109 if (tpi1.visible != tpi2.visible) return false; 110 111 boolean tpi1Stroke = ((tpi1.strokePaint != null) && 112 (tpi1.strokeStroke != null)); 113 114 boolean tpi2Stroke = ((tpi2.strokePaint != null) && 115 (tpi2.strokeStroke != null)); 116 117 return (tpi1Stroke == tpi2Stroke); 118 119 } 120 } 121 | Popular Tags |