• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Image类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.microedition.lcdui.Image的典型用法代码示例。如果您正苦于以下问题:Java Image类的具体用法?Java Image怎么用?Java Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Image类属于javax.microedition.lcdui包,在下文中一共展示了Image类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public IAnswerData processImage(Image image)
        throws ImageProcessingException {
    MonochromeBitmapSource source = new LCDUIImageMonochromeBitmapSource(
            image);
    Reader reader = new QRCodeReader();
    Hashtable hints = new Hashtable();
    // hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);

    try {
        Result result = reader.decode(source, hints);
        if ((result != null) && (result.getText() != null)) {
            String scannedCode = result.getText();
            return new StringData(scannedCode);
        } else {
            throw new ImageProcessingException("Barcode scanning failed");
        }
    } catch (ReaderException re) {
        throw new ImageProcessingException("Barcode scanning failed");
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:ZXingBarcodeProcessingService.java


示例2: getListRowImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
private Image getListRowImage(int priority){
	Image image = null;
	String path;
	if (priority < 3)
		path = "/low.png";
	else if (priority < 7)
		path = "/normal.png";
	else
		path = "/important.png";		
	
	try {
		image = Image.createImage(path);
	} catch (IOException e) {
		e.printStackTrace();
	}
	return image;
}
 
开发者ID:NotesTeam,项目名称:TaskBook-J2ME,代码行数:18,代码来源:NotesList.java


示例3: getCategoryImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
private Image getCategoryImage(String id) {
	Image image = null;
	String path;

	if(id.equals("Family"))
		path = "/family.png";
	else if(id.equals("Work"))
		path = "/work.png";
	else
		path = "/school.png";

	try {
		image = Image.createImage(path);
	} catch (IOException e) {
		e.printStackTrace();
	}		
	return image;
}
 
开发者ID:NotesTeam,项目名称:TaskBook-J2ME,代码行数:19,代码来源:Category.java


示例4: setImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public void setImage(final Image image) {
	activity.post(new Runnable() {
		public void run() {
			if (image == null) {
				imageView.setVisibility(GONE);
				imageView.setImageBitmap(null);
			} else {
				imageView.setVisibility(VISIBLE);
				if (image.isMutable()) {
					imageView.setImageBitmap(((AndroidMutableImage) image).getBitmap());
				} else {
					imageView.setImageBitmap(((AndroidImmutableImage) image).getBitmap());
				}
			}
		}
	});
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:18,代码来源:AndroidImageStringItemUI.java


示例5: createRGBImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public Image createRGBImage(int[] rgb, int width, int height, boolean processAlpha) {
	if (rgb == null)
		throw new NullPointerException();
	if (width <= 0 || height <= 0)
		throw new IllegalArgumentException();
	
	// TODO processAlpha is not handled natively, check whether we need to create copy of rgb
	int[] newrgb = rgb;
	if (!processAlpha) {
		newrgb = new int[rgb.length];
		for (int i = 0; i < rgb.length; i++) {
			newrgb[i] = (0x00ffffff & rgb[i]) | 0xff000000;
		}
	}
	return new AndroidImmutableImage(Bitmap.createBitmap(newrgb, width, height, Bitmap.Config.ARGB_8888));
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:17,代码来源:AndroidDeviceDisplay.java


示例6: init

import javax.microedition.lcdui.Image; //导入依赖的package包/类
/**
 * ���������ʼ��
 * @param score ����
 * @throws IOException
 */
public void init(int score) throws IOException
{
	/*��Ϸ����:42,23
	gameover:42,38
	������:38,58
	����ͼƬ:45,107*/
	gameovertip=Image.createImage("/gameovertip.GIF");
	endtip=Image.createImage("/endtip.GIF");
	scorebg=Image.createImage("/scorebg.GIF");
	gameoverbg=Image.createImage("/gameoverbg.GIF");
	
	Graphics gra=super.getGraphics();
	gra.setColor(255, 255, 255);
	gra.fillRect(0, 0, sw, sh);
	gra.drawImage(endtip, 42, 23,Graphics.LEFT|Graphics.TOP);
	gra.drawImage(gameovertip, 42, 38,Graphics.LEFT|Graphics.TOP);
	gra.drawImage(scorebg, 38, 58,Graphics.LEFT|Graphics.TOP);
	gra.drawImage(gameoverbg, 45, 107,Graphics.LEFT|Graphics.TOP);
	flushGraphics();
	repaint();
	super.ShowScore(score);
	System.out.println("��������������");
}
 
开发者ID:cabbage89,项目名称:danceGame,代码行数:29,代码来源:CanvasOver.java


示例7: getImageItem

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public static ImageItem getImageItem(FormEntryPrompt fep,int height,int width) {
    String IaltText;

    IaltText = fep.getShortText();
    Image im = ImageUtils.getImage(fep.getImageText());
    if(im!=null){

        //scale
        int[] newDimension = ImageUtils.getNewDimensions(im, height, width);

        if(newDimension[0] != height || newDimension[1] != width) {
            im = ImageUtils.resizeImage(im, newDimension[1], newDimension[0]);
        }

        ImageItem imItem = new ImageItem(null,im, ImageItem.LAYOUT_CENTER | ImageItem.LAYOUT_VCENTER, IaltText);
        imItem.setLayout(Item.LAYOUT_CENTER);
        return imItem;
    }else{
        return null;
    }

}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:ExpandedWidget.java


示例8: raiseAlert

import javax.microedition.lcdui.Image; //导入依赖的package包/类
private void raiseAlert() {
    if(alertTitle != null || msg != null) {
        Runnable r = new Runnable() {
            String at = alertTitle;
            String m = msg;
            Image alIm = alertImage;
            String aURI = audioURI;
            long time = new Date().getTime();


            public void run() {
                J2MEDisplay.showError(at, m, alIm);
                if(aURI != null) {
                    MediaUtils.playAudio(aURI);
                }
            }

        };
        new HandledThread(r).start();
        alertTitle = null;
        msg = null;
        alertImage = null;
        audioURI = null;
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:26,代码来源:Chatterbox.java


示例9: getNewDimensions

import javax.microedition.lcdui.Image; //导入依赖的package包/类
/**
 * Used for scaling an image.  Checks to see if an image is bigger than the
 * provided dimensions, and provides new dimensions such that the image
 * scales to fit within the dimensions given. If the image is smaller (in both width and height)
 * than the given dimensions, returns the original image dimensions.
 * @param source image
 * @return int array [height, width]
 */
public static int[] getNewDimensions(Image im, int height, int width){
  double scalef = im.getHeight()*1.0/im.getWidth();
  int w = 1;
  int h = 1;
  if(im.getHeight() > height && im.getWidth() <= width){ //height is overbounds
      h = height;
      w = (int)Math.floor(h/scalef);
  }else if (im.getHeight() <= height && im.getWidth() > width){  //width is overbouds
      w = width;
      h = (int)Math.floor(w*scalef);
  }else if (im.getHeight() > height && im.getWidth() > width){ //both are overbounds
      if(height > width){    //screen width is smaller dimension, so reduce im width and scale height
          w = width;
          h = (int)Math.floor(w*scalef);
      }else if(height <= width){ //reduce height and scale width
          h = height;
          w = (int)Math.floor(h/scalef);
      }
  }else{
      h = im.getHeight();
      w = im.getWidth();
  }
      int[] dim = {h,w};
      return dim;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:34,代码来源:ImageUtils.java


示例10: CBitmap

import javax.microedition.lcdui.Image; //导入依赖的package包/类
CBitmap(Image img) {
    
    Larg = img.getWidth();
    Alt = img.getHeight();

    raw = new int[Larg*Alt];

    img.getRGB(raw, 0, Larg, 0, 0, Larg, Alt);
    
    PMCor = new Cor[Alt][Larg];

    for (int y = 0; y < Alt; y++) {
        for (int x = 0; x < Larg; x++) {
            PMCor[y][x] = new Cor(raw[x+y*Larg]);
        }
    }
}
 
开发者ID:gstiebler,项目名称:tio_patinhas,代码行数:18,代码来源:UCBitmap.java


示例11: CTonsCinza

import javax.microedition.lcdui.Image; //导入依赖的package包/类
/**
 * Constrói um CTonsCinza a partir de uma Image
 */
CTonsCinza(Image img) {
   
    Larg = img.getWidth();
    Alt = img.getHeight();
    
    TonsCinza = new int[Alt][Larg];
    raw = new int[Larg*Alt];

    img.getRGB(raw, 0, Larg, 0, 0, Larg, Alt);
    
    for (int y = 0; y < Alt; y++) {
        for (int x = 0; x < Larg; x++) {
            pixel=raw[x+y*Larg];
            
            azul=pixel & 0x0000FF;
            verde=(pixel & 0xFF00) >> 8;
            vermelho=(pixel & 0xFF0000) >> 16;
            pixel=azul*11+verde*59+vermelho*30;
            pixel*=0.01;
            TonsCinza[y][x] = pixel;
        }
    }
}
 
开发者ID:gstiebler,项目名称:tio_patinhas,代码行数:27,代码来源:UCBitmap.java


示例12: paint

import javax.microedition.lcdui.Image; //导入依赖的package包/类
/**
 * @see javax.microedition.lcdui.CustomItem#paint(javax.microedition.lcdui.Graphics, int, int)
 */
protected void paint(Graphics g, int w, int h) {
	// Draw the title text
	Util.drawStringCenteredAndTruncated(g, "Rating:", font, 0, 0, w, font.getHeight(),
			Graphics.TOP | Graphics.LEFT );
	for(int i = 0; i < zones.length; i++) {
		GestureInteractiveZone zone = zones[i];
		Image image = null;
		// Determine whether a full or empty star needs to be drawn
		if(i < rating){
			image = starImgFilled;
		} else{
			image = starImgEmpty;
		}
		// Draw a star image
		Util.drawImageCentered(g, image, zone.getX(), zone.getY(),
				zone.getWidth(), zone.getHeight());
	}
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:22,代码来源:RatingItem.java


示例13: SaveImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
/**
 * Retorna uma Image gerada a partir do CTonsCinza
 */
Image SaveImage() {
    
    int[] rawRGB = new int[Larg*Alt];
  
    int ponteiro = 0;
    
    for (int y = 0; y < Alt; y++) {
        for (int x = 0; x < Larg; x++) {
            rawRGB[ponteiro] = TonsCinza[y][x];
            rawRGB[ponteiro] = TonsCinza[y][x];
            rawRGB[ponteiro++] = TonsCinza[y][x];
        }
    }
    
    Image img = Image.createRGBImage(rawRGB, Larg, Alt, false);
   
    return img;
}
 
开发者ID:gstiebler,项目名称:tio_patinhas,代码行数:22,代码来源:UCBitmap.java


示例14: Screen

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public Screen(Display display) {
    super();
    this.setFullScreenMode(true);
    this.parentDisplay = display;

    updateOrientation();

    try {
        // Create background image
        this.background = Image.createImage("midlets/blogwriter/images/Background.png");
    } catch (IOException e) {
        this.parentDisplay.setCurrent(
                new Alert("Cannot create graphics."), this);
    }
    VirtualKeyboard.setVisibilityListener(this);
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:17,代码来源:Screen.java


示例15: loadImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public Image loadImage(int zoom, int x, int y, int mapSource, boolean goDown, Vector obs) {
	String key = mapSource + "/" + zoom + "/" + x + "/" + y;
	synchronized(this.keys) {
		if(this.isEnabled && this.keys.containsKey(key)) {
			int id = Integer.parseInt((String)this.keys.get(key));
			try {
				byte[] buf = rsImages.getRecord(id);
				Image img = Image.createImage(buf, 0, buf.length);
				return img;
			} catch(RecordStoreException ex) {
				ex.printStackTrace();
				return this.successor.loadImage(zoom, x, y, mapSource, goDown, obs);
			}
		} else if(goDown) {
			if(obs == null) {
				obs = new Vector();
			}
			obs.addElement(this);
			return this.successor.loadImage(zoom, x, y, mapSource, goDown, obs);
		} else {
			return null;
		}
	}
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:25,代码来源:RMSTileCache.java


示例16: loadImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public Image loadImage(int zoom, int x, int y, int mapSource, boolean goDown, Vector obs) {

		// Hopefully efficiently build the key string
		StringBuffer str = new StringBuffer();
		str.append(mapSource);
		str.append('/');
		str.append(zoom);
		str.append('/');
		str.append(x);
		str.append('/');
		str.append(y);
		String key = str.toString();

		if(tiles.containsKey(key)) {
			return (Image)tiles.get(key);
		} else if(goDown) {
			Image img = this.successor.loadImage(zoom, x, y, mapSource, goDown, obs);
			if(img != null) {
				addToMemoryCache(key, img);
			}
			return img;
		} else {
			return null;
		}
	}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:26,代码来源:MemoryTileCache.java


示例17: drawImage

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public void drawImage(Image img, int x, int y, int anchor) {
       if (delegate != null) {
           delegate.drawImage(img, x, y, anchor);
       } else {
           int newx = x;
           int newy = y;
   
           if (anchor == 0) {
               anchor = javax.microedition.lcdui.Graphics.TOP | javax.microedition.lcdui.Graphics.LEFT;
           }
   
           if ((anchor & javax.microedition.lcdui.Graphics.RIGHT) != 0) {
               newx -= img.getWidth();
           } else if ((anchor & javax.microedition.lcdui.Graphics.HCENTER) != 0) {
               newx -= img.getWidth() / 2;
           }
           if ((anchor & javax.microedition.lcdui.Graphics.BOTTOM) != 0) {
               newy -= img.getHeight();
           } else if ((anchor & javax.microedition.lcdui.Graphics.VCENTER) != 0) {
               newy -= img.getHeight() / 2;
           }
   
           if (img.isMutable()) {
               canvas.drawBitmap(((AndroidMutableImage) img).getBitmap(), newx, newy, strokePaint);
           } else {
               canvas.drawBitmap(((AndroidImmutableImage) img).getBitmap(), newx, newy, strokePaint);
           }
       }
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:30,代码来源:AndroidDisplayGraphics.java


示例18: insert

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public void insert(final int elementNum, final String stringPart, final Image imagePart) {
	activity.post(new Runnable() {
		public void run() {
			synchronized (AndroidChoiceGroupUI.this) {
				View view = createView(stringPart, imagePart);
				if (listView instanceof LinearLayout) {
					listView.addView(view, elementNum);
				}
				listAdapter.insert(elementNum, view);
			}
		}
	});
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:14,代码来源:AndroidChoiceGroupUI.java


示例19: set

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public void set(int elementNum, String stringPart, Image imagePart) {
System.out.println("AndroidChoiceGroupUI.set(..) not synced");
		View view = createView(stringPart, imagePart);
		if (listView instanceof LinearLayout) {
			listView.removeViewAt(elementNum);
			listView.addView(view, elementNum);
		}
		listAdapter.set(elementNum, view);
	}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:10,代码来源:AndroidChoiceGroupUI.java


示例20: append

import javax.microedition.lcdui.Image; //导入依赖的package包/类
public int append(final String stringPart, final Image imagePart) {
	if (activity.isActivityThread()) {
		appendTransfer = listAdapter.append(stringPart, imagePart);
	} else {
		appendTransfer = Integer.MIN_VALUE;
		activity.post(new Runnable() {
			public void run() {
				synchronized (AndroidListUI.this) {
					appendTransfer = listAdapter.append(stringPart, imagePart);
					AndroidListUI.this.notify();
				}
			}
		});

		synchronized (AndroidListUI.this) {
			if (appendTransfer == Integer.MIN_VALUE) {
				try {
					wait();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}
	
	return appendTransfer;
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:28,代码来源:AndroidListUI.java



注:本文中的javax.microedition.lcdui.Image类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Destination类代码示例发布时间:2022-05-21
下一篇:
Java GraphElementAccessor类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap