Jump to content

RGBImageFilter

- - - - -

  • Please log in to reply
5 replies to this topic

#1
PicklishDoorknob

PicklishDoorknob

    Learning Programmer

  • Members
  • PipPipPip
  • 86 posts
RGBImageFilter: How do I use it to turn white into transparent?

Got this so far :P
private class FilterClass extends RGBImageFilter {

		public int filterRGB(int arg0, int arg1, int arg2) {

			return 0;

		}

	}

(it's an inner class)

#2
PicklishDoorknob

PicklishDoorknob

    Learning Programmer

  • Members
  • PipPipPip
  • 86 posts
Need help quick please!

#3
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP
Second result from google.com:
Make a color transparent - Real's Java How-to

Pretty straightforward implementation.

#4
PicklishDoorknob

PicklishDoorknob

    Learning Programmer

  • Members
  • PipPipPip
  • 86 posts
Thanks!

However, I now cannot add the Image object to a JLabel and I can't cast it to an ImageIcon object. How do I work around this?

#5
lethalwire

lethalwire

    while(false){ ... }

  • Members
  • PipPipPipPipPipPipPip
  • 748 posts
  • Programming Language:Java, PHP
  • Learning:Java, PHP
Why would you cast it to an ImageIcon?

Look at the ImageIcon API and notice 1 of the constructors takes an Image object. ImageIcon (Java Platform SE 7 )

#6
PicklishDoorknob

PicklishDoorknob

    Learning Programmer

  • Members
  • PipPipPip
  • 86 posts
OH!
Well that should have been obvious.
Thanks!

---------- Post added at 05:09 PM ---------- Previous post was at 05:05 PM ----------

Wait. How can I make all of the white into a different color?

---------- Post added at 05:11 PM ---------- Previous post was at 05:09 PM ----------

Never mind.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users