GWT客户端图像裁剪和调整大小 [英] GWT client-side image crop and resize

查看:91
本文介绍了GWT客户端图像裁剪和调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何GWT小部件允许我: b
$ b


  • 选择图像的一部分,然后检索选择区域

    li>
  • 调整图片大小,然后给我更新的大小?



以上内容应体现在浏览器也是如此。

解决方案

据我所知,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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆