Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    PNG Image on IE a problem.

    When I add the below code to a VLayout it works fine on Chrome and Firefox, but the image comes out very small on IE? If I take the

    logoImg.setImageType(ImageStyle.CENTER);

    it works but the image size and sharpness are then incorrect. Any quick ways to get around this on IE?

    Code:
    String image = "../../images/foo.png";
    Img logoImg = new Img(image);
    logoImg.setImageType(ImageStyle.CENTER);

    #2
    It's caused by the PNG workaround necessary for alpha channel support in IE (IE cannot support showing images in their "natural" size when this workaround is active). One way around it is to simply make an <img> tag in an HTMLFlow. We're also adding a flag to turn off the PNG workaround when you don't need transparency.

    Comment


      #3
      Hi,

      I've tried to turn off the PNG workaround by putting the following snippet at the start of my EntryPoint class on the onModuleLoad method:
      Code:
      		/*-{
      		isc.Canvas.addClassProperties({neverUsePNGWorkaround:true});
      		}-*/;
      I've also tried:
      Code:
      		/*-{
      		isc.Canvas.addProperties({neverUsePNGWorkaround:true});
      		}-*/;
      I cannot add it to individual canvases since I'm trying to solve it for a TileGrid.
      I'm running SmartGWT 2.2 on IE8.

      Thanks
      -Gabriel

      Comment


        #4
        Use $wnd.isc

        Comment


          #5
          The following worked like a charm:
          Code:
          ...
          	setInitialAttributes();
          ...
          	native void setInitialAttributes() /*-{
          			$wnd.isc.Canvas.addProperties({neverUsePNGWorkaround:true});
          			$wnd.isc.Canvas.addClassProperties({neverUsePNGWorkaround:true});
          	}-*/;
          
          ...

          Comment


            #6
            You could also try

            Code:
            Canvas canvasPrototype = new Canvas() {{
               setAttribute("neverUsePNGWorkaround", true, false);
            }};
            
            Canvas.setDefaultProperties(canvasPrototype);
            Every subsequent instance of Canvas will now have this as the default value.

            Comment

            Working...
            X