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


Java LightingColorFilter类代码示例

本文整理汇总了Java中android.graphics.LightingColorFilter的典型用法代码示例。如果您正苦于以下问题:Java LightingColorFilter类的具体用法?Java LightingColorFilter怎么用?Java LightingColorFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onFinishInflate

import android.graphics.LightingColorFilter; //导入依赖的package包/类
@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));
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:22,代码来源:WifiQrView.java

示例2: setButton

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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);
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:17,代码来源:OverlayNotificationBarView.java

示例3: initDrawingObjects

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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);
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:23,代码来源:BlockView.java

示例4: changeUIColor

import android.graphics.LightingColorFilter; //导入依赖的package包/类
@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);

}
 
开发者ID:vojta-horanek,项目名称:APKMirror,代码行数:23,代码来源:MainActivity.java

示例5: captureView

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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;
}
 
开发者ID:alphamu,项目名称:FrostyBackgroundTestApp,代码行数:21,代码来源:ScrollingActivity.java

示例6: captureView

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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;
}
 
开发者ID:alphamu,项目名称:FrostyBackgroundTestApp,代码行数:27,代码来源:CardViewActivity.java

示例7: onDraw

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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);
}
 
开发者ID:luhaoaimama1,项目名称:zone-sdk,代码行数:20,代码来源:LightingColorFilterView.java

示例8: onClick

import android.graphics.LightingColorFilter; //导入依赖的package包/类
@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();
        }

    }
 
开发者ID:oubowu,项目名称:AndroidExerciseProgram,代码行数:18,代码来源:LightingColorCustomView.java

示例9: blur

import android.graphics.LightingColorFilter; //导入依赖的package包/类
@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");
    }
 
开发者ID:LeshiyGS,项目名称:shikimori,代码行数:27,代码来源:Blur.java

示例10: updateThumbnailPaintFilter

import android.graphics.LightingColorFilter; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:jzhu1224,项目名称:DeckView,代码行数:23,代码来源:DeckChildViewThumbnail.java

示例11: calculateLight

import android.graphics.LightingColorFilter; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:dodola,项目名称:BubbleCloudView,代码行数:24,代码来源:MyListView.java

示例12: getImageView

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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;
}
 
开发者ID:pnosalik,项目名称:AugmentedOxford,代码行数:27,代码来源:DragAndDropListener.java

示例13: calculateLight

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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);
}
 
开发者ID:sahaab,项目名称:SimpleGlowLWP,代码行数:21,代码来源:BlindsView.java

示例14: tint

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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;
}
 
开发者ID:yaa110,项目名称:Effects-Pro,代码行数:23,代码来源:BitmapProcessing.java

示例15: createBitmap

import android.graphics.LightingColorFilter; //导入依赖的package包/类
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);
}
 
开发者ID:chiuki,项目名称:android-graphics-demo,代码行数:23,代码来源:FourColorsImageView.java


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