Package playn.core

Examples of playn.core.CanvasImage


        value.update(r.min + pos);
    }

    protected static Icon createDefaultThumbImage () {
        float size = 24;
        CanvasImage image = graphics().createImage(size, size);
        image.canvas().setFillColor(0xFF000000);
        image.canvas().fillCircle(size/2, size/2, size/2-1);
        return Icons.image(image);
    }
View Full Code Here


    /**
     * Creates a solid square icon of the given size.
     */
    public static Icon solid (int color, float size) {
        CanvasImage image = PlayN.graphics().createImage(1, 1);
        image.canvas().setFillColor(color).fillRect(0, 0, 1, 1);
        return scaled(image(image), size);
    }
View Full Code Here

    /** Renders this styled text into the supplied canvas at the specified offset. */
    public abstract void render (Canvas canvas, float x, float y);

    /** Creates an image large enough to accommodate this styled text, and renders it therein. */
    public CanvasImage toImage () {
        CanvasImage image = graphics().createImage(width(), height());
        render(image.canvas(), 0, 0);
        return image;
    }
View Full Code Here

    /**
     * Creates an image large enough to accommodate the supplied text layout, renders the text into
     * it, and returns the image.
     */
    public CanvasImage toImage (TextLayout layout) {
        CanvasImage image = createImage(layout);
        render(image.canvas(), layout, 0, 0);
        return image;
    }
View Full Code Here

  private static ImageLayer generateLogMessageImageLayer(String message) {
      TextFormat logFormat_ = (logCount % 2 == 0) ? logFormat : logOddFormat;
     
      ImageLayer imageLayer = graphics().createImageLayer();
        TextLayout layout = graphics().layoutText(message, logFormat_);
        CanvasImage logImage = graphics().createImage(graphics().width(), logFontSize + 4);
        logImage.canvas().drawText(layout, 0, 0);
        imageLayer.setImage(logImage);
        return imageLayer;
    }
View Full Code Here

    this.alpha = alpha;
  }

  public CanvasImage asCanvasImage() {
    int diameter = radius * 2;
    CanvasImage circleImage = graphics().createImage(diameter, diameter);
    Canvas canvas = circleImage.canvas();
    canvas.setFillColor(color);
    canvas.fillCircle((float) radius, (float) radius, (float) radius);
    canvas.setAlpha(alpha);
   
    float strokeWidth = 16.0f;
View Full Code Here

    return circleImage;
  }

  public ImageLayer asImageLayer() {
      // NOTE: use this for transparent images
    CanvasImage image = asCanvasImage();
    ImageLayer imageLayer = graphics().createImageLayer(image);
    imageLayer.setAlpha(alpha);
    imageLayer.transform().translate(getScreenX(), getScreenY());
    return imageLayer;
  }
View Full Code Here

TOP

Related Classes of playn.core.CanvasImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.