Ejemplo n.º 1
0
 public static LGradation getInstance(Color s, Color e, int w, int h, int alpha) {
   if (lazyGradation == null) {
     lazyGradation = new HashMap<String, LGradation>(10);
   }
   int hashCode = 1;
   hashCode = LSystem.unite(hashCode, s.getRGB());
   hashCode = LSystem.unite(hashCode, e.getRGB());
   hashCode = LSystem.unite(hashCode, w);
   hashCode = LSystem.unite(hashCode, h);
   hashCode = LSystem.unite(hashCode, alpha);
   String key = String.valueOf(hashCode);
   LGradation o = (LGradation) lazyGradation.get(key);
   if (o == null) {
     lazyGradation.put(key, o = new LGradation(s, e, w, h, alpha));
   }
   return o;
 }
Ejemplo n.º 2
0
 /**
  * 创建默认的选择器背景图片
  *
  * @param w
  * @param h
  * @return
  */
 private LImage createDefaultDialog(int w, int h) {
   if (lazyDialog == null) {
     lazyDialog = new HashMap<String, LImage>(10);
   }
   int hash = 1;
   hash = LSystem.unite(hash, w);
   hash = LSystem.unite(hash, h);
   String key = String.valueOf(hash);
   LImage o = (LImage) lazyDialog.get(key);
   if (o == null) {
     o = LImage.createImage(w, h, true);
     LGraphics g = o.getLGraphics();
     LGradation.getInstance(Color.white, Color.black, w, h).drawHeight(g, 0, 0);
     g.setColor(Color.black);
     g.drawRect(0, 0, w - 1, h - 1);
     g.dispose();
     lazyDialog.put(key, o);
   }
   return o;
 }