LightingColorFilter example - Blog Android

Friday, 14 September 2012

LightingColorFilter example

android.graphics.LightingColorFilter is a colorfilter that multiplies the RGB channels by one color, and then adds a second color, pinning the result for each component to [0..255].

LightingColorFilter example


Modify onDraw() method of MyView.java in the post "Example of using ColorMatrixColorFilter".
 @Override
protected void onDraw(Canvas canvas) {

int mul = 0xFFFFFF00; //remove BLUE component
int add = 0x0000FF00; //set GREEN full
LightingColorFilter lightingColorFilter = new LightingColorFilter(mul, add);

Paint MyPaint_Normal = new Paint();
Paint MyPaint_Lighting = new Paint();
MyPaint_Lighting.setColorFilter(lightingColorFilter);

Bitmap myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
canvas.drawBitmap(myBitmap, 400, 100, MyPaint_Normal);
canvas.drawBitmap(myBitmap, 500, 100, MyPaint_Lighting);

};


download filesDownload the files.

Related:
- Adjust lightness and darkness of ImageView, using LightingColorFilter.

Borneo08

About Borneo08

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :

More links

Related Posts Plugin for WordPress, Blogger...