Android :: Alternatives To Create Scaled Bitmap When Adding 3D
Dec 4, 2009
I have a problem - I am writing an application that displays up to 12 images on screen, and moves them around, plus reads touch events. I am using a sample code I found, and it works great. Now I need adding 3D - meaning emulating the objects moving in the Z axis, too (in/out of screen). To do this, I need to resize the images as they move. To test this, I changed the following line in my onDraw (Panel) code: canvas.drawBitmap(bitmap, coords.getX(), coords.getY(), null); to: Bitmap bmpScaled = Bitmap.createScaledBitmap(bitmap, 112, 112, false); canvas.drawBitmap(bmpScaled, coords.getX(), coords.getY(), null); Which works, BUT - movement on screen, plus response to touch events becomes real Jiggly. Checking the log I see that every call to createScaledBitmap causes garbage collection of around 90mS, which causes the total app to respond jiggly. Tried preparing 20 sized bitmaps beforehand, but since that moves the calls to those createScaledBitmap to the beginning of the app - it takes forever to load. Can you think of any workaround or other way to achieve the scaling effect?
View 3 Replies
Apr 15, 2010
I'm in the following situation: I have a large bitmap (~1280x1024) that I'd like to display on screen, scaled down in a view that fits the phone's screen (~480x320). This bitmap is frequently updated (couple of tiles per frame at 15 FPS). I first wanted to implement the rendering with a SurfaceView but figured out that all the scaling would be done in software due to limitations in the Android SDK. The second solution would be to load and render textures in an OpenGL context. Would that accelerate the resizing? If yes, isn't the cost of loading textures going to offset what I'll win on the scaling side?
View 2 Replies
View Related
Jul 26, 2010
I have a large bitmap (say 3888x2592) in a file. Now, I want to resize that bitmap to 800x533 and save it to another file.I normally would scale the bitmap by calling Bitmap.createBitmap method but it needs a source bitmap as the first argument, which I can't provide because loading the original image into a Bitmap object would of course exceed the memory (see here, for example).Is there a way to read a large image file with 10MP or more and save it to a new image file, resized to a specific new width and height, without getting an OutOfMemory exception?I also tried BitmapFactory.decodeFile(file, options) and setting the Options.outHeight and Options.outWidth values manually to 800 and 533, but it doesn't work that way.
View 4 Replies
View Related
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
May 26, 2009
How can i convert a BitmapDrawable into a Bitmap (hopefully it keeps the Alphachannel from the BitmapDrawable)..
View 11 Replies
View Related
May 4, 2010
How do I create a Bitmap from a byte[]?
View 2 Replies
View Related
Aug 18, 2010
I have an image in .png format in "drawable" folder and need to create Bitmap from it, so can use in public void drawBitmap (Bitmap<http://developer.android.com/reference/android/graphics/Bitmap.html>bitmap, float left, float top, Paint <http://developer.android.com/reference/android/graphics/Paint.html>paint)
View 2 Replies
View Related
Jul 30, 2010
I have a bitmap "picPrev" which I got from my online server. I want to turn it into a file so I can send it. I was exploring this method. code...
View 2 Replies
View Related
Jul 20, 2009
Is it possible to create a byte array from bitmap?How can I do so?
View 3 Replies
View Related
Aug 10, 2010
I am trying to build an Android application which can take several photos taken by the camera, and merge them into one giant image. For example, I might take three photos and arrange them in a vertical stack for output as a single image. Ideally, I'd like to be able to keep the images at the original size. Unfortunately, using Bitmap.createBitmap() causes an OutOfMemoryException before even approaching the size of one photo of camera dimensions. Is this possible? Or do I just need to resort to scaling the photos before trying to merge them into a single Bitmap?
View 1 Replies
View Related
Oct 29, 2010
I'm trying to create a MapView in a service (live wallpaper), but have it hidden so that I can render it to a Bitmap, and then map it to a texture to render in opengl. I have a Canvas and a Bitmap, and I intended to call myMap.draw(myCanvas) in order to get it into the correct bitmap so that I could then bind it as a texture.
When I Initialize I do the following:
myMap = new MapView(ctx, APPSTATICS.MAP_API_KEY);
I get an error:
java.lang.RuntimeException: stub at com.google.android.maps.MapView.<init> (Unknown Source)
Why I can't create a new mapview which I can use to draw to a offscreen bitmap?
View 7 Replies
View Related
Nov 12, 2010
I am using MediaStore.Images.Thumbnails.getThumbnail to create bitmap of thumbnail in htc hero , it takes lots of time to execute this. I other device it works faster. Please suggest any alternative to this method to create bitmap thumbnail so speed improves.
View 3 Replies
View Related
Nov 29, 2009
I am trying to move my code from Java to C, and I have encountered a problem while trying to find a function in C that can take an array of ints and create a bitmap from it for OpenGL. In Java, I used
bitmap = Bitmap.createBitmap( {int array name} , w, h, Config.RGB_565);
Is there a similar function that I can use in C, or a workaround that I could use?
Also, if it matters, I am programming for Android.
View 4 Replies
View Related
Oct 5, 2009
I am banging my head against the wall trying to create a Bitmap from a Path object (android.graphics.Path). Is there any way to do this? I've browsed through most of the classes now but can't seem to find any way to do it.
Actually, what I have is a Path that consists of many cubic Bezier curves. It is really expensive to draw with canvas.drawPath(). So I figured that I could perhaps "cache" the Bitmap of this Path by converting the Path to a Bitmap once and then just drawing the Bitmap every time instead of calling canvas.drawPath().
Is there any way to create a Bitmap from this Path?
Or is there a smarter way to draw tha Path multiple times without having to recalculate all of the Beziers? For example, if I created a ShapeDrawable from PathShape from the Path, and just draw the ShapeDrawable objects every time, would that be more efficient than drawing the Path every time?
View 2 Replies
View Related
Mar 2, 2010
How to load an image file (on SD card) into a Bitmap on Android?
View 1 Replies
View Related
Mar 9, 2010
How can I prevent my bitmap from being scaled automatically in an ImageView or ImageButton if the view or button is stretched using "fill_parent" or using "weight"? This will be useful, for example, to create a 4-button toolbar at the top of the screen where the buttons are equally spaced, but the images inside the buttons keep getting stretched even if I use scaleType="center", which should prevent scaling according to the doc, but it doesn't.
View 2 Replies
View Related
Aug 13, 2010
Thought I'd inquire here where perhaps some other dev is having similar problems currently. I've done this before (months ago) and as far as I can tell, I'm doing it the same way. My 480x854 24-bit PNG screenshots are being scaled/cropped by Market. Same with 480x854 jpgs. It looks like they're being cropped to 480x800 but of course, Market won't let me upload an image with those dimensions. Windows explorer confirms that my PNG file is of the proscribed size and bit depth.
The app is Metronome++ if you want to see what the problem looks like on Market. Do I really need to work around this by providing screenshots with margins? As 480x854 is a standard screen size, I am assuming the intent is for the screenshot to go edge to edge in both horizontal and vertical directions. Perhaps mistakenly.
View 4 Replies
View Related
Oct 18, 2010
I recently rebuilt my project to target 2.2 from 2.1. In the old project, I did not specify a target SDK (the manifest did not contain something like:
<uses-sdk android:minSdkVersion="8" />).
This gave me an error in the console when running, but everything worked fine so I didn't fool with it.
The new project now uses <uses-sdk android:minSdkVersion="8" /> in the manifest. But now my drawables from the /drawable-nodpi/ folder are loading with scaling, making them much smaller and significantly changing the desired visuals. If I cut out the <uses-sdk android:minSdkVersion="8" /> tag from my manifest, they load properly without scaling.
Even when loading my images like so:
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inScaled = false; Bitmap bm = BitmapFactory.decodeResource(_resources, resId, opts);
They are still scaled when I declare the minimum SDK in the manifest, but not scaled if I remove that tag. How can I load them without scaling while still declaring the minimum SDK?
View 4 Replies
View Related
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
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
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
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
Jan 4, 2010
I used the layout editor in eclipse to mock up my ui layout and then I created the code to populate it dynamically and things are showing up as different sizes. The XML I use to add the star images looks like this:
<ImageView
android:src="@drawable/star_gold"
android:layout_height="22sp"
android:layout_width="22sp"
android:adjustViewBounds="true"
android:layout_marginLeft="2sp"
android:layout_marginRight="2sp" />...............
View 4 Replies
View Related
May 3, 2010
I want to add a contact just to my phone and not to my gmail account.Whenever I start to add a contact (phone, 208544.menu, +contact, create new contact,) the next thing it forces me to do is to choose an account to create the new contact under and it lists my 3 gmail accounts.I have no option to just put it on the phone.Any ideas here?We do the same thing on the Incredible but it gives us the gmail account and the phone to choose from but not on the Motorola.
View 4 Replies
View Related
Oct 15, 2010
I'm considering taking the plunge and going all-in with Google. My primary email has always been my hotmail addy, which I've had since. whenever hotmail started. Literally. I've always had my POP addy from my ISP, but it's been more of a secondary address. The changes over the last while to Windows Live services and so forth have made email slow and clunky, and my ISP has got rid of their email servers entirely and Windows Live supplies all their email services. So, a switch to Gmail is under heavy consideration, particularly since I spend more time with my phone now than on my computer. I've got a Google account (obviously) and use many of their services, and have a Gmail account, which I never use. Google's calendar services, among others are terrific, integration with Android is seamless, while using hotmail through Android is a bit of a headache. How do people find Gmail? Is it worth a pretty major change (all my shopping sites, forums, etc will need to be changed to the new email) for what I'm hoping will be easier email usage on the go? Talk me into / out of the switch people, I need your advice.
View 5 Replies
View Related
May 6, 2009
I know that this list's objective is not to talk about the Market, but if I need a developer's POV. I just now discovered I can't even signup on the Market being from Brazil, so what other alternative I have to distribute my software? It's free / GPL software so I don't even care about payment method, I just want my software to be used and seen. Aside from publishing it on my blog page and tweeting about it, of course.
View 9 Replies
View Related
Aug 27, 2010
I keep reading articles about how new competitors to the Android Market are popping up, but I've yet to hear about any specific ones, or what they are offering that would make me want to explore them. The only Other market I've heard of is the Mikandi market for adult/porn apps, but I'm not really interested in that (at least not on my phone). I was wondering whether we could collect recommendations for other Android application stores and download sites, and add a brief review of the sites including a recommendation on why we would or would not want to use them (such as unique recommended downloads not present in the Android Market). we have a similar thread, but that one is about the best apps not found in the Android Market: Best Apps You Won't Find In Market.
View 1 Replies
View Related
May 14, 2010
However I'm not a big java fan, although I can live with that, I would like to know if there're reasonable alternatives for the android virtual machine. I've done a medium sized project using clojure, however from the reviews I read, it's very slow when running on android. How about scala ? I read that some people did experiments with it in android, is it "fast enough" ? How big is the learning curve ?
View 6 Replies
View Related
Aug 16, 2010
Anyone know whats up with TubeDroid? I mean I know WHAT'S up, YouTube changed there protocals, blocking it but are they going to fix it? Other computer based YouTube capturing programs still seem to be working OK.
I went to the makers homepage, I don't seen see it listed on there list of apps anymore. I feel kinda ripped off, paid for this crap and now it doesn't work and no word of a fix.
Sprint's 3G sucks so much butt here, I have to download YouTube video's first in order to make them play smoothly. Any alternatives to TubeDroid?
I would like something that lets me pick the high quality videos etc like TubeDroid did.
View 3 Replies
View Related
Nov 24, 2010
Google maps api is great for developing location based services for mobile phones. But for some reason the use of it is restricted for me in a special project.E.g. if your project is in conflict with the general terms and conditions of google it is not recommended to use google maps API.In my app (android, iOS) i want to display a location on a map by retrieving gps information. Overall the api should offer a similar scope of operation like google maps API.Which alternatives do you know? Maybe there are open source api's?
View 8 Replies
View Related