Closed dankurka closed 9 years ago
Reported by scottb+legacy@google.com
on 2008-08-26 23:13:32
Please specify the browser(s) where you're seeing this problem, and a reproducing use
case. This is clearly not true in all circumstances, as the following code works fine:
TreeImages imgs = GWT.create(TreeImages.class);
Image img = imgs.treeClosed().createImage();
img.setVisibleRect(0, 0, 8, 8);
RootPanel.get().add(img);
Reported by jgw+personal@google.com
on 2008-08-27 13:20:38
CannotReproduce
In have not tried testing it in any real browsers yet given that I can't even get it
to work in the testing browser that came with GWT.
In my specific case, I have code like this for getting an image from an ImageBundle:
ControlImageBundle panelimages = (ControlImageBundle)
GWT.create(ControlImageBundle.class);
Image img = panelimages.images_toolbar().createImage();
Above, ControlImageBundle is a interface that extends ImageBunle. I then add the
image to the RootPanel, and then try to crop the image like so:
img.setVisibleRect(0, 0, 20, 20);
Unfortunately, instead of a cropped image, I get nothing. On the other hand, if I
don't use image bundle, and load the image individually with a new image and setURL,
and then attempt the same method for cropping, it works.
Image img = new Image();
img.setUrl("images/images_toolbar_icon.png");
RootPanel.get().add(img);
img.setVisibleRect(0, 0, 20, 20);
Reported by jacobtopper
on 2008-08-27 18:32:41
I might have found the source of the problem. The ControlImageBundle interface I was
using had five images in the bundle. The image I was trying to crop was the second
one. If I comment out the other 4, then I get a properly cropped image.
Reported by jacobtopper
on 2008-08-27 18:39:11
With some more tinkering, I realized that the first image in the bundle is taller
than the remaining four. Also, if I eliminate the first image, making all of the
images the same height, then when I use the setVisibleRect function, the cropped
portion of the image I see is always from the last image in the bundle, whereas if
I
don't crop, it displays the correct one.
Reported by jacobtopper
on 2008-08-27 18:49:03
I have included an Eclipse project which displays the behavior I am referring to. I
included the project itself is in a folder titled gwtdemo, as well as the library it
requries, gwt-majic.jar, and the documentation for the library just in case. I also
compiled the java to javascript before packaging the zip to test in a real browser.
In order to cause the error, once the project is running, click "Toggle Slide Left"
or "Toggle Blind Right".
Reported by jacobtopper
on 2008-10-28 02:59:48
I have a similar bug with my ImageBundle. I found that the problem is that
setVisibleRect is applied to the big image, which is created by the ImageBundle and
not to the image instance created with the method .createImage().
For example look at the attached image "imageBundle.png", which is created by
GWT.create(MyImageBundle.class). Now the original images text.png and scan.png (see
attachment), are 50x50 pixels big. Now when i call:
Image text = MyImageBundle.textImage().createImage();
text.setVisibleRect(0, 0, 50, 25);
Everything works fine, since the original text.png image is also the fist image in
the imageBundle.png. However, when I call:
Image scan = MyImageBundle.scanImage().createImage();
scan.setVisibleRect(0, 0, 50, 25);
I don't get the rect form the original scan.png image, but rather again the rect from
the text.png image, because its start coordinates in the imageBundle.png are 0,0.
Now when I call:
Image scan = MyImageBundle.scanImage().createImage();
scan.setVisibleRect(50, 0, 50, 25);
the rect from the original scan.png is displayed correctly, since its coordinates in
the imageBundle.png start at point 50,0. If I don't call scan.setVisibleRect(50, 0,
50, 25); at all, the whole original scan.png is displayed correctly.
To my oppinion this is defenitelly a major bug, which should be fixed soon.
Regards, Nikolay Georgiev
University of Wuerzburg, Germany
Reported by n.g.georgiev
on 2008-12-13 12:29:08
I don't know how bad the clip:rect css property is, but might I suggest that if this
bug gets fixed, that in the process setVisibleRect is changed to use clip:rect as it
has the ability to clip anything instead of just images. That way setVisibleRect can
be applied to widgets instead of just images. For my project at least,that would be
very very useful, notably because on older browsers the property is broken and only
works with no commas in between the rect arguments whereas newer browsers can do it
the correct way, with commas.
Reported by jacobtopper
on 2008-12-14 18:24:33
Originally reported on Google Code with ID 2814
Reported by
jacobtopper
on 2008-08-26 21:57:37