Android :: Alpha Gradient On Bitmap Of PNG

Dec 11, 2009

I'm trying to apply an Alpha gradient to a bitmap that I've created from a PNG. I want the image to be opaque at the top and fade to transparent at the bottom. I know this can be done be using getPixels and setPixels for Bitmap and iterating through each row of pixels in the Bitmap and setting the alpha values accordingly, but i was hoping there was a slightly neater way of doing this. I have been looking at the LinearGradient Class and using a Porter Duff transfer mode, but i don't seem to be having much luck with this. It seems that my source image is lost when i apply the Shader to the drawable. Anyone have any tips on how i might apply an alpha gradient to a bitmap?

Android :: Alpha Gradient on bitmap of PNG


Android :: Color Banding - Png Resource That Has Gradient Fade-out Alpha

Oct 29, 2010

Seems my original post ("ugly pngs...") somehow disappeared :( nvm.

I have a problem with a png resource that has gradient fade-out alpha.

The png looks great in the emulator, but displays an artefact known as "color banding" (http://en.wikipedia.org/wiki/Colour_banding)

Has anyone surpassed this issue ?

My designer wants to trop a shadow behind his icons, and that's where the bands appear.

What are my options ?

View 13 Replies View Related

Android :: Loading An Alpha Mask Bitmap

Oct 28, 2010

I have a single-channel PNG file I'd like to use as an alpha mask for Porter-Duff drawing operations.If I load it without any options, the resulting Bitmap has an RGB_565 config, i.e. treated as grayscale.If I set the preferred config to ALPHA_8, it loads it as a grayscale ARGB_8888 instead.How can I convince Android to treat this file as an alpha mask instead of a grayscale image?

mask1 = BitmapFactory.decodeStream(pngStream);
// mask1.getConfig() is now RGB_565

BitmapFactory.Options maskOpts = new BitmapFactory.Options();
maskOpts.inPreferredConfig = Bitmap.Config.ALPHA_8;
mask2 = BitmapFactory.decodeStream(pngStream, null, maskOpts);
// mask2.getConfig() is now ARGB_8888 (the alpha channel is fully opaque)

View 1 Replies View Related

Android :: Sample Code To Draw A Circular Gradient Mask On Bitmap In Droid?

Nov 11, 2010

Is there a way to draw a circular gradient mask on a bitmap in Android? Trying to produce something similar to a foggy window. Click the window and a transparent circle shows up revealing whats behind the window. Prefferably using a gradient so the center of the circle is completely transparent and the further out from the center the less transparent. Is this possible?

View 1 Replies View Related

Android : Crop Bitmap Without Reading Entire Bitmap / Cannot Read Image Into Memory

Jul 21, 2010

I have a very large image and I only want to display a section the size of the display (no scaling), and the section should just be the center of the image. Because the image is very large I cannot read the entire image into memory and then crop it. This is what I have so far but it will give OutOfMemory for large images. Also I don't think inSampleSize applies because I want to crop the image, not lower the resolution.

Uri data = getIntent().getData();
Input Stream is = getContentResolver().openInputStream(data);
Bitmap bitmap = BitmapFactory.decodeStream(is, null, null);

Any help would be great?

View 3 Replies View Related

Android :: Create Mutable Bitmap From Camera - Draw Another Bitmap On Top - And Save It

Apr 2, 2009

I am 1) taking a picture and 2) then draw another Bitmap on top of it 3) then I store it

I am doing it as follows and it works on the emulator.

On the device I get a OutOfMemoryError: bitmap size exceeds VM budget android.graphics.Bitmap.nativeCopy(Native Method) android.graphics.Bitmap.copy(Bitmap.java:199) in the line copy the Bitmap to get a mutable Bitmap.

CODE:...........

What I am asking:

a) Is there a better way to do what I am doing? 1) take a picture 2) draw another Bitmap on top of it 3) then I store it

b) What is the best way to create a mutable Bitmap from the picture I just took with the camera?

In my app, resolution is not an issue. If it works better for small photos that would be fine.

View 3 Replies View Related

Android :: Overlay Bitmap - Draw Over A Bitmap

Oct 8, 2009

I have two questions actually:

Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise... which one is better?

If I want to draw something transparent over a bitmap, how would I go about doing it?

If I want to overlay one transparent bitmap over another, how would I do it?

View 1 Replies View Related

Android :: Draw A Bitmap Rotated Onto Another Bitmap

Mar 22, 2009

My goal is the draw a bitmap onto another bitmap but rotated 90 degress. whats the most efficient way to do that. My current method is as follows which is horribly bad because it creates a new bitmap every time.

CODE:.....................

View 4 Replies View Related

Android :: Multiple Gradient Xml ?

Jul 23, 2010

Is there a way to have 2 gradients in a drawable xml using either a <layer-list> or <shape> or some combination of them?

View 1 Replies View Related

Android :: Get Rid Of Gradient At Top Of An Activity?

May 28, 2010

How can I get rid of the gradient at the top of my screen (the very top of the blue in the screenshot below... below the notification bar)?

View 1 Replies View Related

Android :: PNG 24 With Gradient / Not Showing Correctly

Jun 5, 2009

I have a LinearLayout and I am setting a Background image. I am using a PNG24, and the image has a gradient in it. When I see the image on the computer the gradient is perfect, but when I see it on the emulator or on a real phone, some colors are lost and I see only like 10 colors, so I see lines and not a perfect gradient. Is the emulator 'compressing' the images? Should I make them in other format?

View 3 Replies View Related

Android :: Smooth Gradient On Different Devices

Jul 26, 2010

In my app i have gradient as drawable which i am using as background and i want it to make it look as smooth as possible. After googling and trying by myself i came up with the following. On nexus one if you call only setDither(true) your gradient is still banding so you have to set PixelFormat like this Window.setFormat(PixelFormat.RGBA_8888). But on the other side G1 does not support RGBA_8888 so calling it make the gradient even uglier than before so Window.setFormat(PixelFormat.RGBA_8888) will not work well on devices that don't support it.What is the correct way smooth my gradient on all devices on which my app will run.

View 1 Replies View Related

Android :: Gradient Image Is Displayed Incorrectly

Sep 21, 2009

I have got another mysterious issue. So, I am setting a background image for LinearLayout. This image contains gradient. Don't know why, but after I launch application the image appears to consist of several parts that actually form "smooth transition" of gradient, and that's why it seems that background image is not a gradient.

View 1 Replies View Related

Android :: Gradient Banding On High DPI Devices

Nov 2, 2009

I've been looking at some issues with the background of our application, particularly on high-density devices (240 dpi, 480x854). I managed to eliminate banding on existing devices (i.e. G1/G2, 160 dpi) by applying the android:dither="true" attribute to our nine-patch image, which is a 1x480px PNG with no noise added. Looks great. However, if I use the same image on a higher resolution device, the banding is pretty nasty looking. Same happens regardless of whether I use a shape+gradient, a noisy nine-patch PNG, or an android:dithered nine-patch PNG -- even if I create an 854px-tall image. Is the use of gradients going to become a problem on high screen density devices, purely because of the display colour depth, or is there any way to solve this?

View 5 Replies View Related

Android :: Gradient Drawn On Canvas Looks Banded / What To Fix

Sep 23, 2010

I have a gray gradient drawable (png image in res/drawable). If I draw it on a white Canvas it looks banded (not smooth). If I put the gradient on white background in GIMP, and then draw this drawable on the Canvas, it looks great. What's the problem? I tested this on Nexus One. Calling setDither(true) on the drawable has no noticable effect.

View 2 Replies View Related

Android :: How To Add Padding To Gradient <shape> In Phone

Oct 25, 2009

I have a shape with a gradient that I'm using as a divider between ListView items. I've defined it as follows:

<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<gradient
android:startColor="#ccd0d3"
android:centerColor="#b6babd"
android:endColor="#ccd0d3"
android:height="1px"
android:angle="0" />

</shape>
I would like to add 6 pixels of padding on either side of the gradient, so that it doesn't extend from edge to edge of the screen.

However, no matter where I put an android:left="6px" and android:right="6px", it doesn't seem to take effect. I can put it in the <shape> element, the <gradient> element, or in a separate <padding> child of <shape>, and it doesn't change anything.

How can I add padding on the left and right of my list divider?

View 2 Replies View Related

Android :: Gradient Styles - Not Working On The Outer-most LinearLayout

Aug 10, 2010

In my Android application I've hidden the default title bar, introduced a TabView and added my own titlebar under that TabView's tabs. At the moment, I'm using the ?android:attr/windowTitleStyle style which makes my new titlebar look gray and gradient. It looks pretty good, but my screens are looking pretty grayscale. I'd like to spice things up a bit by making this titlebar a different color gradient.

What am I looking at here? Creating my own image and using it? The ?android:attr/windowTitleStyle style seems to expand depending on the height of your custom titlebar; so I'm not sure it's actually a single image.

I've attempted to throw a LinearLayout over it with a bit of translucency (ex: making the color #800000FF), but the gradient style I have behind this LinearLayout disappears.

Update:

Per my answer down below, I've figured out that I can create an XML file that defines a gradient and use that. It works fine inside a LinearLayout (titlebar_gradient) I have on my layout. However, it is not working on the outer-most LinearLayout (background_gradient). Could someone tell me why? As I understand it, the ListView should be transparent...

code:...............

View 1 Replies View Related

Android :: Way To Make Custom Seek Bar Having Color Gradient?

Feb 15, 2010

I want to make a custom seek bar having color gradient as shown in the below image URL.

View 6 Replies View Related

Android :: Fill A Path In Droid With Linear Gradient?

May 14, 2010

Given a closed Path object result is like this: http://www.tutorialguide.net/images/adobe_photoshop/0043/001.jpg. Although that is a rectangle I'm looking for something which works with any closed Path.

View 2 Replies View Related

Android :: Extend TextView To Allow Drawing Of Text With A Gradient Effect?

Apr 21, 2010

How would I extend TextView to allow the drawing of text with a gradient effect?

View 2 Replies View Related

Android :: Draw Shape Or Bitmap Into Another Bitmap - Java - Android

Jun 22, 2010

I want to draw a shape(many circles particularly) into a Specific Bitmap. I have never used canvas / 2D graphs etc. As i see it i create a Drawable put the bitmap in it then "canvas-it" to the shapes i want etc.

View 1 Replies View Related

Android :: Get The Alpha Of An ImageView

Aug 3, 2010

How can I do this? There's a setAlpha but no getAlpha.

View 2 Replies View Related

Android App Alpha Testing

Aug 4, 2013

I have been having issues downloading the latest version of my app as part of Alpha testing. I have uploaded 6 versions and every time i download the app i just get the first version.

Thinking this is something to do with cache on google play store, on few versions, i waited more then 24 hrs for the download. Even this did not work.

Is there anything that i can do to make sure that i download the latest version. All the previous versions are archived and only the latest version is published/active.

View 2 Replies View Related

Android :: Alpha Buffer Support On G1

Mar 21, 2009

Is it possible to generate an EGL Config with an alpha buffer on the G1? When I request a non-zero number of bits for the alpha buffer I can get a R5G5B5A1 or R8G8B8A8 visual, but neither of them renders correctly to the screen. I assume that's because the G1 only supports R5G6B5 visuals. It does surprise me that I can even get those visuals though. It's fairly obvious looking at the 32bpp visual artifacts that the frame buffer is indeed laid out with 32bpp, but display hardware is treating it as 16bpp, resulting in the left and right halves of my scene rendering in alternate scan lines, with distorted colors. So does anyone know if there is any way to get an alpha buffer on the G1? I've tried using FBO's but they don't seem to be implemented either. Or I'm using them incorrectly. If I call glGenFrameBuffersOES on a GL11ExtensionPack reference I get an UnsupportedOperationException. I am getting my GL11ExtensionPack reference by casting the return value from my EGLContext.getGL() call.

View 2 Replies View Related

Android :: Alpha Buffer Support

May 24, 2009

Since Google groups doesn't let you add posts to threads more than 60 days old, and I want to leave a solution to the problem I encountered a while back, I'm posting this message with the same title in hopes that anyone running into the problem I had will find this message as well. I was having trouble getting my G1 to render an RGBA_8888 OpenGL context to the screen. Everything was twice the size it should be because the 8888 pixels were being interpreted as two 565 pixels. The colors were obviously wrong as well. I had missed a critical function call. You must configure the Surface that is being used by EGL using the SurfaceHolder method setFormat. The pixel format needs to be TRANSLUCENT, or more specifically you can use RGBA_8888.

View 2 Replies View Related

Android :: Way To Apply Color To Alpha Animation

Jul 14, 2010

Is there a way to apply a color to an alpha animation in android? I know how to use the <alpha> element, but i'd like to have the alpha apply a color as well as an alpha so i can hightlight a layout. is this possible?

View 1 Replies View Related

Android : Bug With Alpha Channel In Sdk 1.5 / Remove Background?

May 19, 2009

I've just migrated to 1.5 and a strange bug has occured. I have the following code...

That means I want my image button to have no background, just image. It worked well in sdk 1.1, but now it shows a black rectangle as background. Why can it be and is there another way to remove the background?

View 3 Replies View Related

Android : Draw Circle On Alpha Channel?

Jan 12, 2010

I've created a bitmap that I'm overlaying over another bitmap. I'd like to alter the transparency of sections of the overlaid bitmap, revealing the bitmap beneath. I can't find a way to write only to the alpha channel of the overlaid bitmap.

For example, I have a bitmap filled with red pixels, and an alpha that is 255, opaque. A solid red bitmap. How do I draw a circle on this map that would lower the alpha values toward 0, transparent?

View 2 Replies View Related

Android :: Get Alpha / Opacity Of A View In Droid?

Aug 27, 2010

How can I get the alpha/opacity of a View after I've animated it? code...

View 1 Replies View Related

Android : Draw A Button - Set A Stroke Color - Align" A Gradient To The Bottom Without Knowing The Height

Jan 27, 2010

I am creating a button programmatically. It is rounded and has a gradient background, and works fine and looks nice, but I couldn't do two things I wanted:

Set a 1 pixel stroke with a given color. I tried getPaint().setStroke(), but couldn't figure how to set the stroke color. How should I do it?
Align the gradient to the bottom of the button, no matter what height it has. Is this possible?

For reference, this is the code I'm using:

CODE:...................

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved