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

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

Introduction

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

Prototype

public Pixmap(byte[] encodedData, int offset, int len) 

Source Link

Document

Creates a new Pixmap instance from the given encoded image data.

Usage

From source file:mobi.shad.s3lib.gfx.node.filter.FxPlasma3D.java

License:Apache License

/**
 *
 *///from www  .  j a  v a2 s  . co m
@Override
protected void processLocal() {
    data.type = Data.Type.EFFECT_2D;

    if (formGui != null) {

        colorMode = formGui.getInt("colorMode");

        speedX1 = formGui.getFloat("speedX1");
        speedY1 = formGui.getFloat("speedY1");
        stepX1 = formGui.getFloat("stepX1");
        stepY1 = formGui.getFloat("stepY1");
        amplitudeX1 = formGui.getFloat("amplitudeX1");
        amplitudeY1 = formGui.getFloat("amplitudeY1");

        speedX2 = formGui.getFloat("speedX2");
        speedY2 = formGui.getFloat("speedY2");
        stepX2 = formGui.getFloat("stepX2");
        stepY2 = formGui.getFloat("stepY2");
        amplitudeX2 = formGui.getFloat("amplitudeX2");
        amplitudeY2 = formGui.getFloat("amplitudeY2");

        speedX3 = formGui.getFloat("speedX3");
        speedY3 = formGui.getFloat("speedY3");
        stepX3 = formGui.getFloat("stepX3");
        stepY3 = formGui.getFloat("stepY3");
        amplitudeX3 = formGui.getFloat("amplitudeX3");
        amplitudeY3 = formGui.getFloat("amplitudeY3");
    }

    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSize, S3Constans.proceduralTextureSize,
                Pixmap.Format.RGBA8888);
    }
    updateLocal(0, 0, 0, 0, false);
}

From source file:mobi.shad.s3lib.gfx.node.filter.FxTextureGalleryMask.java

License:Apache License

/**
 *
 *//*from   www.  j  av a  2 s  .c  om*/
@Override
protected void processLocal() {
    if (formGui != null) {

        actionTime = formGui.getFloat("actionTime");
        pauseTime = formGui.getFloat("pauseTime");
        filesList = formGui.getArrayString("imageList");

        filesList = formGui.getArrayString("imageList");
        maskTextureName = formGui.getString("imageMask");

        interpolationMode = formGui.getInt("interpolationMode");

        switch (interpolationMode) {
        default:
            interpolation = Interpolation.linear;
            break;
        case 1:
            interpolation = Interpolation.bounce;
            break;
        case 2:
            interpolation = Interpolation.pow2;
            break;
        case 3:
            interpolation = Interpolation.pow3;
            break;
        case 4:
            interpolation = Interpolation.elastic;
            break;
        case 5:
            interpolation = Interpolation.swing;
            break;
        case 6:
            interpolation = Interpolation.sine;
            break;
        }

        data.type = Data.Type.EFFECT_2D;

        maskTexture = S3ResourceManager.getPixmap(maskTextureName, S3Constans.textureImageSizeHight);

        if (filesList != null) {
            if (filesList.length > 1) {
                srcTexture = S3ResourceManager.getPixmap(filesList[0], S3Constans.textureImageSizeHight);
                src2Texture = S3ResourceManager.getPixmap(filesList[1], S3Constans.textureImageSizeHight);
            } else {
                srcTexture = new Pixmap(S3Constans.textureImageSizeLow, S3Constans.textureImageSizeLow,
                        Format.RGBA8888);
                srcTexture.setColor(Color.CLEAR);
                srcTexture.fill();
                if (filesList.length > 0) {
                    src2Texture = S3ResourceManager.getPixmap(filesList[0], S3Constans.textureImageSizeHight);
                } else {
                    src2Texture = new Pixmap(S3Constans.textureImageSizeLow, S3Constans.textureImageSizeLow,
                            Format.RGBA8888);
                    src2Texture.setColor(Color.CLEAR);
                    src2Texture.fill();
                }
            }
        } else {
            srcTexture = new Pixmap(S3Constans.textureImageSizeLow, S3Constans.textureImageSizeLow,
                    Format.RGBA8888);
            srcTexture.setColor(Color.CLEAR);
            srcTexture.fill();

            src2Texture = new Pixmap(srcTexture.getWidth(), srcTexture.getHeight(), srcTexture.getFormat());
            src2Texture.setColor(Color.CLEAR);
            src2Texture.fill();
        }

        if (data.pixmap == null) {
            data.pixmap = new Pixmap(S3Constans.textureImageSizeHight, S3Constans.textureImageSizeHight,
                    Pixmap.Format.RGBA8888);
            data.pixmap.setColor(Color.CLEAR);
            data.pixmap.fill();
            data.textureChange = true;
        }

        clearPixmap = new Pixmap(S3Constans.textureImageSizeLow, S3Constans.textureImageSizeLow,
                Format.RGBA8888);
        clearPixmap.setColor(Color.CLEAR);
        clearPixmap.fill();

        pixmapFilter.setPixmap(data.pixmap, srcTexture, src2Texture, maskTexture);
    }
    currentActionTime = 0;
    currentPauseTime = 0;
    currentImageIdx = 0;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.anim.FxJuliaAnim.java

License:Apache License

@Override
protected void updateLocal(float effectTime, float sceneTime, float endTime, float procent, boolean isPause) {
    if (isPause) {
        return;/*from w ww  .  j  a v a2 s . co  m*/
    }

    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSize, S3Constans.proceduralTextureSize,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    data.textureChange = true;

    xIterations = xIterations + addXIterations * S3.osDeltaTime;
    yIterations = yIterations + addYIterations * S3.osDeltaTime;
    if (xIterations > maxXIterations || xIterations < minXIterations) {
        addXIterations = -addXIterations;
    }
    if (yIterations > maxYIterations || yIterations < minYIterations) {
        addYIterations = -addYIterations;
    }
    Julia.generate(data.pixmap, xCenter, yCenter, xSize, ySize, xIterations, yIterations, iterations);
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.anim.FxManderbrotAnim.java

License:Apache License

@Override
protected void updateLocal(float effectTime, float sceneTime, float endTime, float procent, boolean isPause) {
    if (isPause) {
        return;//w ww  .j  ava 2  s  . co  m
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSize, S3Constans.proceduralTextureSize,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;

    xSize = xSize + addXSize * S3.osDeltaTime;
    ySize = ySize + addYSize * S3.osDeltaTime;
    if (xSize > maxXSize || xSize < minXSize) {
        addXSize = -addXSize;
    }
    if (ySize > maxYSize || ySize < minYSize) {
        addYSize = -addYSize;
    }

    switch (fractalType) {
    default:
        Mandelbrot.generate(data.pixmap, xCenter, yCenter, xSize, ySize, iterations);
        break;
    case 1:
        Mandelbrot2.generate(data.pixmap, xCenter, yCenter, xSize, ySize, iterations);
        break;
    case 2:
        Mandelbrot3.generate(data.pixmap, xCenter, yCenter, xSize, ySize, iterations);
        break;
    case 3:
        Mandelbrot4.generate(data.pixmap, xCenter, yCenter, xSize, ySize, iterations);
        break;
    case 4:
        Mandelbrot5.generate(data.pixmap, xCenter, yCenter, xSize, ySize, iterations);
        break;
    }
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.anim.FxPlasma.java

License:Apache License

/**
 *
 */// w w w .  ja v  a2 s  .c o  m
@Override
protected void processLocal() {

    if (formGui != null) {
        plasmaSpeed = formGui.getInt("FxPlasma_plasmaSpeed");
        plasmaScrollSpeed = formGui.getInt("FxPlasma_plasmaScrollSpeed");
        cellSizeX = formGui.getInt("FxPlasma_cellSizeX");
        cellSizeY = formGui.getInt("FxPlasma_cellSizeY");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSize, S3Constans.proceduralTextureSize,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    Plasma.generate(data.pixmap, plasmaSpeed, plasmaScrollSpeed, cellSizeX, cellSizeY);
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.filter.FxColorFilter.java

License:Apache License

/**
 *
 *//*  w ww. jav a 2  s.co  m*/
@Override
protected void processLocal() {
    if (formGui != null) {

        brithness = formGui.getInt("FxColorFilterBrithness");
        contrast = formGui.getInt("FxColorFilterContrast");
        saturation = formGui.getInt("FxColorFilterSaturation");

        colorBase = formGui.getColor("FxColorFilterColorBase");

        colorPercentRed = formGui.getInt("FxColorFilterColorPercentRed");
        colorPercentGreen = formGui.getInt("FxColorFilterColorPercentGreen");
        colorPercentBlue = formGui.getInt("FxColorFilterColorPercentBlue");

        alpha = formGui.getInt("FxColorFilterAlpha");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.RED);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    ColorFilter.generate(data.pixmap, colorBase, colorPercentRed, colorPercentGreen, colorPercentBlue,
            brithness, contrast, saturation, alpha);
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.filter.FxGlow.java

License:Apache License

/**
 *
 *///from  w  w  w  .j a  v a  2s  .c om
@Override
protected void processLocal() {

    if (formGui != null) {
        centerX = formGui.getFloat("FxGlowCenterX");
        centerY = formGui.getFloat("FxGlowCenterY");
        rayX = formGui.getFloat("FxGlowRayX");
        rayY = formGui.getFloat("FxGlowRayY");

        gamma = formGui.getFloat("FxGlowGamma");
        alpha = formGui.getFloat("FxGlowAlpha");
        color = formGui.getColor("FxGlowColor");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.RED);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    Glow.generate(data.pixmap, color, centerX, centerY, rayX, rayY, gamma, alpha);
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.filter.FxGradient.java

License:Apache License

/**
 *
 */// ww w.ja  v a  2s  . co m
@Override
protected void processLocal() {
    if (formGui != null) {
        alpha = formGui.getFloat("FxGradientAlpha");
        topLeft = formGui.getColor("FxGradientTopLeft");
        topRight = formGui.getColor("FxGradientTopRight");
        bottomLeft = formGui.getColor("FxGradientBottomLeft");
        bottomRight = formGui.getColor("FxGradientBottomRight");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.RED);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    Gradient.generate(data.pixmap, topLeft, topRight, bottomLeft, bottomRight, alpha);
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.filter.FxGradientMap.java

License:Apache License

/**
 *
 *//*from w w w  . j a  v  a  2 s  .  c om*/
@Override
protected void processLocal() {
    if (formGui != null) {
        colorMode = formGui.getInt("FxGradientMapColorMode");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.RED);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    data.textureChange = true;
    GradientMap.generate(data.pixmap, colorMode);
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.filter.FxInvert.java

License:Apache License

/**
 *
 *///from  ww w.  j a  v  a 2  s .c o m
@Override
protected void processLocal() {
    if (formGui != null) {
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.RED);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    Invert.process(data.pixmap);
    data.textureChange = true;
}