You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Joseph Fan <jo...@gmail.com> on 2017/04/18 13:04:12 UTC

Re: How to have a RenderedDynamicImageResource with transparent background?

Hi Reinhard,

    I have met the same problem with you in your post in 2009 , I want to
know how you solved this problems. 
    I use the following statements to make the image looks transparent. but
unfortunately, the background is solid black, and hide the other background
image. 

add(new Image("dynamic", new RenderedDynamicImageResource(100, 100) {
			@Override
			protected boolean render(Graphics2D graphics, Attributes attrs) {
				// TODO Auto-generated method stub
				//setType(BufferedImage.TYPE_4BYTE_ABGR);
				graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR,
0.0f));
				Rectangle2D.Double rect = new Rectangle2D.Double(0, 0, 100, 100);
				graphics.fill(rect);
				graphics.setColor(Color.RED);
				graphics.drawString("测试", 10, 10);
				return true;
			}
		}));

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-have-a-RenderedDynamicImageResource-with-transparent-background-tp1843737p4677720.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org