java类android.graphics.LightingColorFilter的实例源码

WifiQrView.java 文件源码 项目:mobile-store 阅读 28 收藏 0 点赞 0 评论 0
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    setUIFromWifi();

    ImageView qrImage = (ImageView) findViewById(R.id.wifi_qr_code);

    // Replace all blacks with the background blue.
    qrImage.setColorFilter(new LightingColorFilter(0xffffffff, getResources().getColor(R.color.swap_blue)));

    Button openQr = (Button) findViewById(R.id.btn_qr_scanner);
    openQr.setOnClickListener(new Button.OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().initiateQrScan();
        }
    });

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(
            onWifiStateChanged, new IntentFilter(WifiStateChangeService.BROADCAST));
}
OverlayNotificationBarView.java 文件源码 项目:NoticeDog 阅读 26 收藏 0 点赞 0 评论 0
private void setButton(Button button, Message message, int index) {
    List<Action> actions = message.getActions();
    if (index >= actions.size()) {
        button.setVisibility(View.GONE);
        return;
    }
    Action action = (Action) actions.get(index);
    button.setOnClickListener(null);
    button.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
    button.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0);
    button.setVisibility(View.VISIBLE);
    Drawable icon = getActionIcon(message.getAppId(), action.icon);
    icon.setColorFilter(new LightingColorFilter(ViewCompat.MEASURED_STATE_MASK, 6914181));
    button.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null);
    button.setText(action.title);
}
BlockView.java 文件源码 项目:Blockly 阅读 28 收藏 0 点赞 0 评论 0
private void initDrawingObjects() {
    int blockColour = mBlock.getColor();
    if (mBlock.isShadow()) {
        float hsv[] = new float[3];
        Color.colorToHSV(blockColour, hsv);
        hsv[1] *= SHADOW_SATURATION_MULTIPLIER;
        hsv[2] *= SHADOW_VALUE_MULTIPLIER;
        if (hsv[2] > 1) {
            hsv[2] = 1;
        }
        blockColour = Color.HSVToColor(hsv);
    }

    // Highlight color channels are added to each color-multiplied color channel, and since the
    // patches are 50% gray, the addition should be 50% of the base value.
    final int highlight = Color.argb(255, Color.red(blockColour) / 2,
            Color.green(blockColour) / 2, Color.blue(blockColour) / 2);
    mBlockColorFilter = new LightingColorFilter(blockColour, highlight);

    mFillPaint.setColor(blockColour);
    mFillPaint.setStyle(Paint.Style.FILL);
}
MainActivity.java 文件源码 项目:APKMirror 阅读 25 收藏 0 点赞 0 评论 0
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void changeUIColor(Integer color) {

    ValueAnimator anim = ValueAnimator.ofArgb(previsionThemeColor, color);
    anim.setEvaluator(new ArgbEvaluator());

    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            progressBar.getProgressDrawable().setColorFilter(new LightingColorFilter(0xFF000000, (Integer) valueAnimator.getAnimatedValue()));
            setSystemBarColor((Integer) valueAnimator.getAnimatedValue());
            navigation.setActiveTabColor((Integer) valueAnimator.getAnimatedValue());
            fabSearch.setBackgroundTintList(ColorStateList.valueOf((Integer) valueAnimator.getAnimatedValue()));

        }
    });

    anim.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime));
    anim.start();
    refreshLayout.setColorSchemeColors(color, color, color);

}
ScrollingActivity.java 文件源码 项目:FrostyBackgroundTestApp 阅读 32 收藏 0 点赞 0 评论 0
public Bitmap captureView(View view) {
    //Find the view we are after
    //Create a Bitmap with the same dimensions
    Bitmap image = Bitmap.createBitmap(view.getMeasuredWidth(),
            view.getMeasuredHeight(),
            Bitmap.Config.ARGB_4444); //reduce quality and remove opacity
    //Draw the view inside the Bitmap
    Canvas canvas = new Canvas(image);
    view.draw(canvas);

    //Make it frosty
    Paint paint = new Paint();
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    ColorFilter filter = new LightingColorFilter(0xFFFFFFFF, 0x00222222); // lighten
    //ColorFilter filter = new LightingColorFilter(0xFF7F7F7F, 0x00000000);    // darken
    paint.setColorFilter(filter);
    canvas.drawBitmap(image, 0, 0, paint);

    return image;
}
CardViewActivity.java 文件源码 项目:FrostyBackgroundTestApp 阅读 27 收藏 0 点赞 0 评论 0
public Bitmap captureView(View view) {
  if (mBlurredBitmap != null) {
    return mBlurredBitmap;
  }
  //Find the view we are after
  //Create a Bitmap with the same dimensions
  mBlurredBitmap = Bitmap.createBitmap(view.getMeasuredWidth(),
      view.getMeasuredHeight(),
      Bitmap.Config.ARGB_4444); //reduce quality and remove opacity
  //Draw the view inside the Bitmap
  Canvas canvas = new Canvas(mBlurredBitmap);
  view.draw(canvas);

  //blur it
  ImageHelper.blurBitmapWithRenderscript(rs, mBlurredBitmap);

  //Make it frosty
  Paint paint = new Paint();
  paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
  ColorFilter filter = new LightingColorFilter(0xFFFFFFFF, 0x00222222); // lighten
  //ColorFilter filter = new LightingColorFilter(0xFF7F7F7F, 0x00000000);    // darken
  paint.setColorFilter(filter);
  canvas.drawBitmap(mBlurredBitmap, 0, 0, paint);

  return mBlurredBitmap;
}
WifiQrView.java 文件源码 项目:fdroid 阅读 23 收藏 0 点赞 0 评论 0
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    setUIFromWifi();

    ImageView qrImage = (ImageView) findViewById(R.id.wifi_qr_code);

    // Replace all blacks with the background blue.
    qrImage.setColorFilter(new LightingColorFilter(0xffffffff, getResources().getColor(R.color.swap_blue)));

    Button openQr = (Button) findViewById(R.id.btn_qr_scanner);
    openQr.setOnClickListener(new Button.OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().initiateQrScan();
        }
    });

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(
            onWifiStateChanged, new IntentFilter(WifiStateChangeService.BROADCAST));
}
LightingColorFilterView.java 文件源码 项目:zone-sdk 阅读 27 收藏 0 点赞 0 评论 0
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);


    System.out.println("View.isHardwareAccelerated:"+isHardwareAccelerated());
    int width  = 300;
    //这里是为了等比缩放
    int height = width * mBmp.getHeight()/mBmp.getWidth();
    canvas.drawBitmap(mBmp,null,new Rect(0,0,width,height),mPaint);

    //为什么是ff而不能是01呢 因为A默认值是ff 所以 矩阵相乘的时候  会在mod255
    canvas.translate(0,height);
    mPaint.setColorFilter(new LightingColorFilter(0xffffff,0x0000f0));
    canvas.drawBitmap(mBmp,null,new Rect(0,0,width,height),mPaint);

    canvas.translate(0,height);
    mPaint.setColorFilter(new LightingColorFilter(0x00ff00,0x000000));
    canvas.drawBitmap(mBmp,null,new Rect(0,0,width,height),mPaint);
}
LightingColorCustomView.java 文件源码 项目:AndroidExerciseProgram 阅读 28 收藏 0 点赞 0 评论 0
@Override
    public void onClick(View v) {
        if (x >= (appAreaRect.width() - mBitmap.getWidth()) / 2
                && x <= mBitmap.getWidth() + (appAreaRect.width() - mBitmap.getWidth()) / 2
                && y >= (appAreaRect.height() - MeasureUtil.getToolbarHeight(getContext()) - mBitmap.getHeight()) / 2
                && y <= mBitmap.getHeight() + (appAreaRect.height() - MeasureUtil.getToolbarHeight(getContext()) - mBitmap.getHeight()) / 2) {
//        LightingColorFilter(0xFFFFFFFF, 0x00000000)的时候原图是不会有任何改变的,如果我们想增加红色的值,那么LightingColorFilter(0xFFFFFFFF, 0x00XX0000)就好,其中XX取值为00至FF。
//        那么这个方法有什么存在的意义呢?存在必定合理,这个方法存在一定是有它可用之处的,点击一个图片如何直接改变它的颜色而不是为他多准备另一张点击效果的图片
            if (mPaint.getColorFilter() == null) {
                mPaint.setColorFilter(new LightingColorFilter(0xffffffff, 0x00445566));
            } else {
                mPaint.setColorFilter(null);
            }
            invalidate();
        }

    }
Blur.java 文件源码 项目:shikimori 阅读 38 收藏 0 点赞 0 评论 0
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    private static void blur(Context context, Bitmap bkg, View view) {
        if(bkg==null)
            return;
        long startMs = System.currentTimeMillis();
        float scaleFactor = 8;
        float radius = 2;

        Bitmap overlay = Bitmap.createBitmap((int) (view.getMeasuredWidth()/scaleFactor),
                (int) (view.getMeasuredHeight()/scaleFactor), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(overlay);
        canvas.translate(-view.getLeft()/scaleFactor, -view.getTop()/scaleFactor);
        canvas.scale(1 / scaleFactor, 1 / scaleFactor);
        Paint paint = new Paint();
        ColorFilter filter = new LightingColorFilter(Color.parseColor("#666666"), 1);
//        paint.setFlags(Paint.FILTER_BITMAP_FLAG);
        paint.setColorFilter(filter);
        canvas.drawBitmap(bkg, 0, 0, paint);

        overlay = FastBlur.doBlur(overlay, (int)radius, true);
        view.setBackground(new BitmapDrawable(context.getResources(), overlay));

        playFade(view);

        Log.d("blur time", "" + (System.currentTimeMillis() - startMs) + "ms");
    }
DeckChildViewThumbnail.java 文件源码 项目:DeckView 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Updates the paint to draw the thumbnail.
 */
void updateThumbnailPaintFilter() {
    if (mInvisible) {
        return;
    }
    int mul = (int) ((1.0f - mDimAlpha) * mThumbnailAlpha * 255);
    int add = (int) ((1.0f - mDimAlpha) * (1 - mThumbnailAlpha) * 255);
    if (mBitmapShader != null) {
        mLightingColorFilter =
                new LightingColorFilter(Color.argb(255, mul, mul, mul),
                        Color.argb(0, add, add, add));
        mDrawPaint.setColorFilter(mLightingColorFilter);
        mDrawPaint.setColor(0xffffffff);
    } else {
        int grey = mul + add;
        mDrawPaint.setColorFilter(null);
        mDrawPaint.setColor(Color.argb(255, grey, grey, grey));
    }
    invalidate();
}
MyListView.java 文件源码 项目:BubbleCloudView 阅读 95 收藏 0 点赞 0 评论 0
/**
 * Calculates the lighting of the item based on rotation.
 * 
 * @param rotation The rotation of the item
 * @return A color filter to use
 */
private LightingColorFilter calculateLight(final float rotation) {
    final double cosRotation = Math.cos(Math.PI * rotation / 180);
    int intensity = AMBIENT_LIGHT + (int)(DIFFUSE_LIGHT * cosRotation);
    int highlightIntensity = (int)(SPECULAR_LIGHT * Math.pow(cosRotation, SHININESS));

    if (intensity > MAX_INTENSITY) {
        intensity = MAX_INTENSITY;
    }
    if (highlightIntensity > MAX_INTENSITY) {
        highlightIntensity = MAX_INTENSITY;
    }

    final int light = Color.rgb(intensity, intensity, intensity);
    final int highlight = Color.rgb(highlightIntensity, highlightIntensity, highlightIntensity);

    return new LightingColorFilter(light, highlight);
}
DragAndDropListener.java 文件源码 项目:AugmentedOxford 阅读 24 收藏 0 点赞 0 评论 0
private ImageView getImageView(View source, Activity activity,
        RelativeLayout c, LayoutParams params) {
    if (imageView == null) {
        final Bitmap bitmap = IO.loadBitmapFromView(source);
        final Paint shadowPaint = new Paint();
        shadowPaint.setAlpha(180);
        // http://stackoverflow.com/questions/7048941/how-to-use-the-lightingcolorfilter-to-make-the-image-form-dark-to-light
        shadowPaint.setColorFilter(new LightingColorFilter(0x11333333,
                0x00000000));

        imageView = new ImageView(activity) {

            @Override
            protected void onDraw(Canvas canvas) {
                // First draw shadow
                float dist = 2;
                canvas.drawBitmap(bitmap, dist, dist, shadowPaint);
                // then draw normal image view
                super.onDraw(canvas);
            }
        };
        imageView.setImageBitmap(bitmap);
        c.addView(imageView);
    }
    return imageView;
}
BlindsView.java 文件源码 项目:SimpleGlowLWP 阅读 27 收藏 0 点赞 0 评论 0
private LightingColorFilter calculateLight(float rotation) {
    rotation -= LIGHT_SOURCE_ANGLE;
    final double cosRotation = Math.cos(Math.PI * rotation / 180);
    int intensity = AMBIENT_LIGHT + (int) (DIFFUSE_LIGHT * cosRotation);
    int highlightIntensity = (int) (SPECULAR_LIGHT * Math.pow(cosRotation,
            SHININESS));

    if (intensity > MAX_INTENSITY) {
        intensity = MAX_INTENSITY;
    }
    if (highlightIntensity > MAX_INTENSITY) {
        highlightIntensity = MAX_INTENSITY;
    }

    final int light = Color.rgb(intensity, intensity, intensity);
    final int highlight = Color.rgb(highlightIntensity, highlightIntensity,
            highlightIntensity);

    return new LightingColorFilter(light, highlight);
}
WifiQrView.java 文件源码 项目:fdroidclient 阅读 46 收藏 0 点赞 0 评论 0
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    setUIFromWifi();

    ImageView qrImage = (ImageView) findViewById(R.id.wifi_qr_code);

    // Replace all blacks with the background blue.
    qrImage.setColorFilter(new LightingColorFilter(0xffffffff, getResources().getColor(R.color.swap_blue)));

    Button openQr = (Button) findViewById(R.id.btn_qr_scanner);
    openQr.setOnClickListener(new Button.OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().initiateQrScan();
        }
    });

    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(
            onWifiStateChanged, new IntentFilter(WifiStateChangeService.BROADCAST));
}
BitmapProcessing.java 文件源码 项目:Effects-Pro 阅读 52 收藏 0 点赞 0 评论 0
public static Bitmap tint(Bitmap src, int color) {
    // image size
    int width = src.getWidth();
    int height = src.getHeight();
    // create output bitmap

    // create a mutable empty bitmap
    Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());

    Paint p = new Paint(Color.RED);
    ColorFilter filter = new LightingColorFilter(color, 1);
    p.setColorFilter(filter);

    Canvas c = new Canvas();
    c.setBitmap(bmOut);     
    c.drawBitmap(src, 0, 0, p);

    src.recycle();
    src = null;

    return bmOut;
}
FourColorsImageView.java 文件源码 项目:android-graphics-demo 阅读 24 收藏 0 点赞 0 评论 0
private void createBitmap(Bitmap quarter) {
  bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);

  Paint paint = new Paint();

  // Top left
  paint.setColorFilter(new LightingColorFilter(Color.RED, 0));
  canvas.drawBitmap(quarter, 0, 0, paint);

  // Top right
  paint.setColorFilter(new LightingColorFilter(Color.YELLOW, 0));
  canvas.drawBitmap(quarter, getWidth() / 2, 0, paint);

  // Bottom left
  paint.setColorFilter(new LightingColorFilter(Color.BLUE, 0));
  canvas.drawBitmap(quarter, 0, getHeight()/2, paint);

  // Bottom right
  paint.setColorFilter(new LightingColorFilter(Color.GREEN, 0));
  canvas.drawBitmap(quarter, getWidth() / 2, getHeight() / 2, paint);
}
WebViewFrag.java 文件源码 项目:schoolapp 阅读 24 收藏 0 点赞 0 评论 0
public void setColors() {
    progressBar2 = (ProgressBarDeterminate)view.findViewById(R.id.progressBar2);
    if (Build.VERSION.SDK_INT >= 21) {
        progressBar = (ProgressBar)view.findViewById(R.id.progressBar1);
        if (Other.getColor2(getActivity(), 1).equals("005400")) {
            progressBar.getIndeterminateDrawable().setColorFilter(new LightingColorFilter(0xFF005400, 0xFF005400));
        } else {
            progressBar.getIndeterminateDrawable().setColorFilter(new LightingColorFilter(0xFF003061, 0xFF003061));
        }
    } else {
        progressBarCompat = (ProgressBarCircularIndeterminate)view.findViewById(R.id.progressBar1);
        progressBarCompat.setBackgroundColor(Color.parseColor("#ff" + Other.getColor2(getActivity(), 1)));
    }
    progressBar2.setBackgroundColor(Color.parseColor("#ff" + Other.getColor2(getActivity(), 1)));
    fabopen.setColorNormal(Color.parseColor("#" + Other.getColor2(getActivity(), 0)));
    fabopen.setColorPressed(Color.parseColor("#" + Other.getColor2(getActivity(), 1)));
    fabdownload.setColorNormal(Color.parseColor("#" + Other.getColor2(getActivity(), 0)));
    fabdownload.setColorPressed(Color.parseColor("#" + Other.getColor2(getActivity(), 1)));
}
MainActivity.java 文件源码 项目:schoolapp 阅读 24 收藏 0 点赞 0 评论 0
public static void setRefreshActionButtonState(final boolean refreshing, Activity activity) {
    if (optionsMenu != null && activity != null) {
        final MenuItem refreshItem = optionsMenu.findItem(R.id.menu_refresh);
        if (refreshItem != null) {
            if (refreshing) {
                LayoutInflater inflatere = activity.getLayoutInflater();
                View v = inflatere.inflate(R.layout.toolbar_progress, null);
                if (Build.VERSION.SDK_INT >= 21) {
                    ProgressBar refresh = (ProgressBar)v.findViewById(R.id.progressBar1);
                    refresh.getIndeterminateDrawable().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0xFFFFFFFF));
                }
                MenuItemCompat.setActionView(refreshItem, v);
            } else {
                MenuItemCompat.setActionView(refreshItem, null);
            }
        }
    }
}
DeleteDropZoneView.java 文件源码 项目:amar-android-demo 阅读 28 收藏 0 点赞 0 评论 0
public DeleteDropZoneView(Context context) {
    super(context);

    bounds = new Rect();

    textPaintStraight = createTextPaint();
    textPaintStraight.setColor(Color.WHITE);

    textPaintRed = createTextPaint();
    textPaintRed.setColor(Color.RED);

    bitmapPaint = createBaseBitmapPaint();

    bitmapPaintRed = createBaseBitmapPaint();
    ColorFilter filter = new LightingColorFilter(Color.RED, 1);
    bitmapPaintRed.setColorFilter(filter);

    setBackgroundColor(Color.BLACK);
    getBackground().setAlpha(200);
}
PhotoView.java 文件源码 项目:soas 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Generate label background and foreground colors using Palette base on downloaded image colors.
 *
 * @param bitmap Download bitmap.
 */
@Override
public void onBitmapChange(Bitmap bitmap) {
    if (bitmap == null) { return; }

    Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {
        @SuppressWarnings("deprecation")
        public void onGenerated(Palette palette) {
            Resources res = getResources();
            int photoNameColorBg = palette.getDarkMutedColor(res.getColor(R.color.list_item_photo_name_bg));
            int photoNameColorFg = palette.getLightMutedColor(res.getColor(R.color.view_photo_name_fg));

            ColorFilter photoNameColorFilter = new LightingColorFilter(photoNameColorBg, 1);
            Drawable photoNameDrawableBg = res.getDrawable(R.drawable.view_photo_name_bg);
            photoNameDrawableBg.setColorFilter(photoNameColorFilter);
            mPhotoName.setBackgroundDrawable(photoNameDrawableBg);

            mPhotoName.setTextColor(photoNameColorFg);
        }
    });
}
IMPopupDialog.java 文件源码 项目:OpenSudoku 阅读 29 收藏 0 点赞 0 评论 0
public void updateNumber(Integer number) {
    mSelectedNumber = number;

    LightingColorFilter selBkgColorFilter = new LightingColorFilter(
            mContext.getResources().getColor(R.color.im_number_button_selected_background), 0);

    for (Map.Entry<Integer, Button> entry : mNumberButtons.entrySet()) {
        Button b = entry.getValue();
        if (entry.getKey().equals(mSelectedNumber)) {
            b.setTextAppearance(mContext, android.R.style.TextAppearance_Large_Inverse);
            b.getBackground().setColorFilter(selBkgColorFilter);
        } else {
            b.setTextAppearance(mContext, android.R.style.TextAppearance_Widget_Button);
            b.getBackground().setColorFilter(null);
        }
    }
}
ListView3d.java 文件源码 项目:codeexamples-android 阅读 27 收藏 0 点赞 0 评论 0
private LightingColorFilter calculateLight(final float rotation) {
    final double cosRotation = Math.cos(Math.PI * rotation / 180);
    int intensity = AMBIENT_LIGHT + (int) (DIFFUSE_LIGHT * cosRotation);
    int highlightIntensity = (int) (SPECULAR_LIGHT * Math.pow(cosRotation,
            SHININESS));
    if (intensity > MAX_INTENSITY) {
        intensity = MAX_INTENSITY;
    }
    if (highlightIntensity > MAX_INTENSITY) {
        highlightIntensity = MAX_INTENSITY;
    }
    final int light = Color.rgb(intensity, intensity, intensity);
    final int highlight = Color.rgb(highlightIntensity, highlightIntensity,
            highlightIntensity);
    return new LightingColorFilter(light, highlight);
}
ListView3d.java 文件源码 项目:codeexamples-android 阅读 24 收藏 0 点赞 0 评论 0
private LightingColorFilter calculateLight(final float rotation) {
    final double cosRotation = Math.cos(Math.PI * rotation / 180);
    int intensity = AMBIENT_LIGHT + (int) (DIFFUSE_LIGHT * cosRotation);
    int highlightIntensity = (int) (SPECULAR_LIGHT * Math.pow(cosRotation,
            SHININESS));
    if (intensity > MAX_INTENSITY) {
        intensity = MAX_INTENSITY;
    }
    if (highlightIntensity > MAX_INTENSITY) {
        highlightIntensity = MAX_INTENSITY;
    }
    final int light = Color.rgb(intensity, intensity, intensity);
    final int highlight = Color.rgb(highlightIntensity, highlightIntensity,
            highlightIntensity);
    return new LightingColorFilter(light, highlight);
}
DragAndDropListener.java 文件源码 项目:droidar 阅读 29 收藏 0 点赞 0 评论 0
private ImageView getImageView(View source, Activity activity,
        RelativeLayout c, LayoutParams params) {
    if (imageView == null) {
        final Bitmap bitmap = IO.loadBitmapFromView(source);
        final Paint shadowPaint = new Paint();
        shadowPaint.setAlpha(180);
        // http://stackoverflow.com/questions/7048941/how-to-use-the-lightingcolorfilter-to-make-the-image-form-dark-to-light
        shadowPaint.setColorFilter(new LightingColorFilter(0x11333333,
                0x00000000));

        imageView = new ImageView(activity) {

            @Override
            protected void onDraw(Canvas canvas) {
                // First draw shadow
                float dist = 2;
                canvas.drawBitmap(bitmap, dist, dist, shadowPaint);
                // then draw normal image view
                super.onDraw(canvas);
            }
        };
        imageView.setImageBitmap(bitmap);
        c.addView(imageView);
    }
    return imageView;
}
NotificationStation.java 文件源码 项目:lineagex86 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
    logd("onCreate(%s)", savedInstanceState);
    super.onCreate(savedInstanceState);

    int colorPrimaryDark = getResources().getColor(R.color.theme_primary_dark);
    mFilter = new LightingColorFilter(colorPrimaryDark, colorPrimaryDark);
}
DoubleWavesShaderView.java 文件源码 项目:WavesView 阅读 25 收藏 0 点赞 0 评论 0
public Wave(View v, Bitmap b, int durationMillis, int color) {
    bitmap = b;
    shader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
    paint = new Paint();
    paint.setShader(shader);
    paint.setAntiAlias(true);
    matrix = new Matrix();
    durMillis = durationMillis;
    viewRef = new WeakReference<>(v);
    if (color != 0) {
        paint.setColorFilter(new LightingColorFilter(0X02FFFFFF, color));
    }
}
TintedBitmapDrawable.java 文件源码 项目:susi_android_v1 阅读 27 收藏 0 点赞 0 评论 0
@Override
public void draw(final Canvas canvas) {
    final Paint paint = getPaint();
    if (paint.getColorFilter() == null) {
        paint.setColorFilter(new LightingColorFilter(tint, 0));
        paint.setAlpha(alpha);
    }
    super.draw(canvas);
}
ColorLinearLayout.java 文件源码 项目:EasyTodo 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void onColorChanged(int color) {
    if (getBackground() != null
            && !(getBackground() instanceof ColorDrawable)) {
        getBackground().setColorFilter(new LightingColorFilter(color, 1));
    } else {
        setBackgroundColor(color);
    }
}
Utils.java 文件源码 项目:insapp-android 阅读 27 收藏 0 点赞 0 评论 0
public static Bitmap darkenBitmap(Bitmap bitmap) {
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint(Color.RED);
    ColorFilter filter = new LightingColorFilter(0xffbababa, 0x00000000);

    paint.setColorFilter(filter);
    canvas.drawBitmap(bitmap, new Matrix(), paint);

    return bitmap;
}


问题


面经


文章

微信
公众号

扫码关注公众号