Android :: How To Obtain The Current Bitmap Of A Canvas

Nov 16, 2010

I want to get the current bitmap associated with my canvas so I can perform operations on it. I can't see how to do this though.

I've seen some examples where you create a bitmap and set the canvas to use this bitmap, so obviously you can then access it later, but I'm using the canvas returned from a SurfaceHolder so there's no constructor.

For instance, examples often show this kind of thing:

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

So at this point I can see bmp.

In my case, the canvas is obtained by:

CODE:......

So how can I get the bitmap for c?

In short, my aim is to capture the current canvas contents where I have drawn "stuff", and make a copy of it, reversed, to put underneath. Like a reflection. The example of this that I found performed it all via bitmaps, so I assumed I needed to somehow capture the current canvas to a bitmap to then use it.

Android :: How to obtain the current bitmap of a canvas


Android :: Reset Canvas - Draw A New Bitmap Into The Canvas

Jul 7, 2010

My loadMap() method generate a canvas.throwIfRecycled exception when i try to load a new map.
When i start the game, the initial map loads and work fine though,
its only when i try to load a new map that i get the exception ..

How can i "reset" canvas and the bitmap i use to draw into, so i can startover fresh with them ?
here's what i use to create and draw my maps:

CODE:.........

So basicaly once i created and used picDest and canvas, i cannot figure how to reset it all for when i want to load a new map..

View 1 Replies View Related

Android :: Using DispatchDraw(Canvas) To Obtain Subsection Of Video Preview

Jul 29, 2010

The following is the overriden dispatchDraw in a subclass of SurfaceView. I'm trying to change the parameters of the Surface(getting only a subsection of the video preview.

CODE:......

Why does the above code not alter the dimensions of the SurfaceView at all?

View 1 Replies View Related

Android : Way To Obtain Bitmap From Data In OnPreviewFrame?

May 16, 2009

I need to capture an image from camera and display on surfaceview for my project. I am trying to obtain bitmap from data in onPreviewFrame method of previewCallback and display on surface using canvas.

View 5 Replies View Related

Android :: How To Obtain Current Local Area Code Of Handset?

Feb 16, 2010

I want to obtain the current Local Area Code of the Cell the handset is currently loged in to.
How do I get this information?

View 3 Replies View Related

Android : How To Blur A Canvas / Bitmap?

Feb 6, 2010

Can anyone point me to an example of how to blur a Canvas or Bitmap?

View 2 Replies View Related

Android :: RuntimeException: Canvas: Trying To Use A Recycled Bitmap ..

Aug 22, 2009

I am getting the following logs when i am changing the wallpaper for Homescreen. Even i am recycling the bitmap is done when the wallpaper changes in OnWallpaperChanged(). Still i m getting the bellow error.

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

View 3 Replies View Related

Android :: Difference Between View's And Bitmap's Canvas?

Mar 6, 2009

Can anyone explain me the difference between View's Canvas and Bitmaps Canvas

View 2 Replies View Related

Android :: Invert A Bitmap When Using Canvas.DrawBitmap?

May 14, 2010

I am starting to develop a game. Right now I got a sprite animation going when a player moves across using sprite sheet. In my sprite sheet the character is always facing the same way, left. Now if I want the character to move right, I want it to be facing right. So is there a quick way in android to invert the bitmap after it has been loaded in? Or do I have to create sprite sheet for character facing right?

View 2 Replies View Related

Android :: Draw And Scale A Bitmap On A Canvas Using Bicubic Interpolation

Mar 25, 2010

I want to draw a bitmap on a canvas with bigger size than it is. I can use canvas.drawBitmap(bitmap, null, destRect, null); but that gives a poor quality, as the result is pixelated, if the source image is sightly smaller than the destination rectangle. How can i draw my bitmap using bilinear or bicubic resampling?

View 1 Replies View Related

Android :: Detect When User Presses On A Bitmap Which Is Inside Canvas?

Mar 15, 2010

Does anyone how I go about detecting when a user presses on a bitmap which is inside a canvas?

View 2 Replies View Related

2D Canvas Bitmap Sprite Sheet Animation?

Oct 13, 2011

i want to create a basic animation with a sprite sheet. there is only one row with about 2 pics (that's the first animation).

View 3 Replies View Related

Android : Get Font From Previous Activity On Current On Canvas?

Aug 26, 2010

how to get font from the previous activity on current activity on canvas

View 1 Replies View Related

General :: How To Reflect Horizontally On Canvas Image Bitmap

Sep 10, 2013

At canvas there are many methods (canvas.rotate (35); canvas.drawBitmap (myBitmap, x, y, null); and many other things), but the method of mirror reflexion of image is absent (or I have not found it). At Bitmap too not that is not. Is it possible to reflect horizontally on canvas the image given Bitmap?

View 1 Replies View Related

Android :: Save Current State Of Canvas As An Image In Droid?

Nov 16, 2010

I'm developing an application which allows user to edit an image and save that edited image as new image on sd card I want to get the current state of the canvas object.

View 2 Replies View Related

General :: Set Canvas Background As Current Wallpaper

Feb 6, 2012

I know how to set the background of an XML layout as your current wallpaper, but I'm trying to find out how to set the background of canvas as current wallpaper.

View 1 Replies View Related

Android : Dump Current Screen To A Bitmap In Droid?

Jun 3, 2010

Is there way to dump the current screen to a bitmap in Android?

And what about dump screen of other applications? For example, running a service background, the foreground app could send an intent to start the service, and capture the current screen and save as a bitmap.

View 2 Replies View Related

Android :: Obtain Current GPS Location Via Android

Aug 6, 2010

I am about to build an app in Android that will act as a clock in card for employees on the road.

At teh start of a job the user will click a button that will record the GPS location and current time (thus verifying that he is where he should be at a given time) and again at the end of teh job he records the time and GPS location.

SO I reckon this will be easy enough, except that I cant find a way of pulling current location data, the nearest I can find is "onLocationChanged" which implies that I cannot get a stationary GPS read. I know it has to be possible to do this but cannot find a working example of how it would be achieved.

View 3 Replies View Related

Android :: Rotate Bitmap With Canvas.rotate

Sep 24, 2010

As we know, we can rotate a bitmap through 2 ways. The 1st way is: Matrix mt = new Matrix(); mt. postRotate (degree);Bitmap bitmap = CreateBitmap(src, 0, 0, w, h, mt, true); canvs.drawBitmap(bitmap, 0, 0, paint); In this way, we always need create new bitmap for every rotation, it is not good way for high performance game or app.The 2nd way is: canvas.save(); canvas.rotate(degree); canvas.drawBitmap(bitmap, 0, 0, paint); canvas.restore();In this way, we avoid creating new bitmap frequently, but the rotation bitmap is distortion, the bitmap quality is worse than first way.So, Is there 3rd way to rotate bitmap with high performance and good quality? Your any comments are really appreciated!

View 3 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 :: Blocking Current Activity / Screen Till Current Task Is Complete

May 13, 2010

The default behavior of an activity when BACK softkey is pressed is, GO BACK TO PREVIOUS ACTIVITY. If some the same activity is waiting for some response from server or some data updation is going on and then press BACK, I want to wait on the same screen till the current task is completely processed and then move out to the previous activity.

You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options

View 12 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 :: Want To Obtain A Virgin Map

Jul 11, 2009

Is there a way to obtain a virgin map with the Google Map Api or other API (no city and country names, i want only country borders)?

View 6 Replies View Related

Android :: Obtain GPS Location Once Every Few Minutes

Aug 23, 2010

I would like to write an app on Android to upload my GPS location to an external website once every 5 minutes. This needs to have as minimal an impact on battery life as possible, but it also needs to work without any user interaction. (Background: I'm competing in an Ironman triathlon which will take me about 14 hours to complete, and want to broadcast my location in near-real-time but without having to worry about fiddling with my phone.) So my initial thought is to write a Service which uses LocationManager.requestLocationUpdates() with a minTime of 5 minutes, but will this actually wake the device up every 5 minutes for my service to do its job?

It sounds like I would also need to use AlarmManager.setInexactRepeating() to make sure my service is awake while it completes its task but how does that play with requestLocationUpdates()? Should I instead set minTime=0 on requestLocationUpdates() but then go back to sleep as soon as the next update is obtained? Any general guidance on how to design this. I'm a competent Java programmer & will be using Google Maps on the server to plot my location, but am pretty new to Android development so I'm basically looking for a high-level plan on how to architect the client app.

View 2 Replies View Related

Android :: Obtain An Instance Of ServiceState

Jun 26, 2010

I'm trying to obtain an instance of ServiceState in my Activity. But how am i supposed to do this? There is no static method to obtain an instance or any method on any service that returns an ServiceState instance.
There is the TelephonyManager.listen() call. But i want to get the ServiceState instance when i want, not when android calls my listener because something changed.

The documentation of ServiceState can be found here: http://developer.android.com/reference/android/telephony/ServiceState.html

View 2 Replies View Related

Android :: How To Obtain Frequency From Mic On Phone?

Jun 9, 2009

I wish to obtain the frequency of an input signal from the mic. Can anyone send me some pointers on how this may be accomplished.

View 2 Replies View Related

Android :: Trying To Obtain Battery Temperature

Jan 18, 2010

I'm trying to obtain the battery temperature, the battery voltage and the battery current. The return value of the code (see below) for voltage and batteryTemperature is always 0 while the others work. I would like to know if there's any other way of obtaining this information and how. Finally, I couldn't find anything in the API for accessing the battery current... Is there any method to know its value? Code...

View 3 Replies View Related







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