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.pixmap.filter.FxNoise.java

License:Apache License

/**
 *
 *///from  ww  w .  j av  a  2  s  . c o m
@Override
protected void processLocal() {

    if (formGui != null) {
        noiseRed = formGui.getInt("FxNoiseNoiseRed");
        noiseGreen = formGui.getInt("FxNoiseNoiseGreen");
        noiseBlue = formGui.getInt("FxNoiseNoiseBlue");
        seed = formGui.getInt("FxNoiseNoiseSeed");
    }
    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;
    Noise.setSeed(seed);
    Noise.generate(data.pixmap, noiseRed, noiseGreen, noiseBlue);
    data.textureChange = true;
}

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

License:Apache License

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

    if (formGui != null) {
        noiseGrey = formGui.getInt("FxNoiseGreyNoise");
        seed = formGui.getInt("FxNoiseGreyNoiseSeed");
    }
    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;
    NoiseGrey.setSeed(seed);
    NoiseGrey.generate(data.pixmap, noiseGrey);
    data.textureChange = true;
}

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

License:Apache License

/**
 *
 *///ww w .j a  v  a 2 s.  co  m
@Override
protected void processLocal() {
    if (formGui != null) {
        amplify = formGui.getInt("FxNormalsAmplify");
    }
    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;
    Normals.generate(data.pixmap, amplify);
    data.textureChange = true;
}

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

License:Apache License

/**
 *
 *///from w  w  w.  j  av a  2  s  .c  o  m
@Override
protected void processLocal() {

    if (formGui != null) {
        threshold = formGui.getInt("FxThresholdThreshold");
        ratio = formGui.getInt("FxThresholdRatio");
        mode = formGui.getInt("FxThresholdMode");
    }
    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;
    Threshold.generate(data.pixmap, threshold, ratio, mode);
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.procedural.FxCell.java

License:Apache License

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

    if (formGui != null) {
        regularity = formGui.getInt("FxCellRegularity");
        density = formGui.getInt("FxCellDensity");
        seed = formGui.getInt("FxCellSeed");
        color = formGui.getColor("FxCellColor");
        chessboard = formGui.getInt("FxCellChessboard");
        pattern = formGui.getInt("FxCellPattern");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    Cell.setSeed(seed);
    Cell.generate(data.pixmap, regularity, density, color, pattern, chessboard);
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.procedural.FxJulia.java

License:Apache License

/**
 *
 *///  w ww. j a  v  a  2s.  c o m
@Override
protected void processLocal() {

    if (formGui != null) {
        xCenter = formGui.getFloat("FxJuliaXCenter");
        yCenter = formGui.getFloat("FxJuliaYCenter");
        xSize = formGui.getFloat("FxJuliaXSize");
        ySize = formGui.getFloat("FxJuliaYSize");
        xIterations = formGui.getFloat("FxJuliaXIterations");
        yIterations = formGui.getFloat("FxJuliaYIterations");
        iterations = formGui.getInt("FxJuliaIterations");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;
    Julia.generate(data.pixmap, xCenter, yCenter, xSize, ySize, xIterations, yIterations, iterations);
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.procedural.FxManderbrot.java

License:Apache License

/**
 *
 *///from ww w . java2  s . c om
@Override
protected void processLocal() {

    if (formGui != null) {
        fractalType = formGui.getInt("FxManderbrotFractalType");
        xCenter = formGui.getFloat("FxManderbrotXCenter");
        yCenter = formGui.getFloat("FxManderbrotYCenter");
        xSize = formGui.getFloat("FxManderbrotXSize");
        ySize = formGui.getFloat("FxManderbrotYSize");
        iterations = formGui.getInt("FxManderbrotIterations");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;

    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.procedural.FxPerlinNoise.java

License:Apache License

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

    if (formGui != null) {
        perlinType = formGui.getInt("FxPerlinNoiseType");
        amplitude = formGui.getFloat("FxPerlinNoiseAmplitude");
        frequency = formGui.getFloat("FxPerlinNoiseFrequency");
        octaves = formGui.getInt("FxPerlinNoiseOctaves");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;

    switch (perlinType) {
    default:
        PerlinNoise2D.generate(data.pixmap, amplitude, frequency, octaves);
        break;
    case 1:
        PerlinNoise2Dv2.generate(data.pixmap, amplitude, frequency, octaves);
        break;
    case 2:
        PerlinNoise1D.generate(data.pixmap, amplitude, frequency, octaves);
        break;
    }
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.procedural.FxPerlinNoiseColor.java

License:Apache License

/**
 *
 *///w  w  w  .j a va 2 s. co  m
@Override
protected void processLocal() {

    if (formGui != null) {
        octave = formGui.getInt("FxTexturePerlinNoiseOctave");
        colorMode = formGui.getInt("FxTexturePerlinNoiseColor");
        frequence = formGui.getInt("FxTexturePerlinNoiseFrequence");
    }

    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSize, S3Constans.proceduralTextureSize,
                Pixmap.Format.RGBA8888);
    }
    int width = data.pixmap.getWidth();
    int height = data.pixmap.getHeight();

    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            int fastNoise = PerlinNoise.fastNoise(x, y, 128, frequence, octave);
            Color col = GradientUtil.getColorPalleteInt(fastNoise, colorMode);
            data.pixmap.drawPixel(x, y, Color.rgba8888(col));
        }
    }
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.pixmap.procedural.FxTextureLoader.java

License:Apache License

/**
 *
 *//*from   w  w w.  ja v a 2s . c o  m*/
@Override
protected void processLocal() {
    if (formGui != null) {
        fileTextureName = formGui.getString("FxTextureLoaderFile");
    }
    data.type = Data.Type.EFFECT_2D;
    if (data.pixmap == null) {
        Pixmap px = S3ResourceManager.getPixmap(fileTextureName, S3Constans.textureImageSizeHight);
        data.pixmap = new Pixmap(px.getWidth(), px.getHeight(), px.getFormat());
        data.pixmap.drawPixmap(px, 0, 0);
    } else {
        data.pixmap.drawPixmap(S3ResourceManager.getPixmap(fileTextureName, data.pixmap.getWidth()), 0, 0);
    }
    data.texture = null;
    data.textureChange = true;
}