This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Resource → Bitmap | |
BitmapFactory.decodeResource(getResources(), R.drawable.icon); | |
//Resource → Drawable | |
getResources().getDrawable(R.drawable.icon); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ArrayList<Bitmap> split(Drawable drawable, int width, int height) | |
{ | |
// 縦長Drawableをビットマップに | |
Bitmap bitmapOrg = ((BitmapDrawable) drawable).getBitmap(); | |
//分割bitmapにして配列に保存 | |
int masterHeight = bitmapOrg.getHeight(); | |
int max = masterHeight / height; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
ex) | |
<string-array name="entries0"> | |
<item>値1</item> | |
<item>値2</item> | |
<item>値3</item> | |
<item>値4</item> | |
</string-array> | |
*/ | |
String[] array =getResources().getStringArray(R.array.entries0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//四捨五入 | |
BigDecimal origin = new BigDecimal(f); | |
BigDecimal res = origin.setScale(0,BigDecimal.ROUND_HALF_UP); | |
result = res.shortValue(); | |
or | |
Math.round(f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Android ライブ壁紙 Drawable 描画用 あれこれサンプル | |
// | |
/**================================== | |
* R.java から Drawable取得 | |
*/ | |
// 取得 | |
private Drawable _image; | |
_image = r.getDrawable(R.drawable.image0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*============================================================ | |
* copyright(c) 2011 www.romatica.com | |
* @author itoz | |
* 2011/05/29 | |
*============================================================ | |
*/ | |
package | |
{ | |
import flash.display.Sprite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _slist : SerialList = new SerialList(); | |
for (var i : int = 0; i < _arr.length; i++) { | |
_slist.addCommand(new Func( | |
function(i : int) : void{ | |
(_arr[i] as MyClass).fadeIn() | |
} | |
, [i]) | |
); | |
_slist.addCommand(new Wait(0.1)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flashvars={}; | |
if( location.search != "" ){ | |
var str = location.search.substring( 1 ); | |
var params = str.split( "&" ); | |
for( var i = 0; i < params.length; i++ ) | |
{ | |
var values = params[ i ].split( "=" ); | |
flashvars[ values[ 0 ] ] = values[ 1 ]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*============================================================ | |
* copyright(c) 2011 | |
* @author itoz | |
* 2011/04/01 | |
*============================================================ | |
*/ | |
package com.romatica.display | |
{ | |
import caurina.transitions.Tweener; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* EixfのOrientation(回転情報)から、正の位置に補正したBitmapDataを返す. | |
* @param bitmapData 補正前のBitmapData | |
* @param exifOrient exifのOrient情報 1~8 | |
* @see http://sylvana.net/jpegcrop/exif_orientation.html | |
*/ | |
public static function correctExifOrient(bitmapData : BitmapData, exifOrient : int) : BitmapData | |
{ | |
var correctBMD : BitmapData; | |
var mat : Matrix = new Matrix(); |