List of usage examples for android.graphics ColorMatrix ColorMatrix
public ColorMatrix()
From source file:com.zhoumushui.zygoteelastichome.view.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setLayerType(LAYER_TYPE_HARDWARE, null);//? // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }//from w ww .ja v a 2 s .c om mBorderDrawable = a.getDrawable(styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xffff0000); mBlackPaint.setAntiAlias(true); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); mMaskedPaint.setAntiAlias(true); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:com.odoo.followup.orm.widgets.BezelImageView.java
private void otherInit() { // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000);//from ww w . java 2s .c o m mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:de.persoapp.android.activity.fragment.InitializeAppFragment.java
@SuppressWarnings("ConstantConditions") @Override/*from w w w. jav a2 s . co m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_initialize_app, container, false); mImageView = (ImageView) view.findViewById(R.id.imageView); mSaturation = 0; mColorMatrix = new ColorMatrix(); mColorMatrix.setSaturation(mSaturation); mImageView.setColorFilter(new ColorMatrixColorFilter(mColorMatrix)); view.setFilterTouchesWhenObscured(true); return view; }
From source file:com.retropoktan.rptrello.widget.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization. final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }/*from w w w. ja va2s . com*/ mBorderDrawable = a.getDrawable(R.styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); mSetOutline = a.getBoolean(R.styleable.BezelImageView_setOutline, mSetOutline); a.recycle(); // Other initialization. mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:org.sfx.catholicjourney.core.view.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_biv_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }//from w ww . ja v a 2 s . c o m mSelectorColor = a.getColor(R.styleable.BezelImageView_biv_selectorOnPress, 0); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); //create a selectorFilter if we already have a color if (mSelectorColor != 0) { this.mSelectorFilter = new PorterDuffColorFilter(Color.argb(mSelectorAlpha, Color.red(mSelectorColor), Color.green(mSelectorColor), Color.blue(mSelectorColor)), PorterDuff.Mode.SRC_ATOP); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addElevationSupport(); } }
From source file:com.popdeem.sdk.uikit.widget.PDUIBezelImageView.java
public PDUIBezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, 0); mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }//from w w w .j a v a2 s . co m mBorderDrawable = a.getDrawable(R.styleable.BezelImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(R.styleable.BezelImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:com.visenze.visearch.camerademo.views.RoundImageView.java
public RoundImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setLayerType(LAYER_TYPE_HARDWARE, null); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, styleable.RoundImageView, defStyle, 0); mMaskDrawable = a.getDrawable(styleable.RoundImageView_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }/* w w w. j av a 2s . co m*/ mBorderDrawable = a.getDrawable(styleable.RoundImageView_borderDrawable); if (mBorderDrawable != null) { mBorderDrawable.setCallback(this); } mDesaturateOnPress = a.getBoolean(styleable.RoundImageView_desaturateOnPress, mDesaturateOnPress); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xffff0000); mBlackPaint.setAntiAlias(true); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); mMaskedPaint.setAntiAlias(true); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); if (mDesaturateOnPress) { // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); } }
From source file:com.cnh.library.materialdrawer.view.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BezelImageView, defStyle, R.style.BezelImageView);/*w w w . ja v a 2s . c o m*/ mMaskDrawable = a.getDrawable(R.styleable.BezelImageView_biv_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); } mDrawCircularShadow = a.getBoolean(R.styleable.BezelImageView_biv_drawCircularShadow, true); mSelectorColor = a.getColor(R.styleable.BezelImageView_biv_selectorOnPress, 0); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); //create a selectorFilter if we already have a color if (mSelectorColor != 0) { this.mSelectorFilter = new PorterDuffColorFilter(Color.argb(mSelectorAlpha, Color.red(mSelectorColor), Color.green(mSelectorColor), Color.blue(mSelectorColor)), PorterDuff.Mode.SRC_ATOP); } }
From source file:hu.py82c7.homework.view.BezelImageView.java
public BezelImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Attribute initialization final TypedArray a = context.obtainStyledAttributes(attrs, hu.py82c7.homework.R.styleable.BezelImageView, defStyle, hu.py82c7.homework.R.style.BezelImageView); mMaskDrawable = a.getDrawable(hu.py82c7.homework.R.styleable.BezelImageView_biv_maskDrawable); if (mMaskDrawable != null) { mMaskDrawable.setCallback(this); }/* w w w . jav a2 s .c o m*/ mDrawCircularShadow = a.getBoolean(hu.py82c7.homework.R.styleable.BezelImageView_biv_drawCircularShadow, true); mSelectorColor = a.getColor(hu.py82c7.homework.R.styleable.BezelImageView_biv_selectorOnPress, 0); a.recycle(); // Other initialization mBlackPaint = new Paint(); mBlackPaint.setColor(0xff000000); mMaskedPaint = new Paint(); mMaskedPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); // Always want a cache allocated. mCacheBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); // Create a desaturate color filter for pressed state. ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); mDesaturateColorFilter = new ColorMatrixColorFilter(cm); //create a selectorFilter if we already have a color if (mSelectorColor != 0) { this.mSelectorFilter = new PorterDuffColorFilter(Color.argb(mSelectorAlpha, Color.red(mSelectorColor), Color.green(mSelectorColor), Color.blue(mSelectorColor)), PorterDuff.Mode.SRC_ATOP); } }
From source file:com.me.harris.listviewitemanimations._01_activityAnim.ActivityAnimations.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_animations); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*www .j a va2 s . c o m*/ getSupportActionBar().setTitle(""); handleStatusBar(); // Grayscale filter used on all thumbnails ColorMatrix grayMatrix = new ColorMatrix(); grayMatrix.setSaturation(0); ColorMatrixColorFilter grayscaleFilter = new ColorMatrixColorFilter(grayMatrix); mGridLayout = (GridLayout) findViewById(R.id.gridLayout); mGridLayout.setColumnCount(3); mGridLayout.setUseDefaultMargins(true); // add all photo thumbnails to layout Resources resources = getResources(); ArrayList<PictureData> pictures = mBitmapUtils.loadPhotos(resources); for (int i = 0; i < pictures.size(); ++i) { PictureData pictureData = pictures.get(i); BitmapDrawable thumbnailDrawable = new BitmapDrawable(resources, pictureData.thumbnail); thumbnailDrawable.setColorFilter(grayscaleFilter); ImageView imageView = new ImageView(this); imageView.setOnClickListener(thumbnailClickListener); imageView.setImageDrawable(thumbnailDrawable); mPicturesData.put(imageView, pictureData); mGridLayout.addView(imageView); } }