Exemple #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;
 }
 /**
  * 创建默认的选择器背景图片
  *
  * @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;
 }
Exemple #3
0
 public static LTextureData getTextureData(BufferedImage img) {
   if (img == null) {
     throw new RuntimeException("Source image is null !");
   }
   try {
     return new GLLoader(img);
   } catch (Exception e) {
     LTextures.destroyAll();
     LImage.disposeAll();
     LSystem.gc();
   }
   return new GLLoader(img);
 }
Exemple #4
0
 public static LTextureData getTextureData(String fileName) {
   if (fileName == null) {
     throw new RuntimeException("Path is null !");
   }
   String key = fileName.trim().toLowerCase();
   LTextureData data = lazyLoader.get(key);
   if (data == null || data.source == null) {
     try {
       lazyLoader.put(key, data = new GLLoader(fileName));
     } catch (Exception e) {
       LTextures.destroyAll();
       LImage.disposeAll();
       LSystem.gc();
       lazyLoader.put(key, data = new GLLoader(fileName));
     }
   }
   return data;
 }
Exemple #5
0
 public boolean openBrowser(String url) {
   return LSystem.openBrowser(url);
 }
Exemple #6
0
 /** 设置是否录像当前Screen(保存为FLV) */
 public synchronized void setVideo(boolean video) {
   setVideo(LSystem.getLVideoFile(), video);
 }
Exemple #7
0
 /** 保存当前窗体显示图像 */
 public void saveScreenImage() {
   GraphicsUtils.saveImage(getScreenImage(), LSystem.getLScreenFile());
 }