开发者

Using mozImageSmoothingEnabled by the help of JSNI in GWT

Gecko 1.9.2 introduced the mozImageSmoothingEnabled property to the canvas element; if this Boolean value is false, images won't be smoothed when scaled. This propert开发者_开发百科y is true by default.

 ctx.mozImageSmoothingEnabled = false

I want to use this property in GWT. How can I implement

 public static void setMozImageSmooting(Canvas canvas, boolean value)
 {
    ...
 }

by using JSNI?


Well I haven't tried it, but I assume, you should first get the Context in Java:

Context ctx = canvas.getContext2d();
setMozImageSmooting(ctx, false);

Then implement

 public static native void setMozImageSmooting(Context ctx, boolean value) /*-{
    ctx.mozImageSmoothingEnabled = value;
 }-*/;

(Feel free to correct this answer, if it contains errors, because I can't test it right now.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜