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
Related
I would like to design a layout containing an imageview and a background view with two special effect. First is where the main imageview gets transformed with faded towards the vertical edges and second is a background imageview with a blurred effect like the image
The result that i am able to achieve
I saw this post for my first effect and currently using it, but it does not work when I change my phone into dark mode so I am not getting a perfect solution.
And the second special blur effect that i am able to achieve is far way different from what i want to achieve. The required blur effect has some hardness of the different shades of color and mine one is quite smooth. For my blur effect I am using the below code and I am using the library Fresco for my image.
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl))
.setPostprocessor(new IterativeBoxBlurPostProcessor(60)).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(backgroundImage.getController())
.build();
backgroundImage.setController(controller);
Can anyone please suggest me any good solution or any good library for it or some code sample that can help me to achieve what I want.
The point to note here is the blurred background is an extension of the image itself. So if the left side of the screen has a purple hue the blurred region at the top left will be purple as well.
YOu can use a library like Blurry where it blurs the contents of the screen and then set that as a background. You can control the amount of blur you want.
Once you get the blurred image set it as the background of the container layout and set the picture in front
eg:
val bitmap = Blurry.with(this)
.radius(10) // make it more if you want the lue to be more
.sampling(8)
.capture(findViewById(R.id.right_bottom)).get() // get the view you want to blur
imageView.setImageDrawable(BitmapDrawable(resources, bitmap)) // set the value to the background
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.
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.
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.
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.