1 2 23 24 package javax.microedition.lcdui; 25 26 public class Graphics 27 { 28 public static final int SOLID = 0; 29 public static final int DOTTED = 1; 30 31 public static final int LEFT = 4; 32 public static final int RIGHT = 8; 33 public static final int TOP = 16; 34 public static final int BASELINE = 64; 35 public static final int BOTTOM = 32; 36 public static final int HCENTER = 1; 37 public static final int VCENTER = 2; 38 39 int strokeStyle = SOLID; 40 41 int translateX = 0; 42 int translateY = 0; 43 44 45 public void clipRect(int x, int y, int width, int height) 46 { 47 } 49 50 51 public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) 52 { 53 } 55 56 57 public void drawChar(char character, int x, int y, int anchor) 58 { 59 char[] carr = new char[1]; 60 carr[0] = character; 61 62 drawString(new String(carr), x, y, anchor); 63 } 64 65 66 public void drawChars(char[] data, int offset, int length, int x, int y, int anchor) 67 { 68 drawString(new String(data, offset, length), x, y, anchor); 69 } 70 71 72 public void drawImage(Image img, int x, int y, int anchor) 73 { 74 } 76 77 78 public void drawLine(int x1, int y1, int x2, int y2) 79 { 80 } 82 83 84 public void drawRect(int x, int y, int width, int height) 85 { 86 } 88 89 90 public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { 91 } 93 94 95 public void drawString(String str, int x, int y, int anchor) 96 { 97 } 99 100 101 public void drawSubstring(String str, int offset, int len, int x, int y, int anchor) 102 { 103 drawString(str.substring(offset, offset + len), x, y, anchor); 104 } 105 106 107 public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) 108 { 109 } 111 112 113 public void fillRect(int x, int y, int width, int height) 114 { 115 } 117 118 119 public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) 120 { 121 } 123 124 125 public int getBlueComponent() 126 { 127 return getColor() & 255; 128 } 129 130 131 public int getClipHeight() 132 { 133 throw new IllegalStateException(); 135 } 136 137 138 public int getClipWidth() 139 { 140 throw new IllegalStateException(); 142 } 143 144 145 public int getClipX() 146 { 147 throw new IllegalStateException(); 149 } 150 151 152 public int getClipY() 153 { 154 throw new IllegalStateException(); 156 } 157 158 159 public int getColor() 160 { 161 throw new IllegalStateException(); 163 } 164 165 166 public Font getFont() 167 { 168 throw new IllegalStateException(); 170 } 171 172 173 public int getGrayScale() 174 { 175 return (getRedComponent() + getGreenComponent() + getBlueComponent()) / 3; 176 } 177 178 179 public int getGreenComponent() 180 { 181 return (getColor() >> 8) & 255; 182 } 183 184 185 public int getRedComponent() 186 { 187 return (getColor() >> 16) & 255; 188 } 189 190 191 public int getStrokeStyle() 192 { 193 return strokeStyle; 194 } 195 196 197 public int getTranslateX() 198 { 199 return translateX; 200 } 201 202 203 public int getTranslateY() 204 { 205 return translateY; 206 } 207 208 209 public void setClip(int x, int y, int width, int height) 210 { 211 } 213 214 215 public void setColor(int RGB) 216 { 217 } 219 220 221 public void setColor(int red, int green, int blue) 222 { 223 int rgb = blue; rgb += green << 8; 225 rgb += red << 16; 226 setColor(rgb); 227 } 228 229 230 public void setFont(Font font) 231 { 232 } 234 235 236 public void setGrayScale(int grey) 237 { 238 setColor(grey, grey, grey); 239 } 240 241 242 public void setStrokeStyle(int style) 243 { 244 if (style != SOLID && style != DOTTED) { 245 throw new IllegalArgumentException(); 246 } 247 strokeStyle = style; 248 } 249 250 251 public void translate(int x, int y) 252 { 253 translateX += x; 254 translateY += y; 255 } 256 257 } 258 | Popular Tags |