Example usage for com.badlogic.gdx.graphics Pixmap setFilter

List of usage examples for com.badlogic.gdx.graphics Pixmap setFilter

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Pixmap setFilter.

Prototype

public static void setFilter(Filter filter) 

Source Link

Document

Sets the type of interpolation Filter to be used in conjunction with Pixmap#drawPixmap(Pixmap,int,int,int,int,int,int,int,int) .

Usage

From source file:com.agateau.pixelwheels.tools.MapScreenshotGenerator.java

License:Apache License

private static Pixmap scaleScreenshot(Pixmap src) {
    int srcW = src.getWidth();
    int srcH = src.getHeight();

    float ratio = (float) SHOT_SIZE / Math.min(srcW, srcH);
    int dstW = (int) (srcW * ratio);
    int dstH = (int) (srcH * ratio);

    Pixmap dst = new Pixmap(SHOT_SIZE, SHOT_SIZE, src.getFormat());
    dst.setFilter(Pixmap.Filter.BiLinear);
    dst.drawPixmap(src, 0, 0, srcW, srcH, (SHOT_SIZE - dstW) / 2, (SHOT_SIZE - dstH) / 2, dstW, dstH);
    return dst;//from   w w w  .  j  av a  2  s . co  m
}