Example usage for com.google.gwt.canvas.dom.client Context2d createPattern

List of usage examples for com.google.gwt.canvas.dom.client Context2d createPattern

Introduction

In this page you can find the example usage for com.google.gwt.canvas.dom.client Context2d createPattern.

Prototype

public final native CanvasPattern createPattern(ImageElement image, String repetition) ;

Source Link

Document

Creates a pattern from an image.

Usage

From source file:playn.html.HtmlPattern.java

License:Apache License

public CanvasPattern pattern(Context2d ctx, boolean repeatX, boolean repeatY) {
    Context2d.Repetition repeat;//from   ww  w. ja  v  a2  s . c o m
    if (repeatX) {
        if (repeatY) {
            repeat = Context2d.Repetition.REPEAT;
        } else {
            repeat = Context2d.Repetition.REPEAT_X;
        }
    } else if (repeatY) {
        repeat = Context2d.Repetition.REPEAT_Y;
    } else {
        return null;
    }
    return ctx.createPattern(patimg, repeat);
}