0

Is there any way to create gwt.Image from String. I've not found anything. Pls help

dimas
  • 387
  • 3
  • 9
  • Do you mean that you want to render the text on an image? Or have some kind of drawing commands in the string, such as "box-10x50@100,100circle50@80,80"? – Roger Lindsjö Dec 15 '11 at 15:15
  • Yes, I want to set text inside image. It's something like CAPTHCA, but the last one doesn't fit me. – dimas Dec 15 '11 at 15:35

1 Answers1

0

This is not GWT question but more like HTML=) Normally browsers doesn't allow you to generate an image. The only exception is Canvas which is supported in IE9+ and all other browser. This thing allows you to draw anything. But if you have users with IE6-IE8 they wan't be able to see canvas. So you have multiple options:

  1. Generate images using Canvas (IE6-IE8 doesn't support this, but it has different API VML, but there is no binding for it by default GWT you'll have to find it or create by yourself)
  2. Generate image on server side (works everywhere but it is really slow)
  3. Use Flash plugin to draw images (almost works almost everywhere, but you will face certain problems)
  4. Try some other way to achieve the same effect(f.e. if you doing something like captcha, you can create a sprite map with letters, than you simply build a DOM element for each character in text and use correct sprite from sprite map for each element)
jusio
  • 9,850
  • 1
  • 42
  • 57