Saturday, November 24, 2012

Re: Get an attribute from a GWT object via jsni?

that should work... What is the result ?

On Saturday, November 24, 2012 1:05:28 PM UTC-2, markww wrote:
Hi,

I'm using Canvas, I need to get a property from the context:

    context.webkitBackingStorePixelRatio;

I'm not sure how to make a jsni function to do this (this property does not seem to have a wrapper already in the gwt Context2d class):

    // How do we define this function and pass in our GWT Context2d instance?
    public static native double getBackingStoreRatio(Context2d context) /*-{
        return context.webkitBackingStorePixelRatio || 1;
    }-*/;

    Canvas canvas = Canvas.createIfSupported();
    Context2d context = canvas.getContext2d();
    double isThatRight = getBackingStoreRation(context);

Yeah I'm not sure what the sytax is for this, the Context2d variable is a GWT object already,

Thanks

(trying to get the variables from this article for hdpi screen support)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/SwwZsbfkhYoJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate