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

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

Introduction

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

Prototype

public void drawRectangle(int x, int y, int width, int height) 

Source Link

Document

Draws a rectangle outline starting at x, y extending by width to the right and by height downwards (y-axis points downwards) using the current color.

Usage

From source file:CB_UI_Base.GL_UI.Controls.Box.java

License:Open Source License

protected void drawBorder(Batch batch) {
    if (borderSprite == null) {
        try {// ww w . j a v  a  2  s . com
            GL.that.RunOnGLWithThreadCheck(new IRunOnGL() {

                @Override
                public void run() {

                    int w = (int) getWidth();
                    int h = (int) getHeight();

                    Pixmap borderRegPixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);
                    borderRegPixmap.setColor(borderColor);

                    int borderAsInt = Math.round(Box.this.borderSize);

                    for (int i = 0; i < borderAsInt + 1; i++) {
                        borderRegPixmap.drawRectangle(i, i, ((int) getWidth()) - (i),
                                ((int) getHeight()) - (i));
                    }

                    borderSprite = new Sprite(new Texture(borderRegPixmap, Pixmap.Format.RGBA8888, false),
                            (int) getWidth(), (int) getHeight());
                }
            });

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    if (borderSprite != null)
        batch.draw(borderSprite, 0, 0);

}

From source file:com.alma42.mapgen.game.WorldController.java

License:Apache License

private Pixmap createUser(final int width, final int height) {
    final Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888);
    // Fill square with red color at 50% opacity
    pixmap.setColor(1, 0, 0, 0.5f);/*  w w w .j  ava2  s.  c  o  m*/
    pixmap.fill();
    // Draw a yellow-colored X shape on square
    pixmap.setColor(1, 1, 0, 1);
    pixmap.drawLine(0, 0, width, height);
    pixmap.drawLine(width, 0, 0, height);
    // Draw a cyan-colored border around square
    pixmap.setColor(0, 1, 1, 1);
    pixmap.drawRectangle(0, 0, width, height);
    return pixmap;
}

From source file:com.kotcrab.vis.ui.widget.color.internal.PickerCommons.java

License:Apache License

private void createPixmap() {
    Pixmap whitePixmap = new Pixmap(2, 2, Format.RGB888);
    whitePixmap.setColor(Color.WHITE);
    whitePixmap.drawRectangle(0, 0, 2, 2);
    whiteTexture = new Texture(whitePixmap);
    whiteTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
    whitePixmap.dispose();/*from w  w w .  j a v a  2s .  c om*/
}

From source file:com.ridiculousRPG.video.cortado.CortadoPlayerAppletWrapper.java

License:Open Source License

/**
 * Instantiates a new video player. Don't forget to dispose the player!
 * //  w  ww.j a va 2s  . c  om
 * @param url
 *            url to ogg / ogv file
 * @param screenBounds
 *            the screen position, width and height
 * @param projectToMap
 *            Defines whether to project the video onto the map or onto the
 *            screen coordinates
 * @param withAudio
 *            if false, the audio channel will be disabled.
 */
public CortadoPlayerAppletWrapper(URL url, Rectangle screenBounds, boolean projectToMap, boolean withAudio,
        boolean drawPlaceholder) {
    this.screenBounds = new Rectangle(screenBounds);
    this.projectToMap = projectToMap;
    if (!projectToMap) {
        GameBase gb = GameBase.$();
        this.screenBounds.width /= gb.getScreen().width;
        this.screenBounds.height /= gb.getScreen().height;
        this.screenBounds.x /= gb.getScreen().width;
        this.screenBounds.y /= gb.getScreen().height;
    }
    int width = (int) screenBounds.width;
    int height = (int) screenBounds.height;

    textureRef = TextureRegionLoader.obtainEmptyRegion(width, height, Format.RGBA8888);
    if (drawPlaceholder) {
        Pixmap placeholder = new Pixmap(width, height, Format.RGBA8888);
        placeholder.setColor(0, 0, 0, 1);
        placeholder.fillRectangle(0, 0, width, height);
        placeholder.setColor(.7f, .7f, .7f, 1);
        placeholder.fillCircle(width / 2, height / 2, Math.min(width, height) / 3);
        placeholder.setColor(.4f, .4f, .4f, 1);
        placeholder.drawRectangle(0, 0, width, height);
        placeholder.drawRectangle(2, 2, width - 4, height - 4);
        placeholder.drawLine(1, 0, width, height - 1);
        placeholder.drawLine(0, 1, width - 1, height);
        placeholder.drawLine(1, height, width, 1);
        placeholder.drawLine(0, height - 1, width - 1, 0);
        textureRef.draw(placeholder);
        placeholder.dispose();
    }
    graphicsPixmap = new VideoARGBintPixmapWrapper();
    player = new CortadoPlayerApplet(graphicsPixmap);
    initPlayer();
    player.setParam("url", url.toString());
    player.setParam("audio", String.valueOf(withAudio));
    player.setSize(width, height);
    player.setStub(this);
    player.init();
    player.start();
}

From source file:de.longri.cachebox3.develop.tools.skin_editor.actors.OptionsPane.java

License:Apache License

/**
 *
 *///w w  w .  ja  va  2s  .co m
private void updateTableFields(final String style) {

    ImageButton button = (ImageButton) game.screenMain.barWidgets.group.getChecked();
    String widget = button.getUserObject().toString();

    Gdx.app.log("OptionsPane", "Update fields table for widget: " + widget + ", style: " + style);
    tableFields.clear();
    tableFields.add(new Label("Name", game.skin, "title")).left().width(170);
    tableFields.add(new Label("Value", game.skin, "title")).left().width(60).padRight(50);
    tableFields.row();

    Field[] fields = ClassReflection.getFields(currentStyle.getClass());
    for (final Field field : fields) {
        try {

            Actor actor = null;

            // field type
            String name = field.getType().getSimpleName();
            Object obj = field.get(currentStyle);

            if (name.equals("Drawable")) {

                /**
                 * Handle Drawable object
                 */

                Drawable drawable = (Drawable) field.get(currentStyle);
                String resourceName = "";
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if (drawable != null) {
                    resourceName = game.skinProject.resolveObjectName(Drawable.class, drawable);
                    if (resourceName == null) {
                        resourceName = game.skinProject.resolveObjectName(TextureRegion.class, drawable);
                    }
                    buttonStyle.imageUp = drawable;
                } else {
                    buttonStyle.up = game.skin.getDrawable("default-rect");
                    buttonStyle.checked = game.skin.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showDrawableDialog(field, false);

                    }

                });

            } else if (name.equals("Bitmap")) {

                /**
                 * Handle Bitmap object
                 */

                Bitmap bitmap = (Bitmap) field.get(currentStyle);
                byte[] bytes = null;
                if (bitmap != null)
                    bytes = bitmap.getPngEncodedData();
                Drawable drawable = bitmap != null
                        ? new TextureRegionDrawable(
                                new TextureRegion(new Texture(new Pixmap(bytes, 0, bytes.length))))
                        : null;

                String resourceName = "";
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if (drawable != null) {
                    resourceName = ((GetName) bitmap).getName();
                    buttonStyle.imageUp = drawable;
                } else {
                    buttonStyle.up = game.skin.getDrawable("default-rect");
                    buttonStyle.checked = game.skin.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showDrawableDialog(field, true);

                    }

                });

            } else if (name.equals("Color")) {

                /**
                 * Handle Color object
                 */
                Color color = (Color) field.get(currentStyle);
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                String resourceName = "";
                if (color != null) {

                    if (color instanceof SkinColor) {
                        resourceName = ((SkinColor) color).skinName;
                    } else {
                        resourceName = game.skinProject.resolveObjectName(SkinColor.class, color);
                    }

                    resourceName += " (" + color.toString() + ")";

                    // Create drawable on the fly
                    Pixmap pixmap = new Pixmap(18, 18, Pixmap.Format.RGBA8888);
                    pixmap.setColor(color);
                    pixmap.fill();
                    pixmap.setColor(Color.BLACK);
                    pixmap.drawRectangle(0, 0, 18, 18);
                    Texture texture = new Texture(pixmap);
                    buttonStyle.imageUp = new SpriteDrawable(new Sprite(texture));
                    pixmap.dispose();
                } else {
                    buttonStyle.up = game.skinProject.getDrawable("default-rect");
                    buttonStyle.checked = game.skinProject.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showColorPickerDialog(field);

                    }

                });

            } else if (name.equals("BitmapFont")) {

                /**
                 * Handle BitmapFont object
                 */

                BitmapFont font = (BitmapFont) field.get(currentStyle);
                String resourceName = "";
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if (font != null) {
                    resourceName = game.skinProject.resolveObjectName(BitmapFont.class, font);
                    buttonStyle.font = font;
                } else {
                    buttonStyle.up = game.skinProject.getDrawable("default-rect");
                    buttonStyle.checked = game.skinProject.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);

                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showFontPickerDialog(field);

                    }

                });

            } else if (name.equals("float")) {

                /**
                 * Handle Float object
                 */

                Float value = (Float) field.get(currentStyle);
                String resourceName = "";

                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if ((value != null) && (value != 0)) {
                    resourceName = String.valueOf(value);
                } else {
                    buttonStyle.up = game.skinProject.getDrawable("default-rect");
                    buttonStyle.checked = game.skinProject.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showFloatInputDialog(field);

                    }

                });

            } else if (name.equals("ListStyle")) {

                /**
                 * Handle ListStyle object
                 */
                ListStyle listStyle = (ListStyle) field.get(currentStyle);

                actor = new SelectBox<String>(game.skin, "default");
                Array<String> items = new Array<String>();

                final ObjectMap<String, ListStyle> values = game.skinProject.getAll(ListStyle.class);
                Iterator<String> it = values.keys().iterator();
                String selection = null;

                while (it.hasNext()) {
                    String key = it.next();
                    items.add(key);

                    if (listStyle == values.get(key)) {
                        selection = key;
                    }
                }

                ((SelectBox) actor).setItems(items);

                if (selection != null) {
                    ((SelectBox) actor).setSelected(selection);
                }

                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {

                        String selection = (String) ((SelectBox) actor).getSelected();
                        try {
                            field.set(currentStyle, values.get(selection));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                        game.screenMain.saveToSkin();
                        refresh(true);
                        game.screenMain.paneOptions.updateSelectedTableFields();
                        game.screenMain.panePreview.refresh();
                    }

                });

            } else if (name.equals("ScrollPaneStyle")) {

                /**
                 * Handle ListStyle object
                 */
                ScrollPaneStyle scrollStyle = (ScrollPaneStyle) field.get(currentStyle);

                actor = new SelectBox<String>(game.skin, "default");
                Array<String> items = new Array<String>();

                final ObjectMap<String, ScrollPaneStyle> values = game.skinProject
                        .getAll(ScrollPaneStyle.class);
                Iterator<String> it = values.keys().iterator();
                String selection = null;

                while (it.hasNext()) {
                    String key = it.next();
                    items.add(key);

                    if (scrollStyle == values.get(key)) {
                        selection = key;
                    }
                }

                ((SelectBox) actor).setItems(items);

                if (selection != null) {
                    ((SelectBox) actor).setSelected(selection);
                }

                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {

                        String selection = (String) ((SelectBox) actor).getSelected();
                        try {
                            field.set(currentStyle, values.get(selection));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                        game.screenMain.saveToSkin();
                        refresh(true);
                        game.screenMain.paneOptions.updateSelectedTableFields();
                        game.screenMain.panePreview.refresh();
                    }

                });

            } else {

                Gdx.app.log("OptionsPane", "Unknown type: " + name);
                if (!(currentStyle instanceof AbstractIconStyle)) {
                    actor = new Label("Unknown Type", game.skin);
                }
            }

            if (actor != null) {

                // field name

                // White required
                // Grey optional
                if (game.opt.isFieldOptional(currentStyle.getClass(), field.getName())) {

                    tableFields.add(new Label(field.getName(), game.skin, "optional")).left();

                } else {
                    tableFields.add(new Label(field.getName(), game.skin, "default")).left();

                }

                tableFields.add(actor).left().height(64).padRight(24).expandX().fillX();
                tableFields.row();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

        //send changes to PreviewPane
        previewPane.selectedStyleChanged();
    }

}

From source file:de.longri.cachebox3.develop.tools.skin_editor.ColorPickerDialog.java

License:Apache License

/**
 * Refresh table content with colors from the skin
 *//*from w  ww. j  av  a 2 s . c  om*/
public void updateTable() {

    tableColors.clear();
    tableColors.add(new Label("Color Name", game.skin, "title")).left().width(170);
    tableColors.add(new Label("Value", game.skin, "title")).colspan(2).left().width(60).padRight(50);

    tableColors.row();

    Iterator<String> it = colors.keys().iterator();
    while (it.hasNext()) {
        final String key = it.next();
        final Color color = colors.get(key);

        tableColors.add(key).left();

        // Create drawable on the fly
        Pixmap pixmap = new Pixmap(18, 18, Pixmap.Format.RGBA8888);
        pixmap.setColor(color);
        pixmap.fill();
        pixmap.setColor(Color.BLACK);
        pixmap.drawRectangle(0, 0, 18, 18);
        Texture texture = new Texture(pixmap);
        pixmap.dispose();
        tableColors.add(new Image(texture));
        tableColors.add(color.toString()).left();

        TextButton buttonSelect = new TextButton("Select", game.skin);
        buttonSelect.addListener(new ChangeListener() {

            @Override
            public void changed(ChangeEvent event, Actor actor) {
                try {
                    field.set(game.screenMain.paneOptions.currentStyle, color);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                hide();
                game.screenMain.panePreview.refresh();
                game.screenMain.paneOptions.updateSelectedTableFields();
                game.screenMain.saveToSkin();

            }

        });

        TextButton buttonRemove = new TextButton("Remove", game.skin);
        buttonRemove.addListener(new ChangeListener() {

            @Override
            public void changed(ChangeEvent event, Actor actor) {

                Dialog dlg = new Dialog("Delete Style", game.skin) {

                    @Override
                    protected void result(Object object) {
                        if ((Boolean) object == false) {
                            return;
                        }

                        colors.remove(key);
                        // update table
                        updateTable();
                        game.screenMain.saveToSkin();

                    }

                };

                dlg.pad(20);
                dlg.getContentTable().add("You are sure you want to delete this color?");
                dlg.button("OK", true);
                dlg.button("Cancel", false);
                dlg.key(com.badlogic.gdx.Input.Keys.ENTER, true);
                dlg.key(com.badlogic.gdx.Input.Keys.ESCAPE, false);
                dlg.show(game.screenMain.stage);

            }

        });

        if (field != null) {
            tableColors.add(buttonSelect).padRight(5);
        }
        tableColors.add(buttonRemove);
        tableColors.row();
    }

}

From source file:es.eucm.ead.engine.assets.drawables.shapes.GdxRectangleShape.java

License:Open Source License

@Override
protected Pixmap generatePixmap() {

    EAdPaint paint = descriptor.getPaint();
    EAdFill border = paint.getBorder();//  w  ww .  j a  v a  2s  . c  o  m
    EAdFill fill = paint.getFill();
    int borderWidth = paint.getBorderWidth();

    int pwidth = descriptor.getWidth() + borderWidth * 2;
    int pheight = descriptor.getHeight() + borderWidth * 2;

    Pixmap pixmap = new Pixmap(pwidth, pheight, Pixmap.Format.RGBA8888);
    pixmapContains = new Pixmap(pwidth, pheight, Pixmap.Format.RGBA8888);
    pixmapContains.setColor(0, 0, 0, 1);
    pixmapContains.fillRectangle(0, 0, pwidth, pheight);

    ColorFill c = ColorFill.TRANSPARENT;
    if (border != null) {
        if (border instanceof ColorFill) {
            c = (ColorFill) border;

        } else if (border instanceof LinearGradientFill) {
            LinearGradientFill l = (LinearGradientFill) border;
            c = l.getColor1();
        }
        pixmap.setColor(c.getRed() / 255.0f, c.getGreen() / 255.0f, c.getBlue() / 255.0f,
                c.getAlpha() / 255.0f);
        pixmap.drawRectangle(0, 0, pwidth, pheight);
    }

    if (fill instanceof ColorFill) {
        c = (ColorFill) fill;
        pixmap.setColor(c.getRed() / 255.0f, c.getGreen() / 255.0f, c.getBlue() / 255.0f,
                c.getAlpha() / 255.0f);
        pixmap.fillRectangle(borderWidth, borderWidth, descriptor.getWidth(), descriptor.getHeight());
    } else if (fill instanceof LinearGradientFill) {
        LinearGradientFill l = (LinearGradientFill) fill;
        initGradientParams(l.getColor1(), l.getX0(), l.getY0(), l.getColor2(), l.getX1(), l.getY1());
        for (int i = borderWidth; i < descriptor.getWidth() + borderWidth; i++) {
            for (int j = borderWidth; j < descriptor.getHeight() + borderWidth; j++) {
                setColor(pixmap, i, j);
                pixmap.drawPixel(i, j);
            }
        }
    }

    return pixmap;
}

From source file:es.eucm.ead.engine.components.renderers.shape.ShapeToPixmap.java

License:Open Source License

/** Creates a rectangle **/
private Pixmap createRectangle(Rectangle rectangle) {
    originX = 0;/*from   w  ww.j  a v a  2 s  .  co m*/
    originY = 0;
    int width = rectangle.getWidth();
    pixmapHeight = rectangle.getHeight();

    if (width <= 0 || pixmapHeight <= 0) {
        Gdx.app.error("ShapeFactory",
                "Rectangles can't have negative or zero dimensions: (" + width + ", " + pixmapHeight + ")");
    }

    Pixmap pixmap = new Pixmap(width, pixmapHeight, Format.RGBA8888);
    if (useGradient) {
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < pixmapHeight; j++) {
                setGradientColor(pixmap, i, j);
                pixmap.drawPixel(i, j);
            }
        }
    } else {
        pixmap.setColor(color1);
        pixmap.fill();
    }

    if (hasBorder) {
        pixmap.setColor(borderColor);
        pixmap.drawRectangle(0, 0, width, pixmapHeight);
    }
    return pixmap;
}

From source file:es.eucm.ead.engine.renderers.ShapesFactory.java

License:Open Source License

/** Creates a rectangle **/
private Pixmap createRectangle(Rectangle rectangle) {
    Bounds bounds = rectangle.getBounds();
    originX = bounds.getLeft();//from  www  . j av a2  s  . c om
    originY = bounds.getBottom();
    int width = bounds.getRight() - bounds.getLeft();
    pixmapHeight = bounds.getTop() - bounds.getBottom();

    if (width <= 0 || pixmapHeight <= 0) {
        Gdx.app.error("ShapeFactory",
                "Rectangles can't have negative or zero dimensions: (" + width + ", " + pixmapHeight + ")");
    }

    Pixmap pixmap = new Pixmap(width, pixmapHeight, Format.RGBA8888);
    if (useGradient) {
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < pixmapHeight; j++) {
                setGradientColor(pixmap, i, j);
                pixmap.drawPixel(i, j);
            }
        }
    } else {
        pixmap.setColor(color1);
        pixmap.fill();
    }

    if (hasBorder) {
        pixmap.setColor(borderColor);
        pixmap.drawRectangle(0, 0, width, pixmapHeight);
    }
    return pixmap;
}

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

License:Apache License

/**
 * @param pixmap//from w w w.j  a  v a2  s . c om
 * @param xCenter
 * @param yCenter
 * @param xSize
 * @param ySize
 * @param maxIterations
 */
public static void generate(final Pixmap pixmap, int mode, int count, int size, int growth, int randomColor,
        int red, int green, int blue) {

    S3Log.log("Object2D", "mode: " + mode + " count: " + count + " size: " + size);

    int width = pixmap.getWidth();
    int height = pixmap.getHeight();

    if (objectsPosistionX.length != count) {
        objectsPosistionX = new int[count];
        objectsPosistionY = new int[count];
        objectsExpand = new int[count];
        objectsFade = new int[count];
        objectsColor = new float[count][3];

        for (int i = 0; i < count; i++) {
            objectsPosistionX[i] = rnd.nextInt(width);
            objectsPosistionY[i] = rnd.nextInt(height);
            objectsExpand[i] = rnd.nextInt(growth);
            objectsFade[i] = 0;

            if (randomColor > 0) {
                objectsColor[i][0] = rnd.nextInt(256);
                objectsColor[i][1] = rnd.nextInt(256);
                objectsColor[i][2] = rnd.nextInt(256);
            } else {
                objectsColor[i][0] = red;
                objectsColor[i][1] = green;
                objectsColor[i][2] = blue;
            }
        }
    }

    for (int i = 0; i < count; i++) {
        int r = (int) (objectsColor[i][0] * (1.0F - objectsFade[i] / growth));
        int g = (int) (objectsColor[i][1] * (1.0F - objectsFade[i] / growth));
        int b = (int) (objectsColor[i][2] * (1.0F - objectsFade[i] / growth));

        int diameter = size + objectsExpand[i];

        if (objectsExpand[i] < growth) {

            pixmap.setColor(((int) r << 24) | ((int) g << 16) | ((int) b << 8) | 255);

            int offset = diameter / 2;

            switch (mode) {
            default:
                pixmap.drawCircle(objectsPosistionX[i] - offset, objectsPosistionY[i] - offset, diameter);
                break;
            case 1:
                pixmap.fillCircle(objectsPosistionX[i] - offset, objectsPosistionY[i] - offset, diameter);
                break;
            case 2:
                pixmap.drawRectangle(objectsPosistionX[i] - offset, objectsPosistionY[i] - offset, diameter,
                        diameter);
                break;
            case 3:
                pixmap.fillRectangle(objectsPosistionX[i] - offset, objectsPosistionY[i] - offset, diameter,
                        diameter);
                break;
            case 4:
                pixmap.drawCircle(objectsPosistionX[i] - offset, objectsPosistionY[i] - offset, diameter);
                pixmap.drawCircle(objectsPosistionX[i] - offset + diameter / 4 - diameter / 8,
                        objectsPosistionY[i] - offset + diameter / 3, diameter / 4);
                pixmap.drawCircle(objectsPosistionX[i] - offset + (int) (diameter * 0.75F) - diameter / 8,
                        objectsPosistionY[i] - offset + diameter / 3, diameter / 4);
                pixmap.drawCircle(objectsPosistionX[i] - offset + diameter / 4,
                        objectsPosistionY[i] - offset + diameter / 3, diameter / 8);
                pixmap.drawCircle(objectsPosistionX[i] - offset + (int) (diameter * 0.75F),
                        objectsPosistionY[i] - offset + diameter / 3, diameter / 8);
                break;
            }
        }

        objectsExpand[i] += 2;
        objectsFade[i] += 2;
        if (objectsFade[i] >= growth) {
            objectsFade[i] = growth;
        }

        if ((objectsExpand[i] < growth) || (rnd.nextInt(100) >= 10)) {
            continue;
        }
        objectsPosistionX[i] = rnd.nextInt(width);
        objectsPosistionY[i] = rnd.nextInt(height);
        objectsExpand[i] = 0;
        objectsFade[i] = 0;
    }
}