I am currently working on an android game using libgdx and would like to add a joystick to its interface. For this I use the built-in touchpad class. Untill now I have used external images for rendering the background and joystick. Now, I would like to dynamically draw the background of the joystick. This would make it possible to make the background of the joystick semi-transparent and to change the color of the background dynamically.

To do this, I implemented the following:

public class Joystick{
    private Touchpad touchpad;
    private static TouchpadStyle touchpadStyle;
    private Skin touchpadSkin;

    public Joystick(GameWorld world, GuiComponent gui) {
        touchpadSkin = new Skin();
        touchpadSkin.add("touchKnob", new Texture("data/touchKnob.png"));

        touchpadStyle = new TouchpadStyle();
        touchpadStyle.knob = touchpadSkin.getDrawable("touchKnob");;

        Pixmap background = new Pixmap(200, 200, Format.RGBA8888);
        background.setColor(1, 1, 1, .6f);
        background.fillCircle(100, 100, 100);
        touchpadStyle.background = new TextureRegionDrawable(new TextureRegion(new Texture(background)));

        touchpad = new Touchpad(10, touchpadStyle);
        touchpad.setBounds(15, 15, 200, 200);


As you can see, this code provides a joystick with a semi-transparent background: Joystick with semi-transparent background enter image description here

However, this background has some inexplicable lines that are not transparent. Does anybody know what causes this? I thought it could have something to do with the format of the pixmap, but after trying with some other formats, there was not much improvement.

  • \$\begingroup\$ I also noticed that when I just draw a rectangle instead of a circle, everything is fine. \$\endgroup\$
    – Consec
    Commented Jan 3, 2015 at 19:54

1 Answer 1


To get rid of the lines, you need to set Pixmap.setBlending(Blending.NONE); before you draw the circle.

  • \$\begingroup\$ This worked for me, but the colour of the transparent circle doesn't seem to match what I've given it. It almost seems to be a bit bluer (very scientific!) \$\endgroup\$ Commented Apr 24, 2017 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .