Android :: Cannot Create New Map View To Draw To Off Screen Bitmap
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
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
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
Nov 11, 2009
I write graphics apps for the iPhone and I'm looking to port my most recent app, 'Layers,' to the Android platform. Layers is painting app that allows users to draw on the screen and create multi-layered paintings with different brushes, colors, etc... and export to PSD. It's got desktop sync, a smudge tool, lots of good stuff... http://www.layersforiphone.com/
I started looking at the Android platform Monday and I've run into a major problem. I use OpenGL to do all the drawing because it offers the best performance. However, there are several places where I need to render into a texture and then use the texture.
For example:
Use brush texture and a line of sprites to create a black paint stroke in texture A Put brush color+alpha in glColor4f and then draw texture A onto the screen.
On the iPhone, I do this continually as the user's finger moves and I am able to achieve 12-15fps on a 1st gen iPod Touch. It's necessary because applying color and alpha to the individual sprites making up the brush stroke doesn't produce the right result (since sprites overlap and make the stroke too dark).
The android platform supports OpenGL ES 1.0 but seems to omit key functions for dealing with framebuffers. I can't find a way to bind a texture to the framebuffer and draw into it using OpenGL.
Here's how I'd normally go about it on the iPhone:
CODE:....................
Is there anything like this on the Android platform? On the iPhone, OpenGL is significantly faster than software-based drawing and is the only viable solution (trust me - I wrote a CoreGraphics painting app too...). Maybe there's another route I could take on Android? I'm willing to jump through whatever hoops are necessary, but I won't publish the app unless performance is good (10fps+ as you're drawing on the screen).
View 1 Replies
View Related
Apr 5, 2010
I have a custom component which consists of 2 text view and 4 toggle buttons. I want to draw this view at some specific position on the screen. How is that possible?
View 1 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
Nov 11, 2010
I'm trying to figure out how to draw on a bitmap in android, and keep a copy of these changed bitmaps for an undo function.
Bitmap b = ...
Paint p = new Paint();
canvas.drawBitmap(b, new Matrix(), null);
canvas.drawCircle(0,0,20,20);
//does Bitmap b have the circle drawn on it next time?
Or how do I get the bitmap after its been drawn on with the canvas(I want to preserve a stack of bitmaps with the changes applied by canvas drawing)? Maybe I'm going about this entirely wrong.
View 1 Replies
View Related
Jun 14, 2009
Can i draw text on a bitmap? I cannot find any API support this.
View 4 Replies
View Related
Nov 4, 2009
I have an application that uses GLSurfaceView to draw OpenGL ES graphics. This is all working (mostly) how I would expect.
Now, I would like to implement a screenshot feature. For normal views, it seems that the standard practice is to create a new Canvas with a Bitmap and then draw to that Canvas using View.onDraw(Canvas).
I've tried using SurfaceView.draw(Canvas) in a similar fashion, but it always results in a blank (black) image.
I've also tried using the drawing cache with the exact same result.
View 3 Replies
View Related
Dec 2, 2009
Any one know about how to draw a bitmap image?...
View 6 Replies
View Related
Nov 12, 2009
I've been trying almost everything and been searching and reading everywhere on the net. I just can't seem to find the correct way of doing this.
I have a MapActivity with a MapView and I want to draw something on an Overlay. I'm overwriting the draw-method, and I can easily draw straight on the canvas using a paint. My problem is I want to merge some circles and afterwards color them. Therefore I want to create a Bitmap and then draw on that. I just don't know what to use. Should I use a mutable Bitmap, a BitmapDrawable or am I simply going in the wrong direction.
The reason I want to do this is because I want to draw some kind of heatmap upon the Google Maps, and I need to merge and blend different circles, so they appear to be just one big blob.
View 6 Replies
View Related
Mar 9, 2009
I'm creating a simple game for Android and faced with a problem: Idea is to have a huge "map" image file and re-draw only small part of it (320*480) depending on user actions.
I didn't find a better solution than using "public static Bitmap createBitmap (Bitmap source, int x, int y, int width, int height)" method and decided to try it (expected huge performance degradation), but actually it's appeared that this method changes source bitmap and when i call it second time source size is significantly reduced. For instance this code:
CODE:.................
View 4 Replies
View Related
Aug 30, 2010
I have a byte array of RGB values, just like the contents(without header) of a *.bmp file. What I want to do is, draw the corresponding bitmap on Android, using OpenGL.
It seems that OpenGL ES doesn't have a single API that will do, it true?
If true, how can I do this?
Actually, I can draw it in JAVA code, but it's too slow and costs too much CPU time. So I want to try drawing it with OpenGL. Is there any other advises? Or maybe OpenGL can't be the right answer?
View 2 Replies
View Related
Dec 25, 2009
What 's the fastest way to display a bitmap? Now I am using Bitmap.setPixels and ImageView.setImageBitmap all time that this change. It has a refresh of 15 fps. It work good, but I am not sure that is the best method to get best performance. Is better use Canvas.drawBitmap with a SurfaceView ? or opengl ?
View 3 Replies
View Related
Mar 26, 2009
In my Java code I am setting the content of an ImageView to a Bitmap. However, before doing so I want to clip the Bitmap to a circular region. How would I go about this? I've been looking for some API that would let me set the alpha channel of the Bitmap to fully transparent for all pixels outside the circular region.
View 4 Replies
View Related
Mar 1, 2010
I want to draw a bitmap on the screen by specifying the x,y locations of the four corners. I.e. I have a square bitmap and I would like to draw the:
CODE:.........
I have seen the Canvas method: public void drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint)
However I believe this takes the top, right, bottom and left coordinates to draw the Bitmap and not the corner coordinates. I need to specify the CORNER coordinates to draw the bitmap as I may need to stretch/distort the Bitmap (I am drawing the Bitmap on a 3D spherical model).
View 9 Replies
View Related
Aug 6, 2009
I created a layout xml file that contains an extended textview. What I want is to draw the textview in a bitmap. What do I have to do after inflating the view so that I can use the draw method on the my canvas?
View 2 Replies
View Related
Oct 12, 2010
Hints to draw a spot(small filled circle) on a bitmap image.
View 1 Replies
View Related
Jul 2, 2010
I want to draw a bitmap into a shape (in this case an isosceles trapezoid); not clipped, but with the bitmap transformed to fit the shape. For example, if the height of the left side is greater than that of the right side then I want the bitmap evenly transformed in height from left to right to match the height difference. The only method I can find to do this is drawBitmapMesh, however this produces some strange results. I have searched extensively and can find no concrete information on drawBitmapMesh.
To demonstrate the example, I have a bitmap which contains an even grid of vertical and horizontal lines. I use bitmap mesh with the code shown below. However, the horizontal lines of the grid do not evenly merge downwards from the top and upwards from the bottom towards the target. Rather, horizontal lines to the left of the line dissecting the top-left to bottom-right diagonal of the shape slant downwards to the left, lines to the right of the same diagonal slant downwards to the right. I also note that that the top line of the bitmap increases slightly in height from left before descending again to the right.
Perhaps drawBitmapMesh is not the method I should be using, or perhaps I am using it incorrectly.
CODE:...................
View 2 Replies
View Related
Sep 13, 2010
I have a somewhat large (i.e. not fit in most phones' memory) bitmap on disk. I want to draw only parts of it on the screen in a way that isn't scaled (i.e. inSampleSize == 1)
Is there a way to load/draw just the part I want given a Rect specifying the area without loading the entire bitmap content?
View 2 Replies
View Related
Sep 13, 2009
I'm trying to draw Arabic text onto a Bitmap for display:
CODE:...........
However, the bitmap that is generated looks like this:
When it should look like............
I believe the issue is because, unlike a TextView, the Bitmap class is not BiDi aware, so it draws the letters from left to write.
Try as I might, I can't figure out how to draw the text in the correct order.
View 2 Replies
View Related
May 18, 2009
I'm doing performance tweaks for my new game and I seem to have come across something that isn't discussed much but I think is strange.
I have a static background bitmap loaded as RGB_565 and it draws lightning fast to the SurfaceView.
I then have all of the dynamic stuff, one of which is a full view width/height bitmap and all of these things need transparency so they are ARGB_8888. I thought that switching to ARGB_4444 for everything would speed up drawing because that's half the number of bytes to process but what I'm finding is that under no circumstances is 2D drawing any faster with ARGB_4444. All my tests are showing that it's actually twice as slow to draw an ARGB_4444 bitmap than a ARGB_8888 one on to the default RGB_565 surface!
Would any engineers care to enlighten me as to why this is? Is ARGB_8888 the fastest way to draw bitmaps with transparency?
My target platform is 1.0, btw. My friend just got a new phone and out of the box it was 1.0, not even 1.1, so I want to make sure this works as a first app on new phones. If there are 1.5-specific tweaks, I will incorporate them in a few months but for now it's gotta run well on 1.0.
View 2 Replies
View Related
Jul 23, 2010
I am working on a paint application for Android. Now I want to implement an eraser to allow erasing parts of a loaded bitmap by using touch input and making the bitmap transparent along the finger's path.
A very good example of what I try to achieve is shown in the application Steamy Window for Android. Steamy Window simulates a fogged window, where a user can wipe parts of the fog via touch input.
UPDATE: I have posted the most important sections of my current code below. I am not really happy with it for the following reasons:
Drawing is quite sluggish. What can I improve here?
I am looking for a way to use an alpha mask in order to set the pixel transparency/alpha of the pixels as I want to simulate a paint brush. Any suggestions how this could be achieved?
CODE:...................
View 1 Replies
View Related
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
Feb 9, 2010
To draw a scalable rectangle around a bitmap
And such that
1) The rectangle should scale based on the size of my bitmap
2) The colour of my rectangle should change on my input
View 2 Replies
View Related
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
Sep 28, 2010
Is it possible to create a view that is bigger than the screen? I need a view that has a bigger width then the screen of the device. I use this view in a rotation animation. During the rotation the parts that were not on the screen before animating the view will become visible.
Is there a way to achieve this effect with the android framework?
I tried to set my parent layout much bigger then the screen and it is working. This will make somethings a little bit uncomfortable but it could work. The next problem now is that my layout still starts at the left side of the screen. I can't think of a method to make the layout to expand itself to the left and the right of the screen.
View 5 Replies
View Related
Nov 7, 2010
How to create multiple View in one screen?
View 2 Replies
View Related
Jun 22, 2010
Is it possible to create a bitmap image from a view or the screen in Android?
View 1 Replies
View Related