Code example for BitmapFactory.Options

Methods: decodeFileDescriptor

	public static Bitmap requestDecode(final JobContext jc, final FileDescriptor fd, Options options,
			final int targetSize) {
		if (options == null) {
			options = new Options();
		jc.setCancelListener(new DecodeCanceller(options));
		options.inJustDecodeBounds = true;
		BitmapFactory.decodeFileDescriptor(fd, null, options);
		if (jc.isCancelled()) return null;
		options.inSampleSize = BitmapUtils.computeSampleSizeLarger(options.outWidth, options.outHeight, targetSize);
		options.inJustDecodeBounds = false;
		Bitmap result = BitmapFactory.decodeFileDescriptor(fd, null, options);
		// We need to resize down if the decoder does not support inSampleSize. 
		// (For example, GIF images.) 
		result = BitmapUtils.resizeDownIfTooBig(result, targetSize, true);
		return ensureGLCompatibleBitmap(result);