Java Code Examples for android.graphics.ColorMatrix#setConcat()
The following examples show how to use
android.graphics.ColorMatrix#setConcat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SepiaToneTiles.java From osmdroid with Apache License 2.0 | 6 votes |
@Override public void addOverlays(){ super.addOverlays(); final ColorMatrix matrixA = new ColorMatrix(); // making image B&W matrixA.setSaturation(0); final ColorMatrix matrixB = new ColorMatrix(); // applying scales for RGB color values matrixB.setScale(1f, .95f, .82f, 1.0f); matrixA.setConcat(matrixB, matrixA); final ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrixA); mMapView.getOverlayManager().getTilesOverlay().setColorFilter(filter); }
Example 2
Source File: FoldingLayoutActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.folding_drawer_activity_fold); mImageView = (ImageView) findViewById(R.id.image_view); mImageView.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING); mImageView.setScaleType(ImageView.ScaleType.FIT_XY); mImageView.setImageDrawable(getResources() .getDrawable(R.drawable.test)); if (IS_ISC) { //mTextureView = new TextureView(this); //mTextureView.setSurfaceTextureListener(mSurfaceTextureListener); } mAnchorSeekBar = (SeekBar) findViewById(R.id.anchor_seek_bar); mFoldLayout = (FoldingLayout) findViewById(R.id.fold_view); mFoldLayout.setFoldListener(mOnFoldListener); mAnchorSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener); mItemSelectedListener = new ItemSelectedListener(); mDefaultPaint = new Paint(); mSepiaPaint = new Paint(); ColorMatrix m1 = new ColorMatrix(); ColorMatrix m2 = new ColorMatrix(); m1.setSaturation(0); m2.setScale(1f, .95f, .82f, 1.0f); m1.setConcat(m2, m1); mSepiaPaint.setColorFilter(new ColorMatrixColorFilter(m1)); mFoldLayout.setNumberOfFolds(mNumberOfFolds); }
Example 3
Source File: FoldingLayoutActivity.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.folding_drawer_activity_fold); mImageView = (ImageView) findViewById(R.id.image_view); mImageView.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING); mImageView.setScaleType(ImageView.ScaleType.FIT_XY); mImageView.setImageDrawable(getResources() .getDrawable(R.drawable.test)); if (IS_ISC) { //mTextureView = new TextureView(this); //mTextureView.setSurfaceTextureListener(mSurfaceTextureListener); } mAnchorSeekBar = (SeekBar) findViewById(R.id.anchor_seek_bar); mFoldLayout = (FoldingLayout) findViewById(R.id.fold_view); mFoldLayout.setFoldListener(mOnFoldListener); mAnchorSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener); mItemSelectedListener = new ItemSelectedListener(); mDefaultPaint = new Paint(); mSepiaPaint = new Paint(); ColorMatrix m1 = new ColorMatrix(); ColorMatrix m2 = new ColorMatrix(); m1.setSaturation(0); m2.setScale(1f, .95f, .82f, 1.0f); m1.setConcat(m2, m1); mSepiaPaint.setColorFilter(new ColorMatrixColorFilter(m1)); mFoldLayout.setNumberOfFolds(mNumberOfFolds); }
Example 4
Source File: FoldingLayoutActivity.java From FoldingLayout with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fold); mImageView = (ImageView)findViewById(R.id.image_view); mImageView.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING); mImageView.setScaleType(ImageView.ScaleType.FIT_XY); mImageView.setImageDrawable(getResources().getDrawable(R.drawable.image)); mTextureView = new TextureView(this); mTextureView.setSurfaceTextureListener(mSurfaceTextureListener); mAnchorSeekBar = (SeekBar)findViewById(R.id.anchor_seek_bar); mFoldLayout = (FoldingLayout)findViewById(R.id.fold_view); mFoldLayout.setBackgroundColor(Color.BLACK); mFoldLayout.setFoldListener(mOnFoldListener); mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop(); mAnchorSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener); mScrollGestureDetector = new GestureDetector(this, new ScrollGestureDetector()); mItemSelectedListener = new ItemSelectedListener(); mDefaultPaint = new Paint(); mSepiaPaint = new Paint(); ColorMatrix m1 = new ColorMatrix(); ColorMatrix m2 = new ColorMatrix(); m1.setSaturation(0); m2.setScale(1f, .95f, .82f, 1.0f); m1.setConcat(m2, m1); mSepiaPaint.setColorFilter(new ColorMatrixColorFilter(m1)); }
Example 5
Source File: FoldingLayoutActivity.java From Folding-Android with Apache License 2.0 | 5 votes |
@SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fold); mImageView = (ImageView) findViewById(R.id.image_view); mImageView.setPadding(ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING, ANTIALIAS_PADDING); mImageView.setScaleType(ImageView.ScaleType.FIT_XY); mImageView.setImageDrawable(getResources() .getDrawable(R.drawable.image)); if (IS_ISC) { //mTextureView = new TextureView(this); //mTextureView.setSurfaceTextureListener(mSurfaceTextureListener); } mAnchorSeekBar = (SeekBar) findViewById(R.id.anchor_seek_bar); mFoldLayout = (FoldingLayout) findViewById(R.id.fold_view); mFoldLayout.setFoldListener(mOnFoldListener); mAnchorSeekBar.setOnSeekBarChangeListener(mSeekBarChangeListener); mItemSelectedListener = new ItemSelectedListener(); mDefaultPaint = new Paint(); mSepiaPaint = new Paint(); ColorMatrix m1 = new ColorMatrix(); ColorMatrix m2 = new ColorMatrix(); m1.setSaturation(0); m2.setScale(1f, .95f, .82f, 1.0f); m1.setConcat(m2, m1); mSepiaPaint.setColorFilter(new ColorMatrixColorFilter(m1)); }
Example 6
Source File: LightningView.java From browser with GNU General Public License v2.0 | 4 votes |
public void setColorMode(int mode) { mInvertPage = false; switch (mode) { case 0: mPaint.setColorFilter(null); //setSoftwareRendering(); // Some devices get segfaults // in the WebView with Hardware Acceleration enabled, // the only fix is to disable hardware rendering //setNormalRendering(); setHardwareRendering(); mInvertPage = false; break; case 1: ColorMatrixColorFilter filterInvert = new ColorMatrixColorFilter( mNegativeColorArray); mPaint.setColorFilter(filterInvert); setHardwareRendering(); mInvertPage = true; break; case 2: ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); ColorMatrixColorFilter filterGray = new ColorMatrixColorFilter(cm); mPaint.setColorFilter(filterGray); setHardwareRendering(); break; case 3: ColorMatrix matrix = new ColorMatrix(); matrix.set(mNegativeColorArray); ColorMatrix matrixGray = new ColorMatrix(); matrixGray.setSaturation(0); ColorMatrix concat = new ColorMatrix(); concat.setConcat(matrix, matrixGray); ColorMatrixColorFilter filterInvertGray = new ColorMatrixColorFilter(concat); mPaint.setColorFilter(filterInvertGray); setHardwareRendering(); mInvertPage = true; break; } }
Example 7
Source File: LightningView.java From Xndroid with GNU General Public License v3.0 | 4 votes |
/** * Sets the current rendering color of the WebView instance * of the current LightningView. The for modes are normal * rendering (0), inverted rendering (1), grayscale rendering (2), * and inverted grayscale rendering (3) * * @param mode the integer mode to set as the rendering mode. * see the numbers in documentation above for the * values this method accepts. */ private void setColorMode(int mode) { mInvertPage = false; switch (mode) { case 0: mPaint.setColorFilter(null); // setSoftwareRendering(); // Some devices get segfaults // in the WebView with Hardware Acceleration enabled, // the only fix is to disable hardware rendering setNormalRendering(); mInvertPage = false; break; case 1: ColorMatrixColorFilter filterInvert = new ColorMatrixColorFilter( sNegativeColorArray); mPaint.setColorFilter(filterInvert); setHardwareRendering(); mInvertPage = true; break; case 2: ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); ColorMatrixColorFilter filterGray = new ColorMatrixColorFilter(cm); mPaint.setColorFilter(filterGray); setHardwareRendering(); break; case 3: ColorMatrix matrix = new ColorMatrix(); matrix.set(sNegativeColorArray); ColorMatrix matrixGray = new ColorMatrix(); matrixGray.setSaturation(0); ColorMatrix concat = new ColorMatrix(); concat.setConcat(matrix, matrixGray); ColorMatrixColorFilter filterInvertGray = new ColorMatrixColorFilter(concat); mPaint.setColorFilter(filterInvertGray); setHardwareRendering(); mInvertPage = true; break; case 4: ColorMatrixColorFilter IncreaseHighContrast = new ColorMatrixColorFilter( sIncreaseContrastColorArray); mPaint.setColorFilter(IncreaseHighContrast); setHardwareRendering(); break; } }
Example 8
Source File: LightningView.java From JumpGo with Mozilla Public License 2.0 | 4 votes |
/** * Sets the current rendering color of the WebView instance * of the current LightningView. The for modes are normal * rendering (0), inverted rendering (1), grayscale rendering (2), * and inverted grayscale rendering (3) * * @param mode the integer mode to set as the rendering mode. * see the numbers in documentation above for the * values this method accepts. */ private void setColorMode(int mode) { mInvertPage = false; switch (mode) { case 0: mPaint.setColorFilter(null); // setSoftwareRendering(); // Some devices get segfaults // in the WebView with Hardware Acceleration enabled, // the only fix is to disable hardware rendering setNormalRendering(); mInvertPage = false; break; case 1: ColorMatrixColorFilter filterInvert = new ColorMatrixColorFilter( sNegativeColorArray); mPaint.setColorFilter(filterInvert); setHardwareRendering(); mInvertPage = true; break; case 2: ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); ColorMatrixColorFilter filterGray = new ColorMatrixColorFilter(cm); mPaint.setColorFilter(filterGray); setHardwareRendering(); break; case 3: ColorMatrix matrix = new ColorMatrix(); matrix.set(sNegativeColorArray); ColorMatrix matrixGray = new ColorMatrix(); matrixGray.setSaturation(0); ColorMatrix concat = new ColorMatrix(); concat.setConcat(matrix, matrixGray); ColorMatrixColorFilter filterInvertGray = new ColorMatrixColorFilter(concat); mPaint.setColorFilter(filterInvertGray); setHardwareRendering(); mInvertPage = true; break; case 4: ColorMatrixColorFilter IncreaseHighContrast = new ColorMatrixColorFilter( sIncreaseContrastColorArray); mPaint.setColorFilter(IncreaseHighContrast); setHardwareRendering(); break; } }