I am creating a blackberry apllication which pre-dominantly uses ObjectListFields..All i need now is to draw an image as a background for each cell. I know this is quiet possible but i am not getting hold of the procedure. if i draw bitmap in drawlistrow() function the bluehighlight gets into the background and the cell highlight becomes very hard to read......can anybody help me with a code snippet to get through this problem ....thanks...
As far as i know ObjectListFields focus fills the background of the element blue and alters the foreground color (text) to white.
If you really need to draw an image on the background, you should at least change the foreground color to a high contrast or at make the background image transparent.
Check the style of the graphics in drawListRow with
graphics.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)and set different colors for them.
Related
is it possible to change the default background color in libgdx. i want to change the background color from black to whatever color i desire, and not clear the screen. i am using ShapeRenderer to create a rectangle that is filled. i then have that rectangle move around the screen and i want to keep the previously rendered rectangle.
using Gdx.gl.glClearColor() and Gdx.gl.glClear() obviously re-renders the background color over top the previous, clearing the previously rendered rectangle.
if i dont use the Gdx.gl.glClearColor() and Gdx.gl.glClear() the background is black and the rectangle rendering and movement is what i want, other then the fact that the default background color is black. witch is not the desired look i need.
The frame buffer has no concept of what is background and not. If you are working exclusively with the screen's frame buffer, the only way to change the color is to clear the screen and redraw everything. So in your case you would need to store the steps you used to render everything the first time and replay those steps after clearing the screen.
What might be easier would be to use a separate frame buffer for all the content of your scene, and draw that over the background. This would require a frame buffer with an alpha component, and you would need to use blendFuncSeparate when rendering so alpha is preserved in this frame buffer so it can be drawn over the background. You would use a transparent clear color within the frame buffer, and whatever color you want on the main frame buffer.
libGDX FrameBuffers are a big topic and too much to explain here. You should start with the documentation, and if you start implementing it and have issues you can create a new question.
Here a simple question I'd like to ask.
I'm making a videogame (with NO graphics) and for that I'm using SceneBuilder. So here is the state of my HP bar :
HP BAR
Now I want to reshape it in order to obtain a heartshape :
HP BAR wanted
Thus, anyone know if it's possible to do it using SceneBuilder with the settings?
Thank you everyone, have a wonderful day.
One simple way, providing the background of the panel is simple, would be to overlay an ImageView over the top of the progress bar. If you use a PNG with a "hole" of transparency, you'd effectively hide the areas of the square that you're not interested in seeing.
In this example, the black pixels would be the same colour as the background colour (in your case grey) and the white pixels would be fully transparent.
The downside to this is that if the panel changes colour then you'll need to recreate your PNG in the new colour.
as a fun little project, I am trying to create an 'overlay' program.
Perhaps you've heard of the program 'open broadcaster software'.
This is a streaming program that can 'record' windows and apply 'color key' to them (making a certain color transparent)
I have a program that creates a window with a green background, acting as the greenscreen. On this window I want to make images appear, dissapear and move.
So far so good, however the problem comes with transparent images. They have a color hue over them because the color key tries to remove or smoothen out the colors.
So my question is; is there a way to programmatically add a color to a picture, or strengthen other colors, so color key would instead render the original?
Sincerely,
JB
Rendering a pertially translucent image on a backgroud showing the background color shining trough is the whole point of translucency.
There is nothing you can do without sacrificing the transparency in some way or another. A few useful effects can be achieved with java.awt.AlphaComposite, but I'm not sure any of the effects suit your fancy.
You could preprocess the images and change translucency to simple transparent/opaque (e.g. alter alpha for each pixel to newAlpha = oldAlpha < threshHold ? 0x00 : 0xFF). Selecting a good-looking threshhold value might be tricky (no one-size fits all). Needless to say that this will result in a drop in perceived image quality.
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
So I have a set of .png pictures that have a transparent background that will be on a checkerboard. When a playing piece is clicked, the possible places that the piece can move to will change color. However, I want to know if in setting the background color of a tile and if the tile has an opposing piece on it, will the picture of the opposing piece be overridden and erased in favor of the color. And if it is erased, how can I avoid this problem?
This is the call I used to set the background as the .png file
btn.setBackgroundResource(R.drawable.fileName);
This is the call I used to set the background as the color
btn.setBackgroundColor(Color.COLOR);