ColorFilter to remove image backgrounds

Put your problem here if it does not fit any of the other categories.

ColorFilter to remove image backgrounds

Postby wfsaxton » Tue Mar 03, 2009 1:45 am

Hi all. Noob android programmer here!

I have some 2d character sprites that I would like to remove the background from...I was wondering if I could use the ColorFilter to do this.

Here is my first attempt:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Drawable d = mContext.getResources().getDrawable(R.drawable.queen);
  3. d.setColorFilter(Color.parseColor("#585C38"), PorterDuff.Mode.DST_IN);
  5. d.setBounds(0, 0, 100, 100);
  7. d.draw(canvas);
Parsed in 0.011 seconds, using GeSHi

But doesn't look like it does anything. I've tried all the other PorterDuff modes and they either show the image or the color, but they never look like they are "filtering" anything.

Any ideas?
Posts: 3
Joined: Tue Mar 03, 2009 1:18 am


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 8 guests