1. #1
    Sencha User
    Join Date
    Aug 2007
    Posts
    11
    Vote Rating
    0
    rohitghatol is on a distinguished road

      0  

    Default Answered: DrawComponent drawing image using base64 encoded data

    Answered: DrawComponent drawing image using base64 encoded data


    Hi,

    I want to render an SVG using DrawComponent of GXT. In this SVG I want to show an Image as a background. The Image Data for this image will be send in base64 encoded manner from a rest ful service.

    For reference look at this svg its shown image using base 64 encoded data http://dev.w3.org/SVG/profiles/1.1F2...image-04-t.svg

    How to achieve this using DrawComponent? DrawComponent supports using ImageResource in addSprite, how to use Image instead. GWT Image can be loaded using image.setUrl("base64:data png.....").

    Cheers,
    Rohit

  2. Sven recently gave a good answer for this question in the premium forums:

    This is possible. Take a look at this example: http://www.sencha.com/examples/#ExamplePlace:basicdraw

    Y
    ou needto manually create an ImageResource/ImageResourcePrototype from it. The url is the data url of your image.

    How to achieve this using DrawComponent? DrawComponent supports using ImageResource in addSprite, how to use Image instead. GWT Image can be loaded using image.setUrl("base64:data png.....").
    Your manually created imageresource could return exactly this when asked for the url.

    Code:
              new ImageResource(){
    
                @Override
                public String getName() {
                  return "image";
                }
    
    
                @Override
                public int getHeight() {
                  return 16;
                }
    
    
                @Override
                public int getLeft() {
                  return 0;
                }
    
    
                @Override
                public SafeUri getSafeUri() {
                  return UriUtils.fromTrustedString("your image data url");
                }
    
    
                @Override
                public int getTop() {
                  return 0;
                }
    
    
                @Override
                public String getURL() {
                  return this.getSafeUri().asString();
                }
    
    
                @Override
                public int getWidth() {
                  return 16;
                }
    
    
                @Override
                public boolean isAnimated() {
                  return false;
                }
                
              };

  3. #2
    Sencha - GXT Dev Team BrendanC's Avatar
    Join Date
    Aug 2010
    Posts
    534
    Answers
    3
    Vote Rating
    3
    BrendanC is on a distinguished road

      0  

    Default


    Sven recently gave a good answer for this question in the premium forums:

    This is possible. Take a look at this example: http://www.sencha.com/examples/#ExamplePlace:basicdraw

    Y
    ou needto manually create an ImageResource/ImageResourcePrototype from it. The url is the data url of your image.

    How to achieve this using DrawComponent? DrawComponent supports using ImageResource in addSprite, how to use Image instead. GWT Image can be loaded using image.setUrl("base64:data png.....").
    Your manually created imageresource could return exactly this when asked for the url.

    Code:
              new ImageResource(){
    
                @Override
                public String getName() {
                  return "image";
                }
    
    
                @Override
                public int getHeight() {
                  return 16;
                }
    
    
                @Override
                public int getLeft() {
                  return 0;
                }
    
    
                @Override
                public SafeUri getSafeUri() {
                  return UriUtils.fromTrustedString("your image data url");
                }
    
    
                @Override
                public int getTop() {
                  return 0;
                }
    
    
                @Override
                public String getURL() {
                  return this.getSafeUri().asString();
                }
    
    
                @Override
                public int getWidth() {
                  return 16;
                }
    
    
                @Override
                public boolean isAnimated() {
                  return false;
                }
                
              };

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi