[gwt-contrib] Re: GWTCanvas and ImageBundle,
Jaime, If clipping is supported, then I believe you can get the required information from the Image interface: Image.getUrl() Image.getOriginalLeft() Image.getOriginalTop() Image.getHeight() Image.getWidth() With these methods, you should be able to construct a regular Image/ and then use the rectangle bounded by getOriginalLeft/Top/Height/Width as the clipping region. -Ray On Tue, Jan 20, 2009 at 2:19 PM, Jaime Yap wrote: > > Ray nailed it mostly. You can (as of 5 minutes ago) clip from a source > image in GWTCanvas. However, you will notice that GWTCanvas > drawImage() expects a regular ImageElement. > > ImageBundle uses background image slicing and other trickery that > varies by browser. You can do some magic to tease the underlying DOM > element out of an ImageBundle's AbstractImagePrototype for a specific > image, but you have no guarantee as to what exactly that DOM element > is. For example, on IE the DOM structure is totally different. > > What you could do is use GWTCanvas to clip out the actual image that > the ImageBundle generator spits out. But you would need to first get a > hold of it as a regular ImageElement which means knowing the URL to > the image and loading it. If I am not mistaken that file is named > according to its hash string (?), so you would need some means of > grabbing the URL of the generated ImageBundle image. > > So in other words, you can't use GWTCanvas with ImageBundles or > AbstractImagePrototype directly, BUT you can use it on an image that > has been bundled together. > > -Jaime > > On Tue, Jan 20, 2009 at 4:15 PM, Ray Cromwell > wrote: > > > > I don't think you can, at least not easily. To do this requires the > > drawImage() call which allows specifying the source rectangle. GWTCanvas > > doesn't support clipping either, so you can't set a rectangle path, and > clip > > the source image. This might be due to a limitation of IE/VML, I dunno, I > > try to stay away from VML. > > -Ray > > > > On Tue, Jan 20, 2009 at 1:00 PM, Axel Kittenberger > wrote: > >> > >> Can I (and if yes how) use ImageBundle images in GWTCanvas.drawImage > >> ()? > >> > >> Kind regards, > >> Axel > >> > > > > > > > > > > > > > --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: GWTCanvas and ImageBundle,
Ray nailed it mostly. You can (as of 5 minutes ago) clip from a source image in GWTCanvas. However, you will notice that GWTCanvas drawImage() expects a regular ImageElement. ImageBundle uses background image slicing and other trickery that varies by browser. You can do some magic to tease the underlying DOM element out of an ImageBundle's AbstractImagePrototype for a specific image, but you have no guarantee as to what exactly that DOM element is. For example, on IE the DOM structure is totally different. What you could do is use GWTCanvas to clip out the actual image that the ImageBundle generator spits out. But you would need to first get a hold of it as a regular ImageElement which means knowing the URL to the image and loading it. If I am not mistaken that file is named according to its hash string (?), so you would need some means of grabbing the URL of the generated ImageBundle image. So in other words, you can't use GWTCanvas with ImageBundles or AbstractImagePrototype directly, BUT you can use it on an image that has been bundled together. -Jaime On Tue, Jan 20, 2009 at 4:15 PM, Ray Cromwell wrote: > > I don't think you can, at least not easily. To do this requires the > drawImage() call which allows specifying the source rectangle. GWTCanvas > doesn't support clipping either, so you can't set a rectangle path, and clip > the source image. This might be due to a limitation of IE/VML, I dunno, I > try to stay away from VML. > -Ray > > On Tue, Jan 20, 2009 at 1:00 PM, Axel Kittenberger wrote: >> >> Can I (and if yes how) use ImageBundle images in GWTCanvas.drawImage >> ()? >> >> Kind regards, >> Axel >> > > > > > --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: GWTCanvas and ImageBundle,
Thanks Ray! I'll just do traditional ImagePrefetching then... ( I'm just experimenting with using the new Canvas object to do GWT based games. Say No to Flash! :-) Kind regards, Axel BTW: just realising I might have hit the wrong group, sorry about that. On Jan 20, 10:15 pm, Ray Cromwell wrote: > I don't think you can, at least not easily. To do this requires the > drawImage() call which allows specifying the source rectangle. GWTCanvas > doesn't support clipping either, so you can't set a rectangle path, and clip > the source image. This might be due to a limitation of IE/VML, I dunno, I > try to stay away from VML. > -Ray > > On Tue, Jan 20, 2009 at 1:00 PM, Axel Kittenberger wrote: > > > Can I (and if yes how) use ImageBundle images in GWTCanvas.drawImage > > ()? > > > Kind regards, > > Axel --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---
[gwt-contrib] Re: GWTCanvas and ImageBundle,
I don't think you can, at least not easily. To do this requires the drawImage() call which allows specifying the source rectangle. GWTCanvas doesn't support clipping either, so you can't set a rectangle path, and clip the source image. This might be due to a limitation of IE/VML, I dunno, I try to stay away from VML. -Ray On Tue, Jan 20, 2009 at 1:00 PM, Axel Kittenberger wrote: > > Can I (and if yes how) use ImageBundle images in GWTCanvas.drawImage > ()? > > Kind regards, > Axel > > > --~--~-~--~~~---~--~~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~--~~~~--~~--~--~---