ImageLoadInfo.java
资源名称:src.zip [点击查看]
上传用户:luxiaowei
上传日期:2022-06-06
资源大小:58k
文件大小:2k
源码类别:
J2ME
开发平台:
Java
- /*
- * ImageLoadInfo.java
- *
- * Created on April 20, 2010, 11:41 AM
- *
- * To change this template, choose Tools | Template Manager
- * and open the template in the editor.
- */
- package com.MOM.resources;
- import javax.microedition.lcdui.Image;
- class ImageLoadInfo
- {
- static byte counter;
- String imageName;
- private byte resizeOption;
- private byte value;
- ImageLoadInfo(String name,byte resizeOption)
- {
- this.imageName = name;
- this.resizeOption = resizeOption;
- value = counter++;
- }
- protected Image getImage()
- {
- if( Resources.getInstance().getImage(value) == null)
- loadImage();
- return Resources.getInstance().getImage(value) ;
- }
- void loadImage()
- {
- switch (resizeOption)
- {
- case Resources.RESIZE_NONE:
- Resources.getInstance().setImage(value , Resources.loadResizeImage(imageName,-1,-1)) ;
- break;
- case Resources.RESIZE_ONLY_WIDTH:
- Resources.getInstance().setImage(value , Resources.loadResizeImage(imageName, Resources.DEFAULT_IMAGE_WIDTH_RESOLUTION,-1)) ;
- break;
- case Resources.RESIZE_ONLY_HEIGHT:
- Resources.getInstance().setImage(value , Resources.loadResizeImage(imageName,-1, Resources.DEFAULT_IMAGE_HEIGHT_RESOLUTION)) ;
- break;
- case Resources.RESIZE_BOTH:
- Resources.getInstance().setImage(value , Resources.loadResizeImage(imageName, Resources.DEFAULT_IMAGE_WIDTH_RESOLUTION, Resources.DEFAULT_IMAGE_HEIGHT_RESOLUTION)) ;
- break;
- }
- }
- }