Giriş
Bu sınıf BitmapFactory metodları ile kullanılıyor.
Şöyle yaparız.
Şöyle yaparız.
Bitmap'in boyutunu dosyadan almak için şöyle yaparız.
Pixel başına ne kadar byte harcanacağını ayarlamak için şöyle yaparız. Default RGB_8888 değeri kullanılır.
Bu sınıf BitmapFactory metodları ile kullanılıyor.
Şöyle yaparız.
BitmapFactory.decodeFile (..., options);BitmapFactory.decodeByteArray (...,...,...,options);BitmapFactory.decodeResource (...,...,options);Şöyle yaparız.
BitmapFactory.Options options = new BitmapFactory.Options();Bitmap'in boyutunu dosyadan almak için şöyle yaparız.
options.inJustDecodeBounds = true;Resources res = ...; int resId = ...;
// First decode with inJustDecodeBounds=true to check dimensions
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);int height = options.outHeight;
int width = options.outWidth;Pixel başına ne kadar byte harcanacağını ayarlamak için şöyle yaparız. Default RGB_8888 değeri kullanılır.
options.inPreferredConfig = Bitmap.Config.RGB_565;options.inPreferredConfig = Bitmap.Config.ARGB_8888;byte[] data = ...;
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 5;
options.inPurgeable=true;                   
options.inInputShareable=true;
Bitmap realImage = BitmapFactory.decodeByteArray(data,0,data.length,options);
 
Hiç yorum yok:
Yorum Gönder