Background colour of chess pieces - java

I have downloaded all the eight pieces from Google images for both black and white player. All the images have a white background. I saved the images of the pieces in the drawable folder. I want to place a white Pawn on a black sqaure. Hence, I did the following:
<TextView
android:width="match_parent"
android:height="match_parent"
android:id="#+id/tv70"
android:background="#drawable/white_pawn"
/>
I have left out the unnecessary details regarding the position of the textview. The textview was supposed to be of a black background but the image of the rook makes it a white square(because it has a white background).
If I have to make it on a black background, I have to go and use Paint or Photoshop and change each of the background colour of the pieces to black and save them. (Giving me 20 images of such pieces). It takes alot of memory.
How should I change the background colour of the pieces without having so many images files? Or this there another way of creating the pieces for my chess game?
I'm attaching a picture of my Pawn pieces.
The above image is when I use the image with black and white background separately.

You can use a different colors than black and white for tiles. Otherwise it will break eyes.
P.S. You can use fonticons like https://fontawesome.com/icons?d=gallery&q=chess

Related

Bitmap (or view?) fading

If I display a bitmap as a background, and then draw 3 other, smaller, bitmaps on top, is there a way to fade the background without affecting the other 3 bitmaps?
Basically what I want to do is to move three 'sprite buttons' and a logo image onto the screen, over the top of the game screen, and have the background fade down while the buttons are displayed. When the buttons move off, I want the background to fade back in again.
Any ideas?
Look, this is a design question initially. I need to see if it's possible before I commit.
I have a background. On this I want to show 3 'sprites'. I want to fade the background down without fading the sprites. Is this possible and, if so, how best should it be done?
Considering that the background image will fade and the other 3 will not, is there a reason why they are in the same "container".
If not, then consider having only the background being altered, and the other three images isolated from the altering code.
If they must be drawned together or inside the same bitmap, consider having regions not to alter inside the bitmap, perhaps by clustering the image, and placing identifiers on those regions with a boolean (such as "isAlterable"), then only calling the fade on isAlterable clusters

libGDX, transparent sprite is black on some devices

I have recently started learning libGDX and currently, I'm making an endless space game. I have made a scrolling background, where there is a base image of space overlapped with another image with stars.
Looks like this. (the black area is transparent)
Stars move a bit faster, what creates nice effect, as if they were closer. It works fine on my mobile phone and tablet, however if I try it on another tablet with slightly different resolution, the whole stars image becomes black and covers the whole space image.
Everything is saved in PNG and I move the sprite by changing it's Y.
stars = new Sprite(new Texture(Gdx.files.internal("data/universe/stars1.png")));
stars.setSize(screenWidth, screenHeight);
stars.setY(0);
Thanks for any advice.

Animating Crossfading between two images - Splash Screen

I am creating a splash screen for my app using multiple images. I have one main image that will be displayed as a Logo; behind the logo I intend to have two images - a green cloud, and a blue cloud, fading in and out a few times so it will create a kind of pulsing glow effect behind the logo. What is the best way to implement this type of effect? Basically the main image will stay static while the other two images switch back and forth from one to the other until the end of the splash intro. Thanks in advance for the help! BTW I am using Eclipse.
Have two images stacked - one way is in ht linear layout keep blue cloud as background and in the frame layout keep an ImageView. In the ImageView hold the green cloud. Now make the transparency of the image in the frame layout ("green cloud") fade in and fade out with its transparency. Call setAlpha in a loop -cycle the the argument to set Alpha - 0 is fully transparent wherein "blue cloud" is visible and 255 is fully opaque - "green cloud" is visible.

Render circles and change color of the intersection

I'm working in a simple game for desktop and Android using LibGDX framework. The game spawn some balls that move from one side of the screen to the opposite one. I want to show white circles over a black background but I also want to draw some white texts. My problem with this is that I want to draw the intersection between balls and between balls and text in black. I want something like this:
Other of my problems is that I'm using ShapeRenderer to draw the circles and they are too pixelated.
What is the best way to render circles in libGDX (Ill have to render between 1 and 100). Is it possible to get the effect shown in the image?

Creating an Icon with a Tranparent Background

I'm using ImageIcons that I downloaded from a free icon site in my JButtons. Two of them have white backgrounds, and the other one has a black background. I would prefer not to have a background color clash, so I want to make all the backgrounds transparent. I've seen ways to make image backgrounds transparent, but I thought it was kinda roundabout to turn my ImageIcons into Images and back again. Is there a way to make the backgrounds of ImageIcons transparent without converting to Images?
This isn't a Java-solution, but it's a solution I use frequently nonetheless. Download/install Paint.NET and follow this discussion on how to make the background of images transparent. And then use the resulting image for the ImageIcon.
Another non java solution: with photoshop you can select a small white rectangle of the background part, and then menu "Select" > "Similar" if you want to delete all white pixels, or "Grow" if you want to delete all white pixels touching your existing selection.

Categories

Resources