2011-12-29 12 views

答えて

1

まず、この

EncodedImage ei = EncodedImage.getEncodedImageResource("res/helpscreen.png"); 

のような符号化された画像を作成するには、以下の機能には、この符号化画像を渡す

EncodedImage ei1= scaleImage(ei,reqWidth,requiredHeight); 


public EncodedImage scaleImage(EncodedImage source, int requiredWidth, int requiredHeight) 
    { 
     int currentWidthFixed32 = Fixed32.toFP(source.getWidth()); 
     int requiredWidthFixed32 = Fixed32.toFP(requiredWidth); 
     int scaleXFixed32 = Fixed32.div(currentWidthFixed32, requiredWidthFixed32); 
     int currentHeightFixed32 = Fixed32.toFP(source.getHeight()); 
     int requiredHeightFixed32 = Fixed32.toFP(requiredHeight); 
     int scaleYFixed32 = Fixed32.div(currentHeightFixed32, requiredHeightFixed32); 
     return source.scaleImage32(scaleXFixed32, scaleYFixed32); 
    } 

これはあなたに符号化された画像が得られます。それはBitmap.scaleInto(...)を試しBitmap画像を拡大縮小するには

 BitmapField logoBitmap = new BitmapField(ei1.getBitmap()); 
0

を使用してビットマップに変換します。 API Link.

Bitmap targetBm = new Bitmap(Display.getWidth(), Display.getHeight()); 
srcBitmap.scaleInto(targetBm, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_STRETCH); 
関連する問題