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);
  2.  
  3. d.setColorFilter(Color.parseColor("#585C38"), PorterDuff.Mode.DST_IN);
  4.  
  5. d.setBounds(0, 0, 100, 100);
  6.  
  7. d.draw(canvas);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


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?
wfsaxton
Freshman
Freshman
 
Posts: 3
Joined: Tue Mar 03, 2009 1:18 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 14 guests