当前位置: 首页>>代码示例>>Java>>正文


Java BitmapDrawable.setFilterBitmap方法代码示例

本文整理汇总了Java中android.graphics.drawable.BitmapDrawable.setFilterBitmap方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapDrawable.setFilterBitmap方法的具体用法?Java BitmapDrawable.setFilterBitmap怎么用?Java BitmapDrawable.setFilterBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.drawable.BitmapDrawable的用法示例。


在下文中一共展示了BitmapDrawable.setFilterBitmap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateView

import android.graphics.drawable.BitmapDrawable; //导入方法依赖的package包/类
private void updateView() {
    if (!isResumed())
        return;

    final String bitcoinRequest = determineBitcoinRequestStr(true);
    final byte[] paymentRequest = determinePaymentRequest(true);

    // update qr-code
    qrCodeBitmap = new BitmapDrawable(getResources(), Qr.bitmap(bitcoinRequest));
    qrCodeBitmap.setFilterBitmap(false);
    qrView.setImageDrawable(qrCodeBitmap);

    // update initiate request message
    final SpannableStringBuilder initiateText = new SpannableStringBuilder(
            getString(R.string.request_coins_fragment_initiate_request_qr));
    if (nfcAdapter != null && nfcAdapter.isEnabled())
        initiateText.append(' ').append(getString(R.string.request_coins_fragment_initiate_request_nfc));
    initiateRequestView.setText(initiateText);

    // focus linking
    final int activeAmountViewId = amountCalculatorLink.activeTextView().getId();
    acceptBluetoothPaymentView.setNextFocusUpId(activeAmountViewId);

    paymentRequestRef.set(paymentRequest);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:26,代码来源:RequestCoinsFragment.java

示例2: onLoadFinished

import android.graphics.drawable.BitmapDrawable; //导入方法依赖的package包/类
@Override
public void onLoadFinished(final Loader<Address> loader, final Address currentAddress) {
    if (!currentAddress.equals(currentAddressQrAddress)) {
        currentAddressQrAddress = new AddressAndLabel(currentAddress, config.getOwnName());

        final String addressStr = BitcoinURI.convertToBitcoinURI(currentAddressQrAddress.address, null,
                currentAddressQrAddress.label, null);

        currentAddressQrBitmap = new BitmapDrawable(getResources(), Qr.bitmap(addressStr));
        currentAddressQrBitmap.setFilterBitmap(false);

        currentAddressUriRef.set(addressStr);

        updateView();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:17,代码来源:WalletAddressFragment.java

示例3: onCreateDialog

import android.graphics.drawable.BitmapDrawable; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final BitmapDrawable bitmap = new BitmapDrawable(getResources(), (Bitmap) args.getParcelable(KEY_BITMAP));
    bitmap.setFilterBitmap(false);

    final Dialog dialog = new Dialog(activity);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.bitmap_dialog);
    dialog.setCanceledOnTouchOutside(true);

    final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image);
    imageView.setImageDrawable(bitmap);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            dismiss();
        }
    });

    return dialog;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:23,代码来源:BitmapFragment.java

示例4: builtInPixelization

import android.graphics.drawable.BitmapDrawable; //导入方法依赖的package包/类
/**
 * This method of image pixelization utilizes the bitmap scaling operations built
 * into the framework. By downscaling the bitmap and upscaling it back to its
 * original size (while setting the filter flag to false), the same effect can be
 * achieved with much better performance.
 */
public BitmapDrawable builtInPixelization(float pixelizationFactor, Bitmap bitmap) {

    int width = bitmap.getWidth();
    int height = bitmap.getHeight();

    int downScaleFactorWidth = (int)(pixelizationFactor * width);
    downScaleFactorWidth = downScaleFactorWidth > 0 ? downScaleFactorWidth : 1;
    int downScaleFactorHeight = (int)(pixelizationFactor * height);
    downScaleFactorHeight = downScaleFactorHeight > 0 ? downScaleFactorHeight : 1;

    int downScaledWidth =  width / downScaleFactorWidth;
    int downScaledHeight = height / downScaleFactorHeight;

    Bitmap pixelatedBitmap = Bitmap.createScaledBitmap(bitmap, downScaledWidth,
            downScaledHeight, false);

    /* Bitmap's createScaledBitmap method has a filter parameter that can be set to either
     * true or false in order to specify either bilinear filtering or point sampling
     * respectively when the bitmap is scaled up or now.
     *
     * Similarly, a BitmapDrawable also has a flag to specify the same thing. When the
     * BitmapDrawable is applied to an ImageView that has some scaleType, the filtering
     * flag is taken into consideration. However, for optimization purposes, this flag was
     * ignored in BitmapDrawables before Jelly Bean MR1.
     *
     * Here, it is important to note that prior to JBMR1, two bitmap scaling operations
     * are required to achieve the pixelization effect. Otherwise, a BitmapDrawable
     * can be created corresponding to the downscaled bitmap such that when it is
     * upscaled to fit the ImageView, the upscaling operation is a lot faster since
     * it uses internal optimizations to fit the ImageView.
     * */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), pixelatedBitmap);
        bitmapDrawable.setFilterBitmap(false);
        return bitmapDrawable;
    } else {
        Bitmap upscaled = Bitmap.createScaledBitmap(pixelatedBitmap, width, height, false);
        return new BitmapDrawable(getResources(), upscaled);
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:47,代码来源:ImagePixelization.java


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