开发者

JavaFX embed panel into scene with scene's background

Although it is hard to explain, I am writting to find a solution. I added a panel to开发者_StackOverflow中文版 scene which has a background image. But also, I want that panel to grab the part of background picture where it is placed. When I move that panel on runtime, it should move with its background picture part (like selecting part of a picture and dragging in paint). Is it possible?

Thanks in advance (I am sorry for my bad english)


You would have to use another ImageView on the Panel using the same Image used for the Scene background. Then you could set the viewport on the Panel's ImageView to match the area from the Scene's ImageView.


Yes I solved the problem with same way.

var bufferedImage = new BufferedImage( scene.width, scene.height, BufferedImage.TYPE_INT_RGB );
scene.renderToImage( bufferedImage );
bufferedImage=bufferedImage.getSubimage(panel.layoutX,panel.layoutY,x,y);

with code above, it is possible to get screenshot and its parts.

Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜