1 3 package org.faceless.pdf; 4 5 import java.awt.*; 6 7 26 public class ColorPattern extends PeeredObject implements Paint, Cloneable 27 { 28 final org.faceless.pdf2.PDFPattern pattern; 29 30 Object getPeer() 31 { 32 return pattern; 33 } 34 35 ColorPattern(org.faceless.pdf2.PDFPattern pattern) 36 { 37 this.pattern=pattern; 38 } 39 40 48 public static ColorPattern stripe(Color background, Color foreground, float on, float off, float angle) 49 { 50 return new ColorPattern(new org.faceless.pdf2.PDFPattern("Stripe"+((int)angle), 0, 0, on, off, foreground, background)); 51 } 52 53 61 public static ColorPattern brick(Color background, Color foreground, float width, float height) 62 { 63 return new ColorPattern(new org.faceless.pdf2.PDFPattern("Brick", 0, 0, width, height*2, foreground, background)); 64 } 65 66 72 public static ColorPattern check(Color background, Color foreground, float size) 73 { 74 return new ColorPattern(new org.faceless.pdf2.PDFPattern("Check", 0, 0, size*2, size*2, foreground, background)); 75 } 76 77 84 public static ColorPattern grid(Color background, Color foreground, float on, float off) 85 { 86 return new ColorPattern(new org.faceless.pdf2.PDFPattern("Grid", 0, 0, on+off, on+off, background, foreground)); 87 } 88 89 96 public static ColorPattern spot(Color background, Color foreground, float size) 97 { 98 return new ColorPattern(new org.faceless.pdf2.PDFPattern("Spot", 0, 0, size*2, size*2, foreground, background)); 99 } 100 101 108 public static ColorPattern polka(Color background, Color foreground, float size) 109 { 110 return new ColorPattern(new org.faceless.pdf2.PDFPattern("Polka", 0, 0, size*2, size*2, foreground, background)); 111 } 112 113 120 public static ColorPattern star(Color background, Color foreground, float size) 121 { 122 return new ColorPattern(new org.faceless.pdf2.PDFPattern("Star", 0, 0, size*2, size*2, foreground, background)); 123 } 124 125 137 public ColorPattern adjustBrightness(float delta, float min, float max) 138 { 139 return (ColorPattern)PeeredObject.getPeer(pattern.brightnessClone(delta,min,max)); 140 } 141 142 public Object clone() 143 { 144 throw new Error ("Not implemented"); 146 } 147 148 public int getTransparency() 149 { 150 return pattern.getTransparency(); 151 } 152 153 157 public PaintContext createContext(java.awt.image.ColorModel cm, Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, RenderingHints hints) 158 { 159 throw new UnsupportedOperationException ("createContext not appropriate for ColorPattern"); 160 } 161 162 163 166 public Color getBackgroundColor() 167 { 168 return null; 169 } 170 171 174 public Color getForegroundColor() 175 { 176 return null; 177 } 178 } 179 | Popular Tags |