GWT客户端图像裁剪和调整大小 [英] GWT client-side image crop and resize
问题描述
是否有任何GWT小部件允许我: b
$ b
以上内容应体现在浏览器也是如此。
据我所知,GWT客户端代码不能直接修改图片,但Image widget可以被设置为仅显示图像的一部分。您可以使用构造函数 图像(java.lang.String url,int left,int top ,int width,int height)
,其中 width
和 height
是可见框,而不是图像本身。
然而,这不允许您调整大小然后裁剪。为了做到这一点,您可以首先调整图像大小,然后将其放在绝对面板中裁剪。
AbsolutePanel testPanel = new AbsolutePanel();
Image image = new Image(path / image.jpg);
image.setWidth(1000px);
testPanel.add(image,-100,-100);
testPanel.setPixelSize(300,300);
我很抱歉,如果这不是您要查找的内容,但这是最好的答案。有。
Is there any GWT widget which allows me to:
- select a part of an image and then retrieve the selection area?
- resize an image and then give me the updated size?
The above should be reflected in the browser as well.
As far as I know, GWT client-side code cannot directly modify images, but the Image widget can be set to display only a portion of an image. You can do this using the constructor Image(java.lang.String url, int left, int top, int width, int height)
, where width
and height
are the dimensions of the visible box and not the image itself.
However this does not allow you to resize and then crop. In order to do this you could first resize the image then put it in an absolute panel to crop it.
AbsolutePanel testPanel = new AbsolutePanel();
Image image = new Image("path/image.jpg");
image.setWidth("1000px");
testPanel.add(image,-100,-100);
testPanel.setPixelSize(300,300);
I apologize if this isn't exactly what you're looking for, but it's the best answer I have.
这篇关于GWT客户端图像裁剪和调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!