當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。