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)

Android :: Loading an alpha mask bitmap


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 :: 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?

View 2 Replies View Related

Android :: Loading A Resource To A Mutable Bitmap

Sep 11, 2010

I am loading a bitmap from a resource like so:

Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image);

What I want to do is make some changes to the bitmap before It gets drawn to the main canvas in my draw method (As it would seem wasteful to repeat lots of drawing in my main loop when it isn't going to change). I am making the changes to the bitmap with the following:

Canvas c = new Canvas(mBackground);
c.drawARGB(...); // etc

So naturally I get an exception

java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor

So to avoid that I made a copy of the bitmap so that it is mutable

Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image).copy(Bitmap.Config.ARGB_8888, true);

Which avoid the problem however it sometimes causes OutOfMemoryExceptions, do know any better ways of achieving what I want?

View 2 Replies View Related

Android :: Optimizing Bitmap Loading By Using ASyncTask

Aug 4, 2010

I have been trying to optimize my single thread app which loads a bunch of tiles that makeup a large bitmap.The app was becoming very sluggish when it would load the new tiles into system memory.I'm now looking trying to use Async Tasks for this purpose. The app detects which tile is in the top left in a method called by onDraw, creates a string that contains the path of the bitmap in the Assets folder, and then checks to see if the bitmap is null before drawing. If it is null, it will load it into memory. My idea was to process the bitmap in DoBackground, and in postExecute trigger a view invalidate to display the async loaded bitmap. Few questions:

1.) can i execute my aSync task for each bitmap? (this statement: new myAsyncTaskManager().execute(bitmapPath); if not, what is the best way to go about it since the only thing aSync will do is just load bitmaps into memory?

2.) Is it possible to set the priority aSyncTask if the bitmaps load too slow?

3.) Is there a better way to go about this? im certain it is the bitmap loading, and not the canvas drawing that slows down the app.

My temporary aSync code:

private class myAsyncTaskManager extends AsyncTask<String, Void, String> {

@Override
protected String doInBackground(String... bitmapPath) {
Log.e("sys","i ran using aTask");
try {

bitmapArray[rectBeingDrawn] = BitmapFactory.decodeStream(assetManager.open(imagePathToLoad));

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} return null;
}

@Override
protected void onPostExecute(String result) {
// execution of result of Long time consuming operation
mCampusMap.invalidate()

View 2 Replies View Related

Android :: OutOfMemory Exception When Loading Bitmap From External Storage

Nov 5, 2010

In my application I load a couple of images from JPEG and PNG files. When I place all those files into assets directory and load it in this way, everything is ok:

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

But when I try to load the exact same images from sd card, I get an OutOfMemory exception!

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

This is what I get in the log:

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

UPDATE: Tried both of these on real device - it seems that I can't load more than 12MB of bitmaps into whatever is called "external memory" (this is not an sd card).

View 7 Replies View Related

Android :: Loading Only Part Of Bitmap File In Android

Mar 30, 2010

I would like to load a cropped version of a bitmap image into a Bitmap object, without loading the original bitmap as well. Is this at all possible without writing custom loading routines to handle the raw data?

View 1 Replies View Related

Android :: Is There Any Way To Fully Mask Browser ID

May 11, 2010

Is there any way to fully mask browser ID (on default or other browser). On my "other" device, I could ID either the stock browser or Opera as IE and access non-mobile versions of sites that have sniffers.I do not see the same options on Android. I can disable mobile view but it will not get by some sites that still force mobile versions.

View 7 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 :: Best Way To Apply A Mask To An EditText On Droid?

Oct 8, 2010

What's the best way to mask a EditText on Android?
I Would like my EditText to behave like this decimal number input here.
Is there a easy way to do this?

View 2 Replies View Related

Android :: Specify An Input Mask To EditText Control In Droid?

May 26, 2010

Is there a way I can specify an input mask to the EditText control in Android?

I want be able to specify something like ### - ## - #### for a Social Security Number. This will cause any invalid input to be rejected automatically (example, I type alphabetical characters instead of numeric digits).

I realize that I can add an OnKeyListener and manually check for validity. But this is tedious and I will have to handle various edge cases.

View 3 Replies View Related

Android : Mask Password Input In Fullscreen Virtual Keypad?

Feb 24, 2010

Can you guys share how can we mask password input in fullscreen virtual keypad. EditText setPinEditText= new EditText(context); setPinEditText.setImeOptions(EditorInfo.IME_ACTION_UNSPECIFIED);)

I tried using setPinEditText.setTransformationMethod(new PasswordTransformationMethod());

Masking the password input in portrait vkp mode works fine with this change but when I rotate to landscape mode, in fullscreen virtual keyboard mode it doenst worked.

View 9 Replies View Related

Animated Layout Mask?

Nov 4, 2013

I want to have a couple of layouts and have one of them animate to reveal the layout below. I've attached a crude image of what I'm attempting to do.

As the top layout animates out of the way, I want all of its contents to remain in their relative positions. The same goes for the layout behind.

I have tried setting one of the layout's height to 0 and then animated it to be full height, but this reeks havoc on the scaling and the placement of the elements inside. I also tried implementing the solution in the link below, but it didn't do what I needed.

Is it possible to mask a View in android? - Stack Overflow

View 5 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

General :: Use VPN (on PC) To Mask Tethering Traffic?

Sep 10, 2013

would enabling a VPN on my PC (such as Private Internet Access) while tethering an android phone running CM 10.1 mask this tethering traffic from the carrier?

View 3 Replies View Related

Android :: Displaying A Now Loading Image While Applic - Loading

May 4, 2009

I want to display a fancy 'loading' image at my app's startup time.

The problem: my startup code is mostly GUI related, hence needs to run on UI thread.

Is there a way to do both - that is run UI-related code on UI thread while an image is displayed to the user?

View 8 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 :: Blinking Image Using Alpha Fade Animation

Oct 11, 2010

I've been struggling for a few days on this, finally just decided to ask. It's so simple I've got to be missing something very basic.I have an XML layout page with an image defined. I have two anim XML pages, one to change alpha from 0 to 1, and the other from 1 to 0 in order to create a "blinking" effect. So the alphaAnimation is defined in XML, I just need to call it. The image pops up, but there's no looping blinking effect.

View 2 Replies View Related

2.1 Update :: Xperia X10 Android 2.2 Froyo (Alpha Version)

Nov 28, 2010

There is Froyo running on an X10, I know its true because its my x10, this is an Alpha version and runs from the SD Card, it is not even a beta version yet but this version is around 90% done, still some things to resolve. This is not a re-flash of the phone it is a dual boot so has not affected the SE base operating system currently installed being 2.1.

The guys at XDA are working on this and if they get it fully resolved then it will become available as an alternative system, if they keep it as dual boot it will never affect your warranty. At all as this installs on your SD Card, there is a thread on the XDA forum but in respect of this forums policy on rooting and other things I wont post the link but searching the XDA forum for x10 Custom Rom will return a number of results so you can find it from there yourself.

If the guys at XDA can do this then SE can, the only thing is XDA are not restricted by International markets and operator restrictions like SE are, if XDA make a custom rom that runs 2.2. From the SD Card then for me its perfect it keeps the phone warranty and software as is and lest you run your own free Froyo version. The pictures are not photo shopped except for clipping and sizing from the original.

View 7 Replies View Related

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







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